@gadicc/loom 1.35.0 → 1.35.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -63,6 +63,14 @@ export type DependencyMutation = {
63
63
  };
64
64
  /** Parses Deno JSON/JSONC while reporting every syntax error. */
65
65
  export declare function parseJsonc<T>(text: string, filename: string): T;
66
+ /** Compares JSON data, ignoring object key order and `undefined` members. */
67
+ export declare function jsonValuesEqual(left: unknown, right: unknown): boolean;
68
+ /**
69
+ * Rewrites JSON or JSONC text to hold `next` by editing only the members
70
+ * whose values changed, so the file keeps its own key order, indentation,
71
+ * line layout and comments. New members are appended to their object.
72
+ */
73
+ export declare function patchJsonText(text: string, next: unknown): string;
66
74
  /**
67
75
  * Detects project tooling once during adoption. A recorded Loom choice is
68
76
  * authoritative on later runs and is validated instead of inferred again.
@@ -1 +1 @@
1
- {"version":3,"file":"projectTooling.d.ts","sourceRoot":"","sources":["../../../src/src/cli/projectTooling.ts"],"names":[],"mappings":"AAiBA,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;AAC9D,MAAM,MAAM,UAAU,GAAG,cAAc,CAAC;AACxC,MAAM,MAAM,cAAc,GAAG,WAAW,GAAG,YAAY,GAAG,cAAc,CAAC;AACzE,MAAM,MAAM,oBAAoB,GAAG,cAAc,CAAC;AAElD,qEAAqE;AACrE,MAAM,MAAM,cAAc,GAAG;IAC3B,YAAY,EAAE;QACZ,MAAM,EAAE,oBAAoB,CAAC;QAC7B,OAAO,EAAE,cAAc,CAAC;KACzB,CAAC;IACF,KAAK,EAAE;QACL,MAAM,EAAE,cAAc,CAAC;QACvB,MAAM,EAAE,UAAU,CAAC;KACpB,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAC1B,MAAM,GACN,CAAC;IACD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IAC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UAAU,EAAE,cAAc,CAAC;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;CACrC,CAAC;AAEF,4DAA4D;AAC5D,wBAAsB,UAAU,CAC9B,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,cAAc,CAAC,OAAO,CAAC,EAChC,OAAO,EAAE,iBAAiB;;;;;GA+B3B;AAED;;;GAGG;AACH,wBAAsB,sBAAsB,CAC1C,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,cAAc,CAAC,OAAO,CAAC,EAChC,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM;;;GAiCrB;AAED,gFAAgF;AAChF,wBAAsB,kBAAkB,CACtC,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,cAAc,CAAC,OAAO,CAAC,EAChC,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM;;;GAqBjB;AAaD,0EAA0E;AAC1E,wBAAsB,iBAAiB,CACrC,GAAG,EAAE,MAAM,EACX,aAAa,EAAE,cAAc,CAAC,OAAO,CAAC,GACrC,OAAO,CAAC,YAAY,EAAE,CAAC,CAoCzB"}
@@ -34,6 +34,8 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.parseJsonc = parseJsonc;
37
+ exports.jsonValuesEqual = jsonValuesEqual;
38
+ exports.patchJsonText = patchJsonText;
37
39
  exports.detectProjectTooling = detectProjectTooling;
38
40
  exports.readTaskStore = readTaskStore;
39
41
  exports.denoConfigAsPackageJson = denoConfigAsPackageJson;
@@ -112,6 +114,53 @@ function updateJsonPath(text, path, value) {
112
114
  const { applyEdits, modify } = jsoncParser;
113
115
  return applyEdits(text, modify(text, path, value, { formattingOptions: formattingOptions(text) }));
114
116
  }
117
+ function isPlainJsonObject(value) {
118
+ return typeof value === "object" && value !== null && !Array.isArray(value);
119
+ }
120
+ function sortedJson(value) {
121
+ if (Array.isArray(value))
122
+ return value.map(sortedJson);
123
+ if (!isPlainJsonObject(value))
124
+ return value;
125
+ return Object.fromEntries(Object.keys(value).filter((key) => value[key] !== undefined).sort()
126
+ .map((key) => [key, sortedJson(value[key])]));
127
+ }
128
+ /** Compares JSON data, ignoring object key order and `undefined` members. */
129
+ function jsonValuesEqual(left, right) {
130
+ return JSON.stringify(sortedJson(left)) === JSON.stringify(sortedJson(right));
131
+ }
132
+ function collectJsonEdits(current, next, path, edits) {
133
+ if (jsonValuesEqual(current, next))
134
+ return;
135
+ if (isPlainJsonObject(current) && isPlainJsonObject(next)) {
136
+ for (const key of Object.keys(current)) {
137
+ if (next[key] === undefined)
138
+ edits.push([[...path, key], undefined]);
139
+ }
140
+ for (const [key, value] of Object.entries(next)) {
141
+ if (value === undefined)
142
+ continue;
143
+ if (hasOwn(current, key)) {
144
+ collectJsonEdits(current[key], value, [...path, key], edits);
145
+ }
146
+ else {
147
+ edits.push([[...path, key], value]);
148
+ }
149
+ }
150
+ return;
151
+ }
152
+ edits.push([path, next]);
153
+ }
154
+ /**
155
+ * Rewrites JSON or JSONC text to hold `next` by editing only the members
156
+ * whose values changed, so the file keeps its own key order, indentation,
157
+ * line layout and comments. New members are appended to their object.
158
+ */
159
+ function patchJsonText(text, next) {
160
+ const edits = [];
161
+ collectJsonEdits(parseJsonc(text, "JSON"), next, [], edits);
162
+ return edits.reduce((result, [path, value]) => updateJsonPath(result, path, value), text);
163
+ }
115
164
  function hasOwn(value, key) {
116
165
  return Object.prototype.hasOwnProperty.call(value, key);
117
166
  }
