@magmonium/cli 0.7.10 → 0.7.13

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.
Files changed (46) hide show
  1. package/bin/commands/assets-wc.js +6 -0
  2. package/bin/commands/assets.js +121 -25
  3. package/bin/commands/configure-wc.js +2 -2
  4. package/package.json +1 -1
  5. package/schemas/nav.schema.json +30 -8
  6. package/src/compilers/docs-compiler.d.ts +20 -0
  7. package/src/compilers/docs-compiler.d.ts.map +1 -0
  8. package/src/compilers/docs-compiler.js +55 -0
  9. package/src/compilers/docs-compiler.js.map +1 -0
  10. package/src/compilers/field-compiler.d.ts +20 -0
  11. package/src/compilers/field-compiler.d.ts.map +1 -1
  12. package/src/compilers/field-compiler.js +93 -5
  13. package/src/compilers/field-compiler.js.map +1 -1
  14. package/src/compilers/patterns-compiler.d.ts +46 -0
  15. package/src/compilers/patterns-compiler.d.ts.map +1 -0
  16. package/src/compilers/patterns-compiler.js +149 -0
  17. package/src/compilers/patterns-compiler.js.map +1 -0
  18. package/src/compilers/web-component/lib/builder.d.ts.map +1 -1
  19. package/src/compilers/web-component/lib/builder.js +3 -2
  20. package/src/compilers/web-component/lib/builder.js.map +1 -1
  21. package/src/compilers/web-component/lib/ng-build.d.ts.map +1 -1
  22. package/src/compilers/web-component/lib/ng-build.js +86 -25
  23. package/src/compilers/web-component/lib/ng-build.js.map +1 -1
  24. package/src/compilers/web-component/lib/resource-inliner.d.ts.map +1 -1
  25. package/src/compilers/web-component/lib/resource-inliner.js +28 -9
  26. package/src/compilers/web-component/lib/resource-inliner.js.map +1 -1
  27. package/src/compilers/web-component/lib/web-component-wrapper.d.ts.map +1 -1
  28. package/src/compilers/web-component/lib/web-component-wrapper.js +23 -9
  29. package/src/compilers/web-component/lib/web-component-wrapper.js.map +1 -1
  30. package/src/compilers/web-component/model/type.d.ts +1 -0
  31. package/src/compilers/web-component/model/type.d.ts.map +1 -1
  32. package/src/core/config.d.ts +60 -0
  33. package/src/core/config.d.ts.map +1 -1
  34. package/src/core/config.js +44 -0
  35. package/src/core/config.js.map +1 -1
  36. package/src/index.d.ts +2 -0
  37. package/src/index.d.ts.map +1 -1
  38. package/src/index.js +2 -0
  39. package/src/index.js.map +1 -1
  40. package/src/utils/i18n-fixer.d.ts.map +1 -1
  41. package/src/utils/i18n-fixer.js +2 -3
  42. package/src/utils/i18n-fixer.js.map +1 -1
  43. package/src/utils/web-translation-providers.d.ts +1 -9
  44. package/src/utils/web-translation-providers.d.ts.map +1 -1
  45. package/src/utils/web-translation-providers.js +26 -79
  46. package/src/utils/web-translation-providers.js.map +1 -1
@@ -31,6 +31,12 @@ function assetsWcCommand(program) {
31
31
  false
32
32
  )
