From 24946770ae58744bcb992f5afd49f8a87d8de5ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1nos=20Veres?= Date: Sat, 27 Apr 2024 09:55:31 +0200 Subject: [PATCH 1/6] fix: fast-json-patch commonjs import is wrong --- package-lock.json | 117 ++++++++++++++++++++++++------------ packages/ogre/package.json | 2 +- packages/ogre/tsconfig.json | 7 ++- 3 files changed, 83 insertions(+), 43 deletions(-) diff --git a/package-lock.json b/package-lock.json index 34c62a9..d50d503 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5141,14 +5141,15 @@ } }, "node_modules/call-bind": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.6.tgz", - "integrity": "sha512-Mj50FLHtlsoVfRfnHaZvyrooHcrlceNZdL/QBvJJVd9Ta55qCQK0gs4ss2oZDeV9zFCs6ewzYgVE5yfVmfFpVg==", + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz", + "integrity": "sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==", "dependencies": { + "es-define-property": "^1.0.0", "es-errors": "^1.3.0", "function-bind": "^1.1.2", - "get-intrinsic": "^1.2.3", - "set-function-length": "^1.2.0" + "get-intrinsic": "^1.2.4", + "set-function-length": "^1.2.1" }, "engines": { "node": ">= 0.4" @@ -6339,6 +6340,17 @@ "resolved": "https://registry.npmjs.org/es-array-method-boxes-properly/-/es-array-method-boxes-properly-1.0.0.tgz", "integrity": "sha512-wd6JXUmyHmt8T5a2xreUwKcGPq6f1f+WwIJkijUqiGcJz1qqnZgP6XIK+QyIWU5lT7imeNxUll48bziG+TSYcA==" }, + "node_modules/es-define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz", + "integrity": "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==", + "dependencies": { + "get-intrinsic": "^1.2.4" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/es-errors": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", @@ -8107,11 +8119,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/immutable-json-patch": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/immutable-json-patch/-/immutable-json-patch-6.0.1.tgz", - "integrity": "sha512-BHL/cXMjwFZlTOffiWNdY8ZTvNyYLrutCnWxrcKPHr5FqpAb6vsO6WWSPnVSys3+DruFN6lhHJJPHi8uELQL5g==" - }, "node_modules/import-cwd": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/import-cwd/-/import-cwd-3.0.0.tgz", @@ -12196,13 +12203,17 @@ } }, "node_modules/side-channel": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", - "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.6.tgz", + "integrity": "sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==", "dependencies": { - "call-bind": "^1.0.0", - "get-intrinsic": "^1.0.2", - "object-inspect": "^1.9.0" + "call-bind": "^1.0.7", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.4", + "object-inspect": "^1.13.1" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -14005,9 +14016,9 @@ } }, "node_modules/typescript": { - "version": "5.4.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.4.tgz", - "integrity": "sha512-dGE2Vv8cpVvw28v8HCPqyb08EzbBURxDpuhJvTrusShUfGnhHBafDsLdS1EhhxyL6BJQE+2cT3dDPAv+MQ6oLw==", + "version": "5.4.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.5.tgz", + "integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==", "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -14796,6 +14807,29 @@ "eslint-config-prettier": "^8.10.0" } }, + "packages/jsonpatch": { + "name": "@dotinc/json-patch", + "version": "3.1.1", + "extraneous": true, + "license": "MIT", + "devDependencies": { + "benchmark": "^2.1.4", + "bluebird": "^3.5.5", + "bluebird-retry": "^0.11.0", + "chalk": "^2.4.2", + "event-target-shim": "^5.0.1", + "fast-deep-equal": "^2.0.1", + "http-server": "^0.12.3", + "jasmine": "^3.4.0", + "request": "^2.88.0", + "sauce-connect-launcher": "^1.2.7", + "saucelabs": "^2.1.9", + "selenium-webdriver": "^4.0.0-alpha.4", + "typescript": "~5.4.5", + "webpack": "^4.35.0", + "webpack-cli": "^3.3.5" + } + }, "packages/ogre": { "name": "@dotinc/ogre", "version": "0.10.0", @@ -14803,7 +14837,6 @@ "dependencies": { "fast-json-patch": "^3.1.1", "fflate": "^0.8.2", - "immutable-json-patch": "^6.0.1", "tslib": "^2.6.2" }, "devDependencies": { @@ -15436,7 +15469,6 @@ "@types/uuid": "^8.3.4", "fast-json-patch": "^3.1.1", "fflate": "^0.8.2", - "immutable-json-patch": "^6.0.1", "nyc": "^15.1.0", "tap": "^18.7.0", "ts-node": "^10.8.1", @@ -18379,14 +18411,15 @@ } }, "call-bind": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.6.tgz", - "integrity": "sha512-Mj50FLHtlsoVfRfnHaZvyrooHcrlceNZdL/QBvJJVd9Ta55qCQK0gs4ss2oZDeV9zFCs6ewzYgVE5yfVmfFpVg==", + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz", + "integrity": "sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==", "requires": { + "es-define-property": "^1.0.0", "es-errors": "^1.3.0", "function-bind": "^1.1.2", - "get-intrinsic": "^1.2.3", - "set-function-length": "^1.2.0" + "get-intrinsic": "^1.2.4", + "set-function-length": "^1.2.1" } }, "callsites": { @@ -19297,6 +19330,14 @@ "resolved": "https://registry.npmjs.org/es-array-method-boxes-properly/-/es-array-method-boxes-properly-1.0.0.tgz", "integrity": "sha512-wd6JXUmyHmt8T5a2xreUwKcGPq6f1f+WwIJkijUqiGcJz1qqnZgP6XIK+QyIWU5lT7imeNxUll48bziG+TSYcA==" }, + "es-define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz", + "integrity": "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==", + "requires": { + "get-intrinsic": "^1.2.4" + } + }, "es-errors": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", @@ -20584,11 +20625,6 @@ } } }, - "immutable-json-patch": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/immutable-json-patch/-/immutable-json-patch-6.0.1.tgz", - "integrity": "sha512-BHL/cXMjwFZlTOffiWNdY8ZTvNyYLrutCnWxrcKPHr5FqpAb6vsO6WWSPnVSys3+DruFN6lhHJJPHi8uELQL5g==" - }, "import-cwd": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/import-cwd/-/import-cwd-3.0.0.tgz", @@ -23564,13 +23600,14 @@ "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==" }, "side-channel": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", - "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.6.tgz", + "integrity": "sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==", "requires": { - "call-bind": "^1.0.0", - "get-intrinsic": "^1.0.2", - "object-inspect": "^1.9.0" + "call-bind": "^1.0.7", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.4", + "object-inspect": "^1.13.1" } }, "signal-exit": { @@ -24833,9 +24870,9 @@ } }, "typescript": { - "version": "5.4.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.4.tgz", - "integrity": "sha512-dGE2Vv8cpVvw28v8HCPqyb08EzbBURxDpuhJvTrusShUfGnhHBafDsLdS1EhhxyL6BJQE+2cT3dDPAv+MQ6oLw==" + "version": "5.4.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.5.tgz", + "integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==" }, "typescript-memoize": { "version": "1.1.0", diff --git a/packages/ogre/package.json b/packages/ogre/package.json index a7b5e31..78510cf 100644 --- a/packages/ogre/package.json +++ b/packages/ogre/package.json @@ -9,6 +9,7 @@ "private": false, "main": "lib/index.js", "types": "lib/index.d.ts", + "type": "module", "scripts": { "build": "tsc -p tsconfig.build.json", "test": "nyc --reporter=lcov tap --coverage-report=none --allow-incomplete-coverage", @@ -22,7 +23,6 @@ "dependencies": { "fast-json-patch": "^3.1.1", "fflate": "^0.8.2", - "immutable-json-patch": "^6.0.1", "tslib": "^2.6.2" }, "devDependencies": { diff --git a/packages/ogre/tsconfig.json b/packages/ogre/tsconfig.json index c58bb6e..27dcd9d 100644 --- a/packages/ogre/tsconfig.json +++ b/packages/ogre/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "declaration": true, "importHelpers": true, - "module": "commonjs", + "module": "umd", "outDir": "./lib", "rootDir": "./src", "strict": true, @@ -12,5 +12,8 @@ "include": [ "./src/**/*.ts" ], - "exclude": ["lib", "node_modules"] + "exclude": [ + "lib", + "node_modules" + ] } From 63810e3fbbcfa64b579b8bd39aeb9ac1054de6f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1nos=20Veres?= Date: Sat, 27 Apr 2024 10:03:31 +0200 Subject: [PATCH 2/6] fix: type module --- packages/ogre/src/commit.ts | 14 +++++++------- packages/ogre/src/git2json.ts | 6 +++--- packages/ogre/src/index.ts | 14 +++++++------- packages/ogre/src/interfaces.ts | 2 +- packages/ogre/src/merge.test.ts | 2 +- packages/ogre/src/repository.test.ts | 6 +++--- packages/ogre/src/repository.ts | 6 +++--- packages/ogre/src/tag.test.ts | 2 +- packages/ogre/src/test.utils.ts | 4 ++-- packages/ogre/src/utils.test.ts | 6 +++--- packages/ogre/src/utils.ts | 8 ++++---- packages/ogre/tsconfig.json | 3 ++- 12 files changed, 37 insertions(+), 36 deletions(-) diff --git a/packages/ogre/src/commit.ts b/packages/ogre/src/commit.ts index 77d38aa..9b3c295 100644 --- a/packages/ogre/src/commit.ts +++ b/packages/ogre/src/commit.ts @@ -1,14 +1,14 @@ -import { digest } from "./hash"; +import { digest } from "./hash.js"; import { Operation } from "fast-json-patch"; export interface Commit { /*The hash of the commit. Is a sha256 of: - - tree object reference (changes?) - - parent object reference (parent hash) - - author - - author commit timestamp with timezone - - commit message - */ + - tree object reference (changes?) + - parent object reference (parent hash) + - author + - author commit timestamp with timezone + - commit message + */ hash: string; tree: string; diff --git a/packages/ogre/src/git2json.ts b/packages/ogre/src/git2json.ts index 3aea10e..8d68ae9 100644 --- a/packages/ogre/src/git2json.ts +++ b/packages/ogre/src/git2json.ts @@ -1,11 +1,11 @@ -import { Commit } from "./commit"; -import { History, Reference } from "./interfaces"; +import { Commit } from "./commit.js"; +import { History, Reference } from "./interfaces.js"; import { cleanAuthor, createHeadRefValue, isTagRef, REFS_HEAD_KEY, -} from "./utils"; +} from "./utils.js"; const findRefs = (commit: Commit, refs: Map) => { const list = []; diff --git a/packages/ogre/src/index.ts b/packages/ogre/src/index.ts index c8d830b..1c218ce 100644 --- a/packages/ogre/src/index.ts +++ b/packages/ogre/src/index.ts @@ -1,9 +1,9 @@ -export * from "./interfaces"; -export * from "./repository"; -export { Commit } from "./commit"; -export * from "./ref"; -export * from "./size"; -export * from "./utils"; -export * from "./git2json"; +export * from "./interfaces.js"; +export * from "./repository.js"; +export { Commit } from "./commit.js"; +export * from "./ref.js"; +export * from "./size.js"; +export * from "./utils.js"; +export * from "./git2json.js"; export { compare, deepClone, Operation, JsonPatchError } from "fast-json-patch"; diff --git a/packages/ogre/src/interfaces.ts b/packages/ogre/src/interfaces.ts index 6259292..a5417d4 100644 --- a/packages/ogre/src/interfaces.ts +++ b/packages/ogre/src/interfaces.ts @@ -1,4 +1,4 @@ -import { Commit } from "./commit"; +import { Commit } from "./commit.js"; export interface Reference { name: string; diff --git a/packages/ogre/src/merge.test.ts b/packages/ogre/src/merge.test.ts index fb3fa9d..1d7db58 100644 --- a/packages/ogre/src/merge.test.ts +++ b/packages/ogre/src/merge.test.ts @@ -1,5 +1,5 @@ import { test } from "tap"; -import { getBaseline, testAuthor } from "./test.utils"; +import { getBaseline, testAuthor } from "./test.utils.js"; test("merge with no commit fails", async (t) => { const [repo] = await getBaseline(); diff --git a/packages/ogre/src/repository.test.ts b/packages/ogre/src/repository.test.ts index 742e232..b54093b 100644 --- a/packages/ogre/src/repository.test.ts +++ b/packages/ogre/src/repository.test.ts @@ -1,6 +1,6 @@ import { test } from "tap"; -import { Repository } from "./repository"; +import { Repository } from "./repository.js"; import { addOneStep, addOneStep as addOneNested, @@ -9,8 +9,8 @@ import { sumChanges, testAuthor, updateHeaderData, -} from "./test.utils"; -import { Reference } from "./interfaces"; +} from "./test.utils.js"; +import { Reference } from "./interfaces.js"; import { compare } from "fast-json-patch"; test("diff is ok", async (t) => { diff --git a/packages/ogre/src/repository.ts b/packages/ogre/src/repository.ts index 4320b2c..ce361ed 100644 --- a/packages/ogre/src/repository.ts +++ b/packages/ogre/src/repository.ts @@ -11,8 +11,8 @@ import { unobserve, validate, } from "fast-json-patch"; -import { calculateCommitHash, Commit } from "./commit"; -import { History, Reference } from "./interfaces"; +import { calculateCommitHash, Commit } from "./commit.js"; +import { History, Reference } from "./interfaces.js"; import { compressSync, strToU8 } from "fflate"; import { brancheNameToRef, @@ -34,7 +34,7 @@ import { treeToObject, validateBranchName, validateRef, -} from "./utils"; +} from "./utils.js"; export interface RepositoryOptions { history?: History; diff --git a/packages/ogre/src/tag.test.ts b/packages/ogre/src/tag.test.ts index ca1c0be..f3f4025 100644 --- a/packages/ogre/src/tag.test.ts +++ b/packages/ogre/src/tag.test.ts @@ -1,5 +1,5 @@ import { test } from "tap"; -import { getBaseline, testAuthor } from "./test.utils"; +import { getBaseline, testAuthor } from "./test.utils.js"; test("cannot tag on an empty repo", async (t) => { const [repo] = await getBaseline(); diff --git a/packages/ogre/src/test.utils.ts b/packages/ogre/src/test.utils.ts index 4908298..ef7d6b3 100644 --- a/packages/ogre/src/test.utils.ts +++ b/packages/ogre/src/test.utils.ts @@ -1,6 +1,6 @@ import { v4 as uuid4 } from "uuid"; -import { Repository, RepositoryObject } from "./repository"; -import { Commit } from "./commit"; +import { Repository, RepositoryObject } from "./repository.js"; +import { Commit } from "./commit.js"; export type NestedObject = { name?: string; diff --git a/packages/ogre/src/utils.test.ts b/packages/ogre/src/utils.test.ts index 854edc0..9749b7a 100644 --- a/packages/ogre/src/utils.test.ts +++ b/packages/ogre/src/utils.test.ts @@ -1,7 +1,7 @@ import { test } from "tap"; -import { cleanAuthor, mapPath, shaishToCommit } from "./utils"; -import { Repository } from "./repository"; -import { ComplexObject, testAuthor } from "./test.utils"; +import { cleanAuthor, mapPath, shaishToCommit } from "./utils.js"; +import { Repository } from "./repository.js"; +import { ComplexObject, testAuthor } from "./test.utils.js"; test("author ", (t) => { const [name, email] = cleanAuthor("author "); diff --git a/packages/ogre/src/utils.ts b/packages/ogre/src/utils.ts index 20d6326..9aecd71 100644 --- a/packages/ogre/src/utils.ts +++ b/packages/ogre/src/utils.ts @@ -1,10 +1,10 @@ // [RFC5322](https://www.ietf.org/rfc/rfc5322.txt) -import { Commit } from "./commit"; -import { Reference } from "./interfaces"; +import { Commit } from "./commit.js"; +import { Reference } from "./interfaces.js"; import { decompressSync, strFromU8 } from "fflate"; -import { validBranch, validRef } from "./ref"; +import { validBranch, validRef } from "./ref.js"; import { deepClone, Operation } from "fast-json-patch"; -import { RepositoryObject } from "./repository"; +import { RepositoryObject } from "./repository.js"; const emailRegex = /(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/; diff --git a/packages/ogre/tsconfig.json b/packages/ogre/tsconfig.json index 27dcd9d..a6ad95c 100644 --- a/packages/ogre/tsconfig.json +++ b/packages/ogre/tsconfig.json @@ -1,8 +1,9 @@ { "compilerOptions": { + "moduleResolution": "nodenext", "declaration": true, "importHelpers": true, - "module": "umd", + "module": "NodeNext", "outDir": "./lib", "rootDir": "./src", "strict": true, From a3223b57d8d5f08fa95b0e70d1b75cc2f27dc514 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1nos=20Veres?= Date: Sat, 27 Apr 2024 10:21:28 +0200 Subject: [PATCH 3/6] chore: fix imports --- packages/ogre/src/branch.test.ts | 2 +- packages/ogre/src/checkout.test.ts | 4 ++-- packages/ogre/src/commit.test.ts | 5 ++--- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/packages/ogre/src/branch.test.ts b/packages/ogre/src/branch.test.ts index 397f8a9..be867bd 100644 --- a/packages/ogre/src/branch.test.ts +++ b/packages/ogre/src/branch.test.ts @@ -1,5 +1,5 @@ import { test } from "tap"; -import { getBaseline, sumChanges, testAuthor } from "./test.utils"; +import { getBaseline, sumChanges, testAuthor } from "./test.utils.js"; test("current branch on empty repo is HEAD", async (t) => { const [repo] = await getBaseline(); diff --git a/packages/ogre/src/checkout.test.ts b/packages/ogre/src/checkout.test.ts index cb15178..46de15f 100644 --- a/packages/ogre/src/checkout.test.ts +++ b/packages/ogre/src/checkout.test.ts @@ -6,8 +6,8 @@ import { sumChanges, testAuthor, updateHeaderData, -} from "./test.utils"; -import { Repository } from "./repository"; +} from "./test.utils.js"; +import { Repository } from "./repository.js"; test("checkout prev commit", async (t) => { const [repo, obj] = await getBaseline(); diff --git a/packages/ogre/src/commit.test.ts b/packages/ogre/src/commit.test.ts index 3439376..aef5632 100644 --- a/packages/ogre/src/commit.test.ts +++ b/packages/ogre/src/commit.test.ts @@ -7,9 +7,8 @@ import { sumChanges, testAuthor, updateHeaderData, -} from "./test.utils"; -import { Repository } from "./repository"; -import { printChangeLog } from "./utils"; +} from "./test.utils.js"; +import { Repository } from "./repository.js"; test("baseline with 1 commit and zero changelog entries", async (t) => { const [repo] = await getBaseline(); From 3da5467532498998831572243a312c0ab9a3ddc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1nos=20Veres?= Date: Sat, 27 Apr 2024 10:21:46 +0200 Subject: [PATCH 4/6] chore: fix imports to point to .mjs --- packages/ogre/src/commit.ts | 14 +++++++------- packages/ogre/src/index.ts | 7 ++++++- packages/ogre/src/repository.test.ts | 2 +- packages/ogre/src/repository.ts | 2 +- packages/ogre/src/utils.ts | 2 +- 5 files changed, 16 insertions(+), 11 deletions(-) diff --git a/packages/ogre/src/commit.ts b/packages/ogre/src/commit.ts index 9b3c295..3b37a1b 100644 --- a/packages/ogre/src/commit.ts +++ b/packages/ogre/src/commit.ts @@ -1,14 +1,14 @@ import { digest } from "./hash.js"; -import { Operation } from "fast-json-patch"; +import { Operation } from "fast-json-patch/index.mjs"; export interface Commit { /*The hash of the commit. Is a sha256 of: - - tree object reference (changes?) - - parent object reference (parent hash) - - author - - author commit timestamp with timezone - - commit message - */ + - tree object reference (changes?) + - parent object reference (parent hash) + - author + - author commit timestamp with timezone + - commit message + */ hash: string; tree: string; diff --git a/packages/ogre/src/index.ts b/packages/ogre/src/index.ts index 1c218ce..c860654 100644 --- a/packages/ogre/src/index.ts +++ b/packages/ogre/src/index.ts @@ -6,4 +6,9 @@ export * from "./size.js"; export * from "./utils.js"; export * from "./git2json.js"; -export { compare, deepClone, Operation, JsonPatchError } from "fast-json-patch"; +export { + compare, + deepClone, + Operation, + JsonPatchError, +} from "fast-json-patch/index.mjs"; diff --git a/packages/ogre/src/repository.test.ts b/packages/ogre/src/repository.test.ts index b54093b..d4acff7 100644 --- a/packages/ogre/src/repository.test.ts +++ b/packages/ogre/src/repository.test.ts @@ -11,7 +11,7 @@ import { updateHeaderData, } from "./test.utils.js"; import { Reference } from "./interfaces.js"; -import { compare } from "fast-json-patch"; +import { compare } from "fast-json-patch/index.mjs"; test("diff is ok", async (t) => { const [repo, obj] = await getBaseline(); diff --git a/packages/ogre/src/repository.ts b/packages/ogre/src/repository.ts index ce361ed..2a2fc8b 100644 --- a/packages/ogre/src/repository.ts +++ b/packages/ogre/src/repository.ts @@ -10,7 +10,7 @@ import { Operation, unobserve, validate, -} from "fast-json-patch"; +} from "fast-json-patch/index.mjs"; import { calculateCommitHash, Commit } from "./commit.js"; import { History, Reference } from "./interfaces.js"; import { compressSync, strToU8 } from "fflate"; diff --git a/packages/ogre/src/utils.ts b/packages/ogre/src/utils.ts index 9aecd71..d5548d5 100644 --- a/packages/ogre/src/utils.ts +++ b/packages/ogre/src/utils.ts @@ -3,7 +3,7 @@ import { Commit } from "./commit.js"; import { Reference } from "./interfaces.js"; import { decompressSync, strFromU8 } from "fflate"; import { validBranch, validRef } from "./ref.js"; -import { deepClone, Operation } from "fast-json-patch"; +import { deepClone, Operation } from "fast-json-patch/index.mjs"; import { RepositoryObject } from "./repository.js"; const emailRegex = From 22725d39af6a0c845b7e2d2260a059e760e76b32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1nos=20Veres?= Date: Sat, 27 Apr 2024 10:22:00 +0200 Subject: [PATCH 5/6] chore: move node to dynamic import in esm --- packages/ogre/src/hash.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/ogre/src/hash.ts b/packages/ogre/src/hash.ts index ecc4dcd..8a9b0d4 100644 --- a/packages/ogre/src/hash.ts +++ b/packages/ogre/src/hash.ts @@ -24,13 +24,13 @@ export function digest( obj: any, algorithm = "SHA-256", - isBrowser = false + isBrowser = false, ): Promise { // eslint-disable-line const algorithms = ["SHA-1", "SHA-256", "SHA-384", "SHA-512"]; if (!algorithms.includes(algorithm)) { throw RangeError( - `Valid hash algorithm values are any of ${JSON.stringify(algorithms)}` + `Valid hash algorithm values are any of ${JSON.stringify(algorithms)}`, ); } return (async function (obj, algorithm) { @@ -46,7 +46,7 @@ export function digest( }); } else { const nodeAlg = algorithm.toLowerCase().replace("-", ""); - digest = require("crypto") + digest = (await import("crypto")) .createHash(nodeAlg) .update(Buffer.from(hashInput)) .digest("hex"); // eslint-disable-line From c319746f25936f531cd5bff52fc22bba27eadd0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1nos=20Veres?= Date: Sat, 27 Apr 2024 11:00:00 +0200 Subject: [PATCH 6/6] chore: apply patch to fast-json-patch --- package-lock.json | 401 +++++++++++++++++++++++++++ package.json | 6 +- packages/ogre/src/commit.ts | 14 +- packages/ogre/src/index.ts | 7 +- packages/ogre/src/repository.test.ts | 2 +- packages/ogre/src/repository.ts | 2 +- packages/ogre/src/utils.ts | 2 +- patches/fast-json-patch+3.1.1.patch | 18 ++ 8 files changed, 434 insertions(+), 18 deletions(-) create mode 100644 patches/fast-json-patch+3.1.1.patch diff --git a/package-lock.json b/package-lock.json index d50d503..83fcd15 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,6 +7,7 @@ "": { "name": "ogre", "version": "1.0.0", + "hasInstallScript": true, "license": "MIT", "workspaces": [ "apps/*", @@ -19,6 +20,7 @@ "@auto-it/released": "^11.0.7", "auto": "^11.0.7", "dotenv-cli": "^7.3.0", + "patch-package": "^8.0.0", "prettier": "^3.2.5", "turbo": "latest" }, @@ -4231,6 +4233,12 @@ "integrity": "sha512-lcHyyLfS2ro282qsXKpxw+canUkOlFIGoanxt3BaNCm5K1NR8k4hGvYbFO54/+QWq12d0y/EYRz68yNQkqWFrw==", "dev": true }, + "node_modules/@yarnpkg/lockfile": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@yarnpkg/lockfile/-/lockfile-1.1.0.tgz", + "integrity": "sha512-GpSwvyXOcOOlV70vbnzjj4fW5xW/FdUF6nQEt1ENy7m4ZCczi1+/buVUPAqmGfqznsORNFzUMjctTIp8a9tuCQ==", + "dev": true + }, "node_modules/abbrev": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-2.0.0.tgz", @@ -4640,6 +4648,15 @@ "has-symbols": "^1.0.3" } }, + "node_modules/at-least-node": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", + "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==", + "dev": true, + "engines": { + "node": ">= 4.0.0" + } + }, "node_modules/author-regex": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/author-regex/-/author-regex-1.0.0.tgz", @@ -7247,6 +7264,15 @@ "node": ">=8" } }, + "node_modules/find-yarn-workspace-root": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/find-yarn-workspace-root/-/find-yarn-workspace-root-2.0.0.tgz", + "integrity": "sha512-1IMnbjt4KzsQfnhnzNd8wUEgXZ44IzZaZmnLYx7D5FZlaHt2gW20Cri8Q+E/t5tIj4+epTBub+2Zxu/vNILzqQ==", + "dev": true, + "dependencies": { + "micromatch": "^4.0.2" + } + }, "node_modules/flat-cache": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", @@ -7311,6 +7337,21 @@ } ] }, + "node_modules/fs-extra": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", + "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", + "dev": true, + "dependencies": { + "at-least-node": "^1.0.0", + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/fs-minipass": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-3.0.3.tgz", @@ -8385,6 +8426,21 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-docker": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz", + "integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==", + "dev": true, + "bin": { + "is-docker": "cli.js" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/is-error": { "version": "2.2.2", "resolved": "https://registry.npmjs.org/is-error/-/is-error-2.2.2.tgz", @@ -8701,6 +8757,18 @@ "node": ">=0.10.0" } }, + "node_modules/is-wsl": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz", + "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==", + "dev": true, + "dependencies": { + "is-docker": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", @@ -8983,11 +9051,35 @@ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" }, + "node_modules/json-stable-stringify": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.1.1.tgz", + "integrity": "sha512-SU/971Kt5qVQfJpyDveVhQ/vya+5hvrjClFOcr8c0Fq5aODJjMwutrOfCU+eCnVD5gpx1Q3fEqkyom77zH1iIg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.5", + "isarray": "^2.0.5", + "jsonify": "^0.0.1", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/json-stable-stringify-without-jsonify": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=" }, + "node_modules/json-stable-stringify/node_modules/isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "dev": true + }, "node_modules/json-stringify-safe": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", @@ -9006,6 +9098,27 @@ "node": ">=6" } }, + "node_modules/jsonfile": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "dev": true, + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/jsonify": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.1.tgz", + "integrity": "sha512-2/Ki0GcmuqSrgFyelQq9M05y7PS0mEwuIzrf3f1fPqkVDVRvZrPZtVSMHxdgo8Aq0sxAOb/cr2aqqA3LeWHVPg==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/jsonparse": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-1.3.1.tgz", @@ -9051,6 +9164,15 @@ "node": ">=0.10.0" } }, + "node_modules/klaw-sync": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/klaw-sync/-/klaw-sync-6.0.0.tgz", + "integrity": "sha512-nIeuVSzdCCs6TDPTqI8w1Yre34sSq7AkZ4B3sfOBbI2CgVSB4Du4aLQijFU2+lhAFCwt9+42Hel6lQNIv6AntQ==", + "dev": true, + "dependencies": { + "graceful-fs": "^4.1.11" + } + }, "node_modules/language-subtag-registry": { "version": "0.3.21", "resolved": "https://registry.npmjs.org/language-subtag-registry/-/language-subtag-registry-0.3.21.tgz", @@ -10598,6 +10720,22 @@ "node": ">=6" } }, + "node_modules/open": { + "version": "7.4.2", + "resolved": "https://registry.npmjs.org/open/-/open-7.4.2.tgz", + "integrity": "sha512-MVHddDVweXZF3awtlAS+6pgKLlm/JgxZ90+/NBurBoQctVOOB/zDdVjcyPzQ+0laDGbsWgrRkflI65sQeOgT9Q==", + "dev": true, + "dependencies": { + "is-docker": "^2.0.0", + "is-wsl": "^2.1.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/opener": { "version": "1.5.2", "resolved": "https://registry.npmjs.org/opener/-/opener-1.5.2.tgz", @@ -10632,6 +10770,15 @@ "node": ">=0.10.0" } }, + "node_modules/os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/p-defer": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/p-defer/-/p-defer-1.0.0.tgz", @@ -10844,6 +10991,69 @@ "node": "^12.20.0 || ^14.13.1 || >=16.0.0" } }, + "node_modules/patch-package": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/patch-package/-/patch-package-8.0.0.tgz", + "integrity": "sha512-da8BVIhzjtgScwDJ2TtKsfT5JFWz1hYoBl9rUQ1f38MC2HwnEIkK8VN3dKMKcP7P7bvvgzNDbfNHtx3MsQb5vA==", + "dev": true, + "dependencies": { + "@yarnpkg/lockfile": "^1.1.0", + "chalk": "^4.1.2", + "ci-info": "^3.7.0", + "cross-spawn": "^7.0.3", + "find-yarn-workspace-root": "^2.0.0", + "fs-extra": "^9.0.0", + "json-stable-stringify": "^1.0.2", + "klaw-sync": "^6.0.0", + "minimist": "^1.2.6", + "open": "^7.4.2", + "rimraf": "^2.6.3", + "semver": "^7.5.3", + "slash": "^2.0.0", + "tmp": "^0.0.33", + "yaml": "^2.2.2" + }, + "bin": { + "patch-package": "index.js" + }, + "engines": { + "node": ">=14", + "npm": ">5" + } + }, + "node_modules/patch-package/node_modules/rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "dev": true, + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + } + }, + "node_modules/patch-package/node_modules/slash": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-2.0.0.tgz", + "integrity": "sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/patch-package/node_modules/yaml": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.4.1.tgz", + "integrity": "sha512-pIXzoImaqmfOrL7teGUBt/T7ZDnyeGBWyXQBvOVhLkWLN37GXv8NMLK406UY6dS51JfcQHsmcW5cJ441bHg6Lg==", + "dev": true, + "bin": { + "yaml": "bin.mjs" + }, + "engines": { + "node": ">= 14" + } + }, "node_modules/path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", @@ -13426,6 +13636,18 @@ "integrity": "sha512-XPaBkWQJdsf3pLKJV9p4qN/S+fm2Oj8AIPo1BTUhg5oxkvm9+SVEGFdhyOz7tTdUTfvxMiAs4sp6/eZO2Ew+pw==", "dev": true }, + "node_modules/tmp": { + "version": "0.0.33", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", + "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", + "dev": true, + "dependencies": { + "os-tmpdir": "~1.0.2" + }, + "engines": { + "node": ">=0.6.0" + } + }, "node_modules/to-fast-properties": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", @@ -14105,6 +14327,15 @@ "integrity": "sha512-yCzhz6FN2wU1NiiQRogkTQszlQSlpWaw8SvVegAc+bDxbzHgh1vX8uIe8OYyMH6DwH+sdTJsgMl36+mSMdRJIQ==", "dev": true }, + "node_modules/universalify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", + "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", + "dev": true, + "engines": { + "node": ">= 10.0.0" + } + }, "node_modules/update-browserslist-db": { "version": "1.0.13", "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.13.tgz", @@ -17766,6 +17997,12 @@ "integrity": "sha512-lcHyyLfS2ro282qsXKpxw+canUkOlFIGoanxt3BaNCm5K1NR8k4hGvYbFO54/+QWq12d0y/EYRz68yNQkqWFrw==", "dev": true }, + "@yarnpkg/lockfile": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@yarnpkg/lockfile/-/lockfile-1.1.0.tgz", + "integrity": "sha512-GpSwvyXOcOOlV70vbnzjj4fW5xW/FdUF6nQEt1ENy7m4ZCczi1+/buVUPAqmGfqznsORNFzUMjctTIp8a9tuCQ==", + "dev": true + }, "abbrev": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-2.0.0.tgz", @@ -18052,6 +18289,12 @@ "has-symbols": "^1.0.3" } }, + "at-least-node": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", + "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==", + "dev": true + }, "author-regex": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/author-regex/-/author-regex-1.0.0.tgz", @@ -19987,6 +20230,15 @@ "path-exists": "^4.0.0" } }, + "find-yarn-workspace-root": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/find-yarn-workspace-root/-/find-yarn-workspace-root-2.0.0.tgz", + "integrity": "sha512-1IMnbjt4KzsQfnhnzNd8wUEgXZ44IzZaZmnLYx7D5FZlaHt2gW20Cri8Q+E/t5tIj4+epTBub+2Zxu/vNILzqQ==", + "dev": true, + "requires": { + "micromatch": "^4.0.2" + } + }, "flat-cache": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", @@ -20031,6 +20283,18 @@ "integrity": "sha512-cHEpEQHUg0f8XdtZCc2ZAhrHzKzT0MrFUTcvx+hfxYu7rGMDc5SKoXFh+n4YigxsHXRzc6OrCshdR1bWH6HHyg==", "dev": true }, + "fs-extra": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", + "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", + "dev": true, + "requires": { + "at-least-node": "^1.0.0", + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + } + }, "fs-minipass": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-3.0.3.tgz", @@ -20818,6 +21082,12 @@ "has-tostringtag": "^1.0.0" } }, + "is-docker": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz", + "integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==", + "dev": true + }, "is-error": { "version": "2.2.2", "resolved": "https://registry.npmjs.org/is-error/-/is-error-2.2.2.tgz", @@ -21029,6 +21299,15 @@ "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==", "dev": true }, + "is-wsl": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz", + "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==", + "dev": true, + "requires": { + "is-docker": "^2.0.0" + } + }, "isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", @@ -21248,6 +21527,26 @@ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" }, + "json-stable-stringify": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.1.1.tgz", + "integrity": "sha512-SU/971Kt5qVQfJpyDveVhQ/vya+5hvrjClFOcr8c0Fq5aODJjMwutrOfCU+eCnVD5gpx1Q3fEqkyom77zH1iIg==", + "dev": true, + "requires": { + "call-bind": "^1.0.5", + "isarray": "^2.0.5", + "jsonify": "^0.0.1", + "object-keys": "^1.1.1" + }, + "dependencies": { + "isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "dev": true + } + } + }, "json-stable-stringify-without-jsonify": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", @@ -21265,6 +21564,22 @@ "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", "dev": true }, + "jsonfile": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.6", + "universalify": "^2.0.0" + } + }, + "jsonify": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.1.tgz", + "integrity": "sha512-2/Ki0GcmuqSrgFyelQq9M05y7PS0mEwuIzrf3f1fPqkVDVRvZrPZtVSMHxdgo8Aq0sxAOb/cr2aqqA3LeWHVPg==", + "dev": true + }, "jsonparse": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-1.3.1.tgz", @@ -21295,6 +21610,15 @@ "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==" }, + "klaw-sync": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/klaw-sync/-/klaw-sync-6.0.0.tgz", + "integrity": "sha512-nIeuVSzdCCs6TDPTqI8w1Yre34sSq7AkZ4B3sfOBbI2CgVSB4Du4aLQijFU2+lhAFCwt9+42Hel6lQNIv6AntQ==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.11" + } + }, "language-subtag-registry": { "version": "0.3.21", "resolved": "https://registry.npmjs.org/language-subtag-registry/-/language-subtag-registry-0.3.21.tgz", @@ -22473,6 +22797,16 @@ } } }, + "open": { + "version": "7.4.2", + "resolved": "https://registry.npmjs.org/open/-/open-7.4.2.tgz", + "integrity": "sha512-MVHddDVweXZF3awtlAS+6pgKLlm/JgxZ90+/NBurBoQctVOOB/zDdVjcyPzQ+0laDGbsWgrRkflI65sQeOgT9Q==", + "dev": true, + "requires": { + "is-docker": "^2.0.0", + "is-wsl": "^2.1.1" + } + }, "opener": { "version": "1.5.2", "resolved": "https://registry.npmjs.org/opener/-/opener-1.5.2.tgz", @@ -22498,6 +22832,12 @@ "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", "dev": true }, + "os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==", + "dev": true + }, "p-defer": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/p-defer/-/p-defer-1.0.0.tgz", @@ -22643,6 +22983,52 @@ "integrity": "sha512-0YNdUceMdaQwoKce1gatDScmMo5pu/tfABfnzEqeG0gtTmd7mh/WcwgUjtAeOU7N8nFFlbQBnFK2gXW5fGvmMA==", "dev": true }, + "patch-package": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/patch-package/-/patch-package-8.0.0.tgz", + "integrity": "sha512-da8BVIhzjtgScwDJ2TtKsfT5JFWz1hYoBl9rUQ1f38MC2HwnEIkK8VN3dKMKcP7P7bvvgzNDbfNHtx3MsQb5vA==", + "dev": true, + "requires": { + "@yarnpkg/lockfile": "^1.1.0", + "chalk": "^4.1.2", + "ci-info": "^3.7.0", + "cross-spawn": "^7.0.3", + "find-yarn-workspace-root": "^2.0.0", + "fs-extra": "^9.0.0", + "json-stable-stringify": "^1.0.2", + "klaw-sync": "^6.0.0", + "minimist": "^1.2.6", + "open": "^7.4.2", + "rimraf": "^2.6.3", + "semver": "^7.5.3", + "slash": "^2.0.0", + "tmp": "^0.0.33", + "yaml": "^2.2.2" + }, + "dependencies": { + "rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + }, + "slash": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-2.0.0.tgz", + "integrity": "sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==", + "dev": true + }, + "yaml": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.4.1.tgz", + "integrity": "sha512-pIXzoImaqmfOrL7teGUBt/T7ZDnyeGBWyXQBvOVhLkWLN37GXv8NMLK406UY6dS51JfcQHsmcW5cJ441bHg6Lg==", + "dev": true + } + } + }, "path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", @@ -24487,6 +24873,15 @@ "integrity": "sha512-XPaBkWQJdsf3pLKJV9p4qN/S+fm2Oj8AIPo1BTUhg5oxkvm9+SVEGFdhyOz7tTdUTfvxMiAs4sp6/eZO2Ew+pw==", "dev": true }, + "tmp": { + "version": "0.0.33", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", + "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", + "dev": true, + "requires": { + "os-tmpdir": "~1.0.2" + } + }, "to-fast-properties": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", @@ -24934,6 +25329,12 @@ "integrity": "sha512-yCzhz6FN2wU1NiiQRogkTQszlQSlpWaw8SvVegAc+bDxbzHgh1vX8uIe8OYyMH6DwH+sdTJsgMl36+mSMdRJIQ==", "dev": true }, + "universalify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", + "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", + "dev": true + }, "update-browserslist-db": { "version": "1.0.13", "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.13.tgz", diff --git a/package.json b/package.json index f585a40..a66d334 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,8 @@ "lint": "turbo run lint", "test": "turbo run test", "format": "prettier --write \"**/*.{ts,tsx,md}\"", - "release": "auto shipit" + "release": "auto shipit", + "postinstall": "patch-package" }, "license": "MIT", "devDependencies": { @@ -27,7 +28,8 @@ "auto": "^11.0.7", "dotenv-cli": "^7.3.0", "prettier": "^3.2.5", - "turbo": "latest" + "turbo": "latest", + "patch-package": "^8.0.0" }, "engines": { "npm": ">=7.0.0", diff --git a/packages/ogre/src/commit.ts b/packages/ogre/src/commit.ts index 3b37a1b..28a824c 100644 --- a/packages/ogre/src/commit.ts +++ b/packages/ogre/src/commit.ts @@ -1,14 +1,14 @@ import { digest } from "./hash.js"; -import { Operation } from "fast-json-patch/index.mjs"; +import { Operation } from "fast-json-patch"; export interface Commit { /*The hash of the commit. Is a sha256 of: - - tree object reference (changes?) - - parent object reference (parent hash) - - author - - author commit timestamp with timezone - - commit message - */ + - tree object reference (changes?) + - parent object reference (parent hash) + - author + - author commit timestamp with timezone + - commit message + */ hash: string; tree: string; diff --git a/packages/ogre/src/index.ts b/packages/ogre/src/index.ts index c860654..1c218ce 100644 --- a/packages/ogre/src/index.ts +++ b/packages/ogre/src/index.ts @@ -6,9 +6,4 @@ export * from "./size.js"; export * from "./utils.js"; export * from "./git2json.js"; -export { - compare, - deepClone, - Operation, - JsonPatchError, -} from "fast-json-patch/index.mjs"; +export { compare, deepClone, Operation, JsonPatchError } from "fast-json-patch"; diff --git a/packages/ogre/src/repository.test.ts b/packages/ogre/src/repository.test.ts index d4acff7..b54093b 100644 --- a/packages/ogre/src/repository.test.ts +++ b/packages/ogre/src/repository.test.ts @@ -11,7 +11,7 @@ import { updateHeaderData, } from "./test.utils.js"; import { Reference } from "./interfaces.js"; -import { compare } from "fast-json-patch/index.mjs"; +import { compare } from "fast-json-patch"; test("diff is ok", async (t) => { const [repo, obj] = await getBaseline(); diff --git a/packages/ogre/src/repository.ts b/packages/ogre/src/repository.ts index 2a2fc8b..ce361ed 100644 --- a/packages/ogre/src/repository.ts +++ b/packages/ogre/src/repository.ts @@ -10,7 +10,7 @@ import { Operation, unobserve, validate, -} from "fast-json-patch/index.mjs"; +} from "fast-json-patch"; import { calculateCommitHash, Commit } from "./commit.js"; import { History, Reference } from "./interfaces.js"; import { compressSync, strToU8 } from "fflate"; diff --git a/packages/ogre/src/utils.ts b/packages/ogre/src/utils.ts index d5548d5..9aecd71 100644 --- a/packages/ogre/src/utils.ts +++ b/packages/ogre/src/utils.ts @@ -3,7 +3,7 @@ import { Commit } from "./commit.js"; import { Reference } from "./interfaces.js"; import { decompressSync, strFromU8 } from "fflate"; import { validBranch, validRef } from "./ref.js"; -import { deepClone, Operation } from "fast-json-patch/index.mjs"; +import { deepClone, Operation } from "fast-json-patch"; import { RepositoryObject } from "./repository.js"; const emailRegex = diff --git a/patches/fast-json-patch+3.1.1.patch b/patches/fast-json-patch+3.1.1.patch new file mode 100644 index 0000000..3b3c1f6 --- /dev/null +++ b/patches/fast-json-patch+3.1.1.patch @@ -0,0 +1,18 @@ +diff --git a/node_modules/fast-json-patch/package.json b/node_modules/fast-json-patch/package.json +index 688a6d0..8eb9957 100644 +--- a/node_modules/fast-json-patch/package.json ++++ b/node_modules/fast-json-patch/package.json +@@ -25,6 +25,13 @@ + "main": "index.js", + "module": "index.mjs", + "typings": "index.d.ts", ++ "exports": { ++ ".": { ++ "import": "./index.mjs", ++ "require": "./index.js", ++ "types": "./index.d.ts" ++ } ++ }, + "devDependencies": { + "benchmark": "^2.1.4", + "bluebird": "^3.5.5",