@@ -56,6 +56,18 @@ from the consumer's working directory.
56
56
  whole-file rewrites or string-only runner guesses.
57
57
  - If a loom-managed file exists only as a thin wrapper, keep it thin unless the
58
58
  app intentionally needs custom behavior there.
59
+ - Loom never overwrites a file with local edits. `loom init`, `loom add`, and
60
+ feature syncs update a Loom-managed file only while it is provably unmodified
61
+ Loom output (layout and quote style aside), using the hashes under each
62
+ feature's `managedFiles` in `loom.json`, and otherwise keep the file and print
63
+ a `Preserved local edits ...` note naming the difference. Resolve the note:
64
+ either record the file as app-owned where the feature supports it (such as
65
+ `features.pwa.config.provider.managed: false`), or move app code elsewhere,
66
+ delete the file, and rerun the command to restore Loom's version. Tasks Loom
67
+ owns by name (`db:*`, `drizzle-kit`, `schema:gen`, `job`, `pwa:build`, the
68
+ Lingui tasks) follow the same rule: an edited task, such as an env wrapper on
69
+ `db:migrate`, is kept and reported; delete it and rerun `loom add <feature>`
70
+ to restore Loom's value. Do not edit `managedFiles` or `managedTasks` by hand.
59
71
 
60
72
  ## Environment loading
61
73
 
@@ -254,7 +266,21 @@ as more authoritative than a generic mapped error when deciding what failed.
254
266
  reverted before the build finished still counts; with whole-second timestamps
255
267
  (FAT, HFS+), so does a file written a moment before the build started.
256
268
  `loom dev sync` also records its sync in gitignored `.loom/dev-state.json` for
257
- `loom status` and `loom check`; that record never gates a release.
269
+ `loom status` and `loom check`; that record never gates a release. It stays
270
+ while local Loom may still be in use: any local Loom override, link or catalog
271
+ entry (any dangling Deno link counts as possibly Loom's), a local
272
+ `pnpm-lock.yaml` resolution or a Loom link in `deno.lock`, or an installed
273
+ copy that is not provably the published package. pnpm proves that through its
274
+ registry store entry; Deno through a `deno.lock` that records no Loom link and
275
+ resolves the pinned `npm:@gadicc/loom` version from the registry.
276
+ `loom dev published` deletes the record once none is left, which for pnpm
277
+ usually means rerunning it after the `pnpm install` it asks for. Otherwise
278
+ `loom check` treats the record as stale: it notes that it can be deleted and,
279
+ if the recorded checkout still exists, advises a newer pin when a newer
280
+ release covers the synced commit. What the record says fails a production
281
+ check only while a link, override or local lockfile points at local Loom; an
282
+ unproven installed copy alone, or a checkout that no longer exists, only
283
+ warns.
258
284
  - `loom dev published` proves what is actually installed, from that build
259
285
  provenance, before it switches back:
260
286
  - It collects every local Loom target: the managed pnpm override, any
@@ -275,7 +301,9 @@ as more authoritative than a generic mapped error when deciding what failed.
275
301
  - The build's commit must be reachable from `origin/main` and either included
276
302
  in a semver release tag or package-equivalent to the latest semver release
277
303
  because only non-package files changed after that tag. The app then switches
278
- to the exact published Loom version that covers it.
304
+ to the exact published Loom version that covers it, unless it already pins a
305
+ newer exact version: Loom never moves a pin back, because a checkout without
306
+ the newest tags names an older covering release.
279
307
  - The checkout's current commit and working tree do not matter: later work in
280
308
  it neither blocks nor passes a build that is already installed.
281
309
  - A pnpm link that was never installed needs no proof: when pnpm-lock.yaml and
@@ -25,7 +25,10 @@ Use this skill when working on the shared DB stack from a consuming app.
25
25
  and explicit.
26
26
  - Loom owns the standard wiring around thin wrappers for `neon.ts`,
27
27
  `neonFull.ts`, `drizzle.config.ts`, `schema:gen`, `db:fixtures`, and the
28
- shared PGlite test harness.
28
+ shared PGlite test harness. Loom updates those wrappers and the Valibot barrel
29
+ only while they are unmodified Loom output; an edited one is kept, noted by
30
+ `loom init`/`loom add db`, and reported by `loom check`. Move the app code to
31
+ a separate module and delete the wrapper to restore it.
29
32
  - Valibot generated files stay app-local, but should be regenerated through
30
33
  `loom db schema-gen` instead of ad hoc commands.
31
34
  - DB-backed tasks, Drizzle commands, direct SQL inspection, and migrations
@@ -36,7 +36,10 @@ it does not generate migrations.
36
36
 
37
37
  The intended consumer flow is:
38
38
 
39
- 1. `loom add db`
39
+ 1. `loom add db`; if it reports `Preserved local edits` for an existing app
40
+ `neon.ts`, `drizzle.config.ts` or other wrapper path, move that app code
41
+ elsewhere, delete the file and rerun it, because Loom never overwrites a file
42
+ it cannot prove it wrote
40
43
  2. keep schema files app-local under the configured schema directory
41
44
  3. keep only app-local fixture table selection in `scripts/dump-test-tables.ts`
42
45
  4. run `loom db schema-gen`