33
33
  .action(async (options) => {
34
+ // Same re-entrancy hazard as `assets`: web-component builds spawned from
35
+ // here run `nx build <lib>`, whose `dependsOn` pulls in `assets`. Mark the
36
+ // pipeline so that nested run no-ops instead of deleting this run's
37
+ // staging dirs and temp tsconfigs.
38
+ process.env.MAG_ASSETS_PIPELINE = '1';
39
+
34
40
  const configPath = path.resolve(options.config);
35
41
 
36
42
  // ── 1. Load config ──────────────────────────────────────────────────
@@ -6,6 +6,7 @@ const {
6
6
  ButtonGroupCompiler,
7
7
  FieldCompiler,
8
8
  OptionsCompiler,
9
+ PatternsCompiler,
9
10
  CopyCompiler,
10
11
  WorkerCompiler,
11
12
  TabsCompiler,
@@ -13,6 +14,7 @@ const {
13
14
  generateIsolatedPaths,
14
15
  DEFAULT_PATHS_CONFIG,
15
16
  WebComponentBuilder,
17
+ collectDocs,
16
18
  } = require('../../src/index.js');
17
19
 
18
20
  const fs = require('fs').promises;
@@ -44,7 +46,7 @@ function createYamlCompiler(
44
46
  // resolve by SHARED_ICONS and messages by the translation merge, both without a
45
47
  // folder listing, and both are an order of magnitude larger than all the config
46
48
  // folders put together.
47
- const MANIFEST_EXCLUDED_FOLDERS = ['icons', 'i18n'];
49
+ const MANIFEST_EXCLUDED_FOLDERS = ['icons', 'i18n', 'docs'];
48
50
 
49
51
  /**
50
52
  * Writes `index.json` — every compiled config in the tree, by folder and name.
@@ -81,6 +83,12 @@ async function writeAssetManifest(outputDir) {
81
83
  if (Object.keys(folder).length) manifest[entry.name] = folder;
82
84
  }
83
85
 
86
+ // Documents are markdown, not compiled JSON, so the folder walk above finds
87
+ // nothing in `docs/` — they are listed by name and language instead, which is
88
+ // the whole of what the editor's picker needs to offer one.
89
+ const docs = await collectDocs(root);
90
+ if (Object.keys(docs).length) manifest.docs = docs;
91
+
84
92
  const manifestPath = path.join(root, 'index.json');
85
93
  await fs.writeFile(manifestPath, JSON.stringify(manifest));
86
94
  console.log(
@@ -146,32 +154,33 @@ async function cleanDestinationFolders(paths, options) {
146
154
 
147
155
  console.log('🧹 Cleaning destination folders...');
148
156
 
149
- // 1. Clean Web Component temporary directories and files
150
- const tempDirs = ['.tmp-staging-wc', '.tmp-compiled-wc'];
151
- for (const dir of tempDirs) {
152
- try {
153
- const fullPath = path.resolve(process.cwd(), dir);
154
- const stat = await fs.stat(fullPath).catch(() => null);
155
- if (stat && stat.isDirectory()) {
156
- if (options.verbose)
157
- console.log(` 🗑️ Cleaning temporary directory: ${dir}`);
158
- await fs.rm(fullPath, { recursive: true, force: true });
159
- }
160
- } catch {
161
- // best-effort cleanup
162
- }
163
- }
157
+ // 1. Sweep leftover Web Component temp dirs and configs
158
+ //
159
+ // A web-component build names its temp roots after its pid
160
+ // (`.tmp-staging-wc-<pid>`, `.tmp-compiled-wc-<pid>`, `.tmp-wc-wrapper-<pid>`,
161
+ // `tsconfig.wc.<pid>.*`) and removes them itself. What is swept here is what
162
+ // a killed run left behind. Only entries older than a few minutes are
163
+ // touched: a concurrent assets run (an `assets:watch` in a second terminal)
164
+ // holds its staging tree live for the length of an ngc compile, and deleting
165
+ // that mid-compile fails it with ENOENT on a staged .sass or TS6053 on a
166
+ // staged .ts.
167
+ const STALE_AFTER_MS = 5 * 60 * 1000;
168
+ const isStale = (stat) => Date.now() - stat.mtimeMs > STALE_AFTER_MS;
169
+ const isTempEntry = (name) =>
170
+ name.startsWith('.tmp-staging-wc') ||
171
+ name.startsWith('.tmp-compiled-wc') ||
172
+ name.startsWith('.tmp-wc-wrapper-') ||
173
+ (name.startsWith('tsconfig.wc.') && name.endsWith('.json'));
164
174
 
165
- // Clean temporary tsconfig files
166
175
  try {
167
- const files = await fs.readdir(process.cwd());
168
- const tempTsConfigs = files.filter(
169
- (f) => f.startsWith('tsconfig.wc.') && f.endsWith('.json')
170
- );
171
- for (const f of tempTsConfigs) {
176
+ const entries = await fs.readdir(process.cwd());
177
+ for (const entry of entries.filter(isTempEntry)) {
178
+ const fullPath = path.join(process.cwd(), entry);
179
+ const stat = await fs.stat(fullPath).catch(() => null);
180
+ if (!stat || !isStale(stat)) continue;
172
181
  if (options.verbose)
173
- console.log(` 🗑️ Cleaning temporary config: ${f}`);
174
- await fs.unlink(path.join(process.cwd(), f));
182
+ console.log(` 🗑️ Cleaning stale temporary: ${entry}`);
183
+ await fs.rm(fullPath, { recursive: true, force: true });
175
184
  }
176
185
  } catch {
177
186
  // best-effort cleanup
@@ -248,6 +257,11 @@ function assetsCommand(program) {
248
257
  '-p, --path <path>',
249
258
  'Base path for mag_assets and assets directories (default: src/shared)'
250
259
  )
260
+ .option(
261
+ '--only <sources...>',
262
+ 'Only compile these config.path sources (e.g. libs/one/mag_assets). ' +
263
+ 'Used by one:assets so library builds do not rebuild every remote WC.'
264
+ )
251
265
  .option('-w, --watch', 'Watch for changes')
252
266
  .option('-v, --verbose', 'Verbose output')
253
267
  .option('--copy-only', 'Only copy files, skip compilation')
@@ -260,6 +274,20 @@ function assetsCommand(program) {
260
274
  'Skip cleaning destination folders before compilation'
261
275
  )
262
276
  .action(async (options) => {
277
+ // A web-component build inside this pipeline runs `nx build one`, and
278
+ // `one:build` dependsOn `one:assets` — so nx re-enters this very command
279
+ // while the outer run is mid-compile. The nested run then cleans
280
+ // `.tmp-staging-wc`, `.tmp-compiled-wc` and `tsconfig.wc.*.json` out from
281
+ // under the outer ngc (ENOENT / TS6053). The outer run already does all
282
+ // of this work, so a nested run is pure duplication: refuse it.
283
+ if (process.env.MAG_ASSETS_PIPELINE === '1') {
284
+ console.log(
285
+ '⏭️ Nested assets run — outer pipeline owns this work, skipping.'
286
+ );
287
+ return;
288
+ }
289
+ process.env.MAG_ASSETS_PIPELINE = '1';
290
+
263
291
  let config = {};
264
292
 
265
293
  // Try to load config file
@@ -290,7 +318,22 @@ function assetsCommand(program) {
290
318
  };
291
319
 
292
320
  // Get source-isolated paths for compilation
293
- const pathsConfig = resolvePathsConfig();
321
+ let pathsConfig = resolvePathsConfig();
322
+ if (options.only?.length) {
323
+ const allow = new Set(options.only);
324
+ const all = Array.isArray(pathsConfig) ? pathsConfig : [pathsConfig];
325
+ const filtered = all.filter((p) => allow.has(p.source));
326
+ if (filtered.length === 0) {
327
+ throw new Error(
328
+ `--only matched no config paths. Wanted: ${[...allow].join(', ')}. ` +
329
+ `Have: ${all.map((p) => p.source).join(', ')}`
330
+ );
331
+ }
332
+ console.log(
333
+ `🎯 --only ${[...allow].join(', ')} → ${filtered.length} path(s)`
334
+ );
335
+ pathsConfig = filtered.length === 1 ? filtered[0] : filtered;
336
+ }
294
337
  const sourcePathPairs = generateIsolatedPaths(pathsConfig);
295
338
 
296
339
  // Log multiple project info if array config is used
@@ -411,6 +454,11 @@ function assetsCommand(program) {
411
454
  outputPaths: PATHS.options.output,
412
455
  ...config.options,
413
456
  },
457
+ patterns: {
458
+ inputPaths: PATHS.patterns.input,
459
+ outputPaths: PATHS.patterns.output,
460
+ ...config.patterns,
461
+ },
414
462
  nav: {
415
463
  inputPaths: PATHS.navs.input,
416
464
  outputPaths: [
@@ -545,6 +593,16 @@ function assetsCommand(program) {
545
593
  outputPaths: PATHS.accordion_groups.output,
546
594
  ...config.accordion_groups,
547
595
  },
596
+ lists: {
597
+ inputPaths: PATHS.lists.input,
598
+ outputPaths: PATHS.lists.output,
599
+ ...config.lists,
600
+ },
601
+ section_tables: {
602
+ inputPaths: PATHS.section_tables.input,
603
+ outputPaths: PATHS.section_tables.output,
604
+ ...config.section_tables,
605
+ },
548
606
  graphs: {
549
607
  inputPaths: PATHS.graphs.input,
550
608
  outputPaths: PATHS.graphs.output,
@@ -575,6 +633,13 @@ function assetsCommand(program) {
575
633
  compilers.push(new OptionsCompiler(buildConfig.options));
576
634
  }
577
635
 
636
+ // Before fields, always: FieldCompiler reads compiled patterns out of
637
+ // the output directory and inlines them, so a pattern compiled after
638
+ // a field is a pattern that field never saw (libs/one ADR 0017).
639
+ if (buildConfig.patterns) {
640
+ compilers.push(new PatternsCompiler(buildConfig.patterns));
641
+ }
642
+
578
643
  if (buildConfig.fields) {
579
644
  compilers.push(new FieldCompiler(buildConfig.fields));
580
645
  }
@@ -767,6 +832,16 @@ function assetsCommand(program) {
767
832
  );
768
833
  }
769
834
 
835
+ if (buildConfig.lists) {
836
+ compilers.push(createYamlCompiler('List', buildConfig.lists));
837
+ }
838
+
839
+ if (buildConfig.section_tables) {
840
+ compilers.push(
841
+ createYamlCompiler('SectionTable', buildConfig.section_tables)
842
+ );
843
+ }
844
+
770
845
  if (buildConfig.graphs) {
771
846
  compilers.push(
772
847
  createYamlCompiler(
@@ -792,6 +867,27 @@ function assetsCommand(program) {
792
867
  // Always add copy compiler for remaining files
793
868
  compilers.push(new CopyCompiler(buildConfig.copy));
794
869
 
870
+ // Under --watch, a pattern edit has to reach the fields that inlined
871
+ // it. FieldCompiler watches `fields/` alone, so it would otherwise keep
872
+ // serving the expression it read at startup — the same hole options
873
+ // have had, closed here for both by re-running the field pass on the
874
+ // event PatternsCompiler emits.
875
+ const fieldCompiler = compilers.find(
876
+ (compiler) => compiler instanceof FieldCompiler
877
+ );
878
+ const patternsCompiler = compilers.find(
879
+ (compiler) => compiler instanceof PatternsCompiler
880
+ );
881
+ if (options.watch && fieldCompiler && patternsCompiler) {
882
+ patternsCompiler.on('patternsChanged', async () => {
883
+ try {
884
+ await fieldCompiler.compile();
885
+ } catch (error) {
886
+ console.error(`Field recompile after pattern change: ${error}`);
887
+ }
888
+ });
889
+ }
890
+
795
891
  // Run all compilers for this source-output pair
796
892
  for (const compiler of compilers) {
797
893
  if (options.watch) {
@@ -41,7 +41,7 @@ function configureWcCommand(program) {
41
41
  console.log(` npm run assets:compile`);
42
42
  console.log(` 4. Add GitHub Secrets:`);
43
43
  console.log(` MAG_APP_ID_${appNameUpper}`);
44
- console.log(` MAG_DEPLOY_TOKEN_${appNameUpper}`);
44
+ console.log(` MAG_DEPLOY_TOKEN (your per-user token, shared by every app)`);
45
45
  console.log(
46
46
  ` MAG_ENDPOINT (default: https://api.magmonium.com)`
47
47
  );
@@ -139,7 +139,7 @@ jobs:
139
139
  run: |
140
140
  mag-cli deploy \\
141
141
  --app-id \${{ secrets.MAG_APP_ID_${appNameUpper} }} \\
142
- --token \${{ secrets.MAG_DEPLOY_TOKEN_${appNameUpper} }} \\
142
+ --token \${{ secrets.MAG_DEPLOY_TOKEN }} \\
143
143
  --endpoint \${{ secrets.MAG_ENDPOINT || 'https://api.magmonium.com' }} \\
144
144
  --dist-path ${wcDistPath}
145
145
  `;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magmonium/cli",
3
- "version": "0.7.10",
3
+ "version": "0.7.13",
4
4
  "description": "A powerful and extensible asset compilation tool that can be shared across multiple projects",
5
5
  "bin": {
6
6
  "mag-cli": "bin/cli.js"
@@ -3,25 +3,47 @@
3
3
  "title": "Nav Asset",
4
4
  "description": "Schema for nav YAML files in mag_assets/navs/",
5
5
  "type": "object",
6
- "required": ["title"],
6
+ "required": ["navId", "kind", "presentation"],
7
7
  "additionalProperties": false,
8
8
  "properties": {
9
+ "navId": {
10
+ "type": "string",
11
+ "description": "Full-path NavId (e.g., root, root_settings, root_settings_user). Always rooted and _-joined."
12
+ },
9
13
  "title": {
10
14
  "type": "string",
11
- "description": "Display name for this nav entry"
15
+ "description": "Display name for this nav entry. Optional - if missing, the navId segment is used as title and this nav is treated as the default child with no nav label shown."
12
16
  },
13
17
  "icon": {
14
18
  "type": "string",
15
- "description": "Icon name (optional — root.yml typically omits this)"
19
+ "description": "Icon name (optional). No icon is shown for label-less/default navs."
20
+ },
21
+ "logo": {
22
+ "type": "string",
23
+ "description": "Logo source path. Typically only on root nav (e.g., assets/logo/icon.svg)."
24
+ },
25
+ "kind": {
26
+ "type": "string",
27
+ "enum": ["url", "murl"],
28
+ "description": "How this nav is reached: 'url' for a real Angular route, 'murl' for a nav panel."
16
29
  },
17
- "isMurl": {
18
- "type": "boolean",
19
- "description": "When true, navigate via murl instead of url"
30
+ "presentation": {
31
+ "type": "string",
32
+ "enum": ["static", "component", "dynamic"],
33
+ "description": "How the panel is filled: 'static' for menu rows, 'component' for a registered widget, 'dynamic' for runtime resolution."
34
+ },
35
+ "path": {
36
+ "type": "string",
37
+ "description": "Route path override for Url navs. Absent means the ancestry path. Empty string means this is the default route (path: '')."
38
+ },
39
+ "param": {
40
+ "type": "string",
41
+ "description": "Route parameter name for dynamic Navs, defaulting to 'id'."
20
42
  },
21
- "navs": {
43
+ "children": {
22
44
  "type": "array",
23
45
  "items": { "type": "string" },
24
- "description": "Child nav IDs — each must have a matching .yml file in the same navs/ folder"
46
+ "description": "Child nav IDs (full paths). Ordered. Each must have a matching .yml file in the same navs/ folder."
25
47
  }
26
48
  }
27
49
  }
@@ -0,0 +1,20 @@
1
+ /** The one folder a DocAsset lives in, under `mag_assets/` and under `assets/`. */
2
+ export declare const DOCS_FOLDER = "docs";
3
+ /** One document as the manifest lists it: the languages it was authored in. */
4
+ export interface DocManifestEntry {
5
+ languages: string[];
6
+ }
7
+ export type DocManifest = Record<string, DocManifestEntry>;
8
+ /**
9
+ * Lists the documents in a compiled asset tree — `<root>/docs/<lang>/<name>.md`.
10
+ *
11
+ * A document is copied rather than compiled (CopyCompiler already carries it
12
+ * through untouched), so nothing else in the tree records that it exists. The
13
+ * m-one-ui editor lists its OneAssets off `index.json` (m-one-ui ADR 0016) and
14
+ * would otherwise have no way to offer a shipped doc by name.
15
+ *
16
+ * The `<lang>/` folder is mandatory: one resolution shape, so a doc dropped
17
+ * straight into `docs/` is not a document in any language and is ignored.
18
+ */
19
+ export declare function collectDocs(root: string): Promise<DocManifest>;
20
+ //# sourceMappingURL=docs-compiler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"docs-compiler.d.ts","sourceRoot":"","sources":["../../../../../libs/cli/src/compilers/docs-compiler.ts"],"names":[],"mappings":"AAGA,mFAAmF;AACnF,eAAO,MAAM,WAAW,SAAS,CAAC;AAIlC,+EAA+E;AAC/E,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB;AAED,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;AAE3D;;;;;;;;;;GAUG;AACH,wBAAsB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAkCpE"}
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DOCS_FOLDER = void 0;
4
+ exports.collectDocs = collectDocs;
5
+ const tslib_1 = require("tslib");
6
+ const fs_1 = require("fs");
7
+ const path_1 = tslib_1.__importDefault(require("path"));
8
+ /** The one folder a DocAsset lives in, under `mag_assets/` and under `assets/`. */
9
+ exports.DOCS_FOLDER = 'docs';
10
+ const MARKDOWN_EXTENSION = '.md';
11
+ /**
12
+ * Lists the documents in a compiled asset tree — `<root>/docs/<lang>/<name>.md`.
13
+ *
14
+ * A document is copied rather than compiled (CopyCompiler already carries it
15
+ * through untouched), so nothing else in the tree records that it exists. The
16
+ * m-one-ui editor lists its OneAssets off `index.json` (m-one-ui ADR 0016) and
17
+ * would otherwise have no way to offer a shipped doc by name.
18
+ *
19
+ * The `<lang>/` folder is mandatory: one resolution shape, so a doc dropped
20
+ * straight into `docs/` is not a document in any language and is ignored.
21
+ */
22
+ async function collectDocs(root) {
23
+ const docsRoot = path_1.default.join(root, exports.DOCS_FOLDER);
24
+ let languages;
25
+ try {
26
+ const entries = await fs_1.promises.readdir(docsRoot, { withFileTypes: true });
27
+ languages = entries
28
+ .filter((entry) => entry.isDirectory())
29
+ .map((entry) => entry.name)
30
+ .sort();
31
+ }
32
+ catch {
33
+ // No docs folder is no documents, never a broken manifest.
34
+ return {};
35
+ }
36
+ const manifest = {};
37
+ for (const language of languages) {
38
+ let files;
39
+ try {
40
+ files = await fs_1.promises.readdir(path_1.default.join(docsRoot, language));
41
+ }
42
+ catch {
43
+ continue;
44
+ }
45
+ for (const file of files) {
46
+ if (!file.endsWith(MARKDOWN_EXTENSION))
47
+ continue;
48
+ const name = file.slice(0, -MARKDOWN_EXTENSION.length);
49
+ const entry = (manifest[name] ?? (manifest[name] = { languages: [] }));
50
+ entry.languages.push(language);
51
+ }
52
+ }
53
+ return manifest;
54
+ }
55
+ //# sourceMappingURL=docs-compiler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"docs-compiler.js","sourceRoot":"","sources":["../../../../../libs/cli/src/compilers/docs-compiler.ts"],"names":[],"mappings":";;;AA0BA,kCAkCC;;AA5DD,2BAAoC;AACpC,wDAAwB;AAExB,mFAAmF;AACtE,QAAA,WAAW,GAAG,MAAM,CAAC;AAElC,MAAM,kBAAkB,GAAG,KAAK,CAAC;AASjC;;;;;;;;;;GAUG;AACI,KAAK,UAAU,WAAW,CAAC,IAAY;IAC5C,MAAM,QAAQ,GAAG,cAAI,CAAC,IAAI,CAAC,IAAI,EAAE,mBAAW,CAAC,CAAC;IAE9C,IAAI,SAAmB,CAAC;IACxB,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,MAAM,aAAE,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;QACpE,SAAS,GAAG,OAAO;aAChB,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;aACtC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC;aAC1B,IAAI,EAAE,CAAC;IACZ,CAAC;IAAC,MAAM,CAAC;QACP,2DAA2D;QAC3D,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,QAAQ,GAAgB,EAAE,CAAC;IAEjC,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;QACjC,IAAI,KAAe,CAAC;QACpB,IAAI,CAAC;YACH,KAAK,GAAG,MAAM,aAAE,CAAC,OAAO,CAAC,cAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC;QAC1D,CAAC;QAAC,MAAM,CAAC;YACP,SAAS;QACX,CAAC;QAED,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,kBAAkB,CAAC;gBAAE,SAAS;YACjD,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC;YACvD,MAAM,KAAK,GAAG,CAAC,QAAQ,CAAC,IAAI,MAAb,QAAQ,CAAC,IAAI,IAAM,EAAE,SAAS,EAAE,EAAE,EAAE,EAAC,CAAC;YACrD,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACjC,CAAC;IACH,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -1,5 +1,15 @@
1
1
  import { BaseCompiler } from '../core/base-compiler';
2
2
  import { FieldCompilerConfig } from '../core/config';
3
+ /**
4
+ * Every directory a pattern name may be answered from, best answer first:
5
+ * the app's own compiled patterns, then the installed package, then a copy of
6
+ * the package's assets that a previous build already landed in the output.
7
+ *
8
+ * Authored ahead of shipped on purpose — the same precedence the editor's
9
+ * `resolveFieldPatternRules` uses, so a name resolves to the same rule in the
10
+ * Canvas and in the built app.
11
+ */
12
+ export declare function patternLookupDirs(baseDirs: string[], packageRoot?: string): string[];
3
13
  export declare class FieldCompiler extends BaseCompiler {
4
14
  private watcher;
5
15
  private readonly lookupDirs;
@@ -8,6 +18,16 @@ export declare class FieldCompiler extends BaseCompiler {
8
18
  watch(): Promise<void>;
9
19
  private findYAMLFiles;
10
20
  private loadOptions;
21
+ /**
22
+ * Reads compiled `patterns/*.json` out of every tier `patternLookupDirs`
23
+ * names. First tier to answer a name wins, so an app's own pattern shadows a
24
+ * shipped one of the same name and never the other way round.
25
+ *
26
+ * A shipped name has to resolve here or nowhere: a Field inlines its rules at
27
+ * compile time, so a name this pass drops leaves the built Field declaring no
28
+ * shape at all, and the form validates nothing with no runtime symptom.
29
+ */
30
+ private loadPatterns;
11
31
  private processYAMLFiles;
12
32
  private processField;
13
33
  private isYAMLFile;
@@ -1 +1 @@
1
- {"version":3,"file":"field-compiler.d.ts","sourceRoot":"","sources":["../../../../../libs/cli/src/compilers/field-compiler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAqBrD,qBAAa,aAAc,SAAQ,YAAY;IAC7C,OAAO,CAAC,OAAO,CAA4B;IAC3C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAW;gBAE1B,MAAM,EAAE,mBAAmB;IAOjC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAiCxB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;YA6Bd,aAAa;YAeb,WAAW;YAoCX,gBAAgB;IAgC9B,OAAO,CAAC,YAAY;IA6BpB,OAAO,CAAC,UAAU;CAInB"}
1
+ {"version":3,"file":"field-compiler.d.ts","sourceRoot":"","sources":["../../../../../libs/cli/src/compilers/field-compiler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AA2CrD;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,MAAM,EAAE,EAClB,WAAW,GAAE,MAAsB,GAClC,MAAM,EAAE,CAOV;AAED,qBAAa,aAAc,SAAQ,YAAY;IAC7C,OAAO,CAAC,OAAO,CAA4B;IAC3C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAW;gBAE1B,MAAM,EAAE,mBAAmB;IAOjC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAyCxB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;YA6Bd,aAAa;YAeb,WAAW;IAoCzB;;;;;;;;OAQG;YACW,YAAY;YAmCZ,gBAAgB;IAkC9B,OAAO,CAAC,YAAY;IA8DpB,OAAO,CAAC,UAAU;CAInB"}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FieldCompiler = void 0;
4
+ exports.patternLookupDirs = patternLookupDirs;
4
5
  const tslib_1 = require("tslib");
5
6
  const base_compiler_1 = require("../core/base-compiler");
6
7
  const file_utils_1 = require("../utils/file-utils");
@@ -8,6 +9,31 @@ const file_watcher_1 = require("../core/file-watcher");
8
9
  const path_1 = tslib_1.__importDefault(require("path"));
9
10
  const yaml_1 = tslib_1.__importDefault(require("yaml"));
10
11
  const fs_1 = require("fs");
12
+ /**
13
+ * Where a shipped PatternAsset sits once `@magmonium/one` is installed. The
14
+ * scaffold never authors a copy of one (ADR 0032), so this is the only tier
15
+ * that can answer a shipped name there — and unlike `<output>/one/patterns` it
16
+ * is never cleaned by the assets command, which wipes the output directory
17
+ * before compiling and only restores `one/` afterwards.
18
+ */
19
+ const ONE_PACKAGE_PATTERNS = path_1.default.join('node_modules', '@magmonium', 'one', 'assets', 'patterns');
20
+ /**
21
+ * Every directory a pattern name may be answered from, best answer first:
22
+ * the app's own compiled patterns, then the installed package, then a copy of
23
+ * the package's assets that a previous build already landed in the output.
24
+ *
25
+ * Authored ahead of shipped on purpose — the same precedence the editor's
26
+ * `resolveFieldPatternRules` uses, so a name resolves to the same rule in the
27
+ * Canvas and in the built app.
28
+ */
29
+ function patternLookupDirs(baseDirs, packageRoot = process.cwd()) {
30
+ const unique = [...new Set(baseDirs)];
31
+ return [
32
+ ...unique.map((baseDir) => path_1.default.join(baseDir, 'patterns')),
33
+ path_1.default.join(packageRoot, ONE_PACKAGE_PATTERNS),
34
+ ...unique.map((baseDir) => path_1.default.join(baseDir, 'one', 'patterns')),
35
+ ].filter((dir, index, dirs) => dirs.indexOf(dir) === index);
36
+ }
11
37
  class FieldCompiler extends base_compiler_1.BaseCompiler {
12
38
  constructor(config) {
13
39
  super(config);
@@ -26,7 +52,11 @@ class FieldCompiler extends base_compiler_1.BaseCompiler {
26
52
  }
27
53
  // Load options data
28
54
  const optionsData = await this.loadOptions();
29
- const fieldData = await this.processYAMLFiles(yamlFiles, optionsData);
55
+ // And the shapes a Field's value may take. Both are read from compiled
56
+ // JSON in the output directory, so both compilers must have run first —
57
+ // see the ordering in bin/commands/assets.js.
58
+ const patternsData = await this.loadPatterns();
59
+ const fieldData = await this.processYAMLFiles(yamlFiles, optionsData, patternsData);
30
60
  // Write individual field JSON files only
31
61
  for (const [fieldName, fieldConfig] of Object.entries(fieldData)) {
32
62
  await this.writeFile(`${fieldName}.json`, this.formatOutput(fieldConfig));
@@ -104,7 +134,43 @@ class FieldCompiler extends base_compiler_1.BaseCompiler {
104
134
  }
105
135
  return optionsData;
106
136
  }
107
- async processYAMLFiles(files, optionsData) {
137
+ /**
138
+ * Reads compiled `patterns/*.json` out of every tier `patternLookupDirs`
139
+ * names. First tier to answer a name wins, so an app's own pattern shadows a
140
+ * shipped one of the same name and never the other way round.
141
+ *
142
+ * A shipped name has to resolve here or nowhere: a Field inlines its rules at
143
+ * compile time, so a name this pass drops leaves the built Field declaring no
144
+ * shape at all, and the form validates nothing with no runtime symptom.
145
+ */
146
+ async loadPatterns() {
147
+ const patternsData = {};
148
+ for (const patternsDir of patternLookupDirs(this.lookupDirs)) {
149
+ try {
150
+ const patternFiles = await fs_1.promises.readdir(patternsDir);
151
+ for (const file of patternFiles) {
152
+ if (!file.endsWith('.json'))
153
+ continue;
154
+ const patternName = file.replace('.json', '');
155
+ if (patternsData[patternName])
156
+ continue;
157
+ try {
158
+ const content = await fs_1.promises.readFile(path_1.default.join(patternsDir, file), 'utf8');
159
+ patternsData[patternName] = JSON.parse(content);
160
+ this.logger.debug(`Loaded pattern data for: ${patternName} from ${patternsDir}`);
161
+ }
162
+ catch (error) {
163
+ this.logger.warn(`Could not read pattern data for ${patternName}: ${error}`);
164
+ }
165
+ }
166
+ }
167
+ catch {
168
+ // Silently skip missing patterns directories
169
+ }
170
+ }
171
+ return patternsData;
172
+ }
173
+ async processYAMLFiles(files, optionsData, patternsData = {}) {
108
174
  const fieldData = {};
109
175
  for (const file of files) {
110
176
  try {
@@ -113,7 +179,7 @@ class FieldCompiler extends base_compiler_1.BaseCompiler {
113
179
  // Parse YAML content
114
180
  const fieldConfig = yaml_1.default.parse(content);
115
181
  // Process field - resolve options if they're string references
116
- const processedField = this.processField(fieldConfig, optionsData);
182
+ const processedField = this.processField(fieldConfig, optionsData, patternsData);
117
183
  fieldData[fieldName] = processedField;
118
184
  this.logger.debug(`✓ Compiled ${path_1.default.basename(file)} → ${fieldName}.json`);
119
185
  }
@@ -123,10 +189,32 @@ class FieldCompiler extends base_compiler_1.BaseCompiler {
123
189
  }
124
190
  return fieldData;
125
191
  }
126
- processField(field, options) {
192
+ processField(field, options, patterns = {}) {
127
193
  // Create base processed field without options
128
- const { options: fieldOptions, ...fieldWithoutOptions } = field;
194
+ const { options: fieldOptions, patterns: fieldPatterns, ...fieldWithoutOptions } = field;
129
195
  const processedField = { ...fieldWithoutOptions };
196
+ if (Array.isArray(fieldPatterns) && fieldPatterns.length) {
197
+ const resolved = fieldPatterns
198
+ .map((name) => {
199
+ const rule = patterns[name];
200
+ if (!rule) {
201
+ this.logger.warn(`Pattern "${name}" referenced in field "${field.model}" not found in patterns directory`);
202
+ }
203
+ return rule;
204
+ })
205
+ .filter((rule) => Boolean(rule));
206
+ // Only when something resolved: an empty array would read as "declares
207
+ // shapes, accepts none", and a Field nothing can satisfy is worse than
208
+ // one that checks nothing.
209
+ if (resolved.length) {
210
+ processedField.patterns = resolved;
211
+ }
212
+ if (resolved.length > 1 && !field['patternMessage']) {
213
+ // The editor refuses this at the gesture; a hand-written asset can
214
+ // still reach here, and the fallback message names no shape at all.
215
+ this.logger.warn(`Field "${field.model}" declares ${resolved.length} patterns but no \`patternMessage\``);
216
+ }
217
+ }
130
218
  if (fieldOptions && typeof fieldOptions === 'string') {
131
219
  // If options is a string, look it up in the options directory
132
220
  if (options[fieldOptions]) {
@@ -1 +1 @@
1
- {"version":3,"file":"field-compiler.js","sourceRoot":"","sources":["../../../../../libs/cli/src/compilers/field-compiler.ts"],"names":[],"mappings":";;;;AAAA,yDAAqD;AAErD,oDAAgD;AAChD,uDAAmD;AACnD,wDAAwB;AACxB,wDAAwB;AACxB,2BAAoC;AAgBpC,MAAa,aAAc,SAAQ,4BAAY;IAI7C,YAAY,MAA2B;QACrC,KAAK,CAAC,MAAM,CAAC,CAAC;QAJR,YAAO,GAAuB,IAAI,CAAC;QAKzC,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,cAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI;YACnE,cAAI,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC;SAC9B,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,OAAO;QACX,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;QAEvC,IAAI,CAAC;YACH,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,aAAa,EAAE,CAAC;YAE7C,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAA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,KAAK,QAAQ,EAAE,CAAC;YACrD,8DAA8D;YAC9D,IAAI,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC;gBAC1B,cAAc,CAAC,OAAO,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;gBAC/C,IAAI,CAAC,MAAM,CAAC,KAAK,CACf,qBAAqB,YAAY,gBAAgB,KAAK,CAAC,KAAK,GAAG,CAChE,CAAC;YACJ,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,MAAM,CAAC,IAAI,CACd,YAAY,YAAY,0BAA0B,KAAK,CAAC,KAAK,kCAAkC,CAChG,CAAC;gBACF,cAAc,CAAC,OAAO,GAAG,EAAE,CAAC;YAC9B,CAAC;QACH,CAAC;aAAM,IAAI,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC;YACvC,gDAAgD;YAChD,cAAc,CAAC,OAAO,GAAG,YAAY,CAAC;QACxC,CAAC;QAED,OAAO,cAAc,CAAC;IACxB,CAAC;IAEO,UAAU,CAAC,QAAgB;QACjC,MAAM,GAAG,GAAG,sBAAS,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;QACjD,OAAO,GAAG,KAAK,MAAM,IAAI,GAAG,KAAK,OAAO,CAAC;IAC3C,CAAC;CACF;AA7LD,sCA6LC"}
1
+ {"version":3,"file":"field-compiler.js","sourceRoot":"","sources":["../../../../../libs/cli/src/compilers/field-compiler.ts"],"names":[],"mappings":";;;AAqDA,8CAUC;;AA/DD,yDAAqD;AAErD,oDAAgD;AAChD,uDAAmD;AAEnD,wDAAwB;AACxB,wDAAwB;AACxB,2BAAoC;AAsBpC;;;;;;GAMG;AACH,MAAM,oBAAoB,GAAG,cAAI,CAAC,IAAI,CACpC,cAAc,EACd,YAAY,EACZ,KAAK,EACL,QAAQ,EACR,UAAU,CACX,CAAC;AAEF;;;;;;;;GAQG;AACH,SAAgB,iBAAiB,CAC/B,QAAkB,EAClB,cAAsB,OAAO,CAAC,GAAG,EAAE;IAEnC,MA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