@loomweaver/devkit 0.7.2 → 0.7.4

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 (43) hide show
  1. package/README.md +5 -3
  2. package/package.json +1 -1
  3. package/src/generators/distribution/generator.js +8 -0
  4. package/src/generators/distribution/generator.js.map +1 -1
  5. package/src/generators/shared.d.ts +2 -10
  6. package/src/generators/shared.js +22 -10
  7. package/src/generators/shared.js.map +1 -1
  8. package/src/index.d.ts +5 -1
  9. package/src/index.js +13 -1
  10. package/src/index.js.map +1 -1
  11. package/src/lib/amend/compose.d.ts +12 -0
  12. package/src/lib/amend/compose.js +64 -0
  13. package/src/lib/amend/compose.js.map +1 -0
  14. package/src/lib/amend/describe.d.ts +7 -0
  15. package/src/lib/amend/describe.js +46 -0
  16. package/src/lib/amend/describe.js.map +1 -0
  17. package/src/lib/amend/merge.d.ts +14 -0
  18. package/src/lib/amend/merge.js +142 -0
  19. package/src/lib/amend/merge.js.map +1 -0
  20. package/src/lib/amend/types.d.ts +67 -0
  21. package/src/lib/amend/types.js +3 -0
  22. package/src/lib/amend/types.js.map +1 -0
  23. package/src/lib/generate/generate.d.ts +2 -0
  24. package/src/lib/generate/generate.js +5 -0
  25. package/src/lib/generate/generate.js.map +1 -1
  26. package/src/lib/generate/types.d.ts +6 -0
  27. package/src/lib/scaffolds/inputs.d.ts +26 -0
  28. package/src/lib/scaffolds/inputs.js +36 -0
  29. package/src/lib/scaffolds/inputs.js.map +1 -0
  30. package/src/lib/scaffolds/scaffolds.d.ts +3 -0
  31. package/src/lib/scaffolds/scaffolds.js +6 -30
  32. package/src/lib/scaffolds/scaffolds.js.map +1 -1
  33. package/src/recipes/angular-distribution/amendments.d.ts +3 -0
  34. package/src/recipes/angular-distribution/amendments.js +38 -0
  35. package/src/recipes/angular-distribution/amendments.js.map +1 -0
  36. package/src/recipes/angular-distribution/readme.d.ts +2 -0
  37. package/src/recipes/angular-distribution/readme.js +215 -0
  38. package/src/recipes/angular-distribution/readme.js.map +1 -0
  39. package/src/recipes/angular-distribution/recipe.js +13 -187
  40. package/src/recipes/angular-distribution/recipe.js.map +1 -1
  41. package/src/recipes/angular-weaver/amendments.d.ts +3 -0
  42. package/src/recipes/angular-weaver/amendments.js +34 -0
  43. package/src/recipes/angular-weaver/amendments.js.map +1 -0
package/README.md CHANGED
@@ -94,9 +94,11 @@ PWA manifest, build/serve/lint/test). `nx serve acme-studio` renders the bare sh
94
94
  so scaffolding over an existing app can never overwrite the app's own `README.md`.
95
95
 
96
96
  `--styles` decides how the app is styled. The default `tailwind` compiles the shell's source theme,
97
- which is also what lets you write Tailwind utilities of your own. `precompiled` imports the
98
- stylesheet we compiled instead no `tailwindcss`, no `.postcssrc.json`, no `@source` paths which
99
- is what you want if the product is themed with Bootstrap, Bulma or hand-written CSS.
97
+ which is also what lets you write Tailwind utilities of your own; the generator writes the
98
+ `.postcssrc.json` that needs, at the workspace root, merging into one that is already there rather
99
+ than replacing it. `precompiled` imports the stylesheet we compiled instead no `tailwindcss`, no
100
+ style pipeline, no `@source` paths — which is what you want if the product is themed with Bootstrap,
101
+ Bulma or hand-written CSS.
100
102
 
101
103
  ## Scaffold backend-integration ports
102
104
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loomweaver/devkit",
3
- "version": "0.7.2",
3
+ "version": "0.7.4",
4
4
  "description": "LoomWeaver scaffolding for Nx workspaces: generators for weavers, distributions, frame plugins and the integration seams, plus the manifest and i18n validators.",
5
5
  "keywords": [
6
6
  "loomweaver",
@@ -39,6 +39,14 @@ function distributionGenerator(tree, options) {
39
39
  withTests: distribution.withTests,
40
40
  styles: options.styles,
41
41
  });
42
+ for (const amendment of (0, generate_1.amendments)(recipe_1.angularDistribution, {
43
+ name: options.name,
44
+ styles: options.styles,
45
+ })) {
46
+ if (amendment.kind === 'postcss') {
47
+ (0, shared_1.addPostcssPlugin)(tree, amendment);
48
+ }
49
+ }
42
50
  const scaffold = (0, nx_files_1.nxDistributionFiles)(distribution);
43
51
  if (composingIntoExisting) {
44
52
  const { 'project.json': ours } = scaffold, rest = tslib_1.__rest(scaffold, ['project.json']);
@@ -1 +1 @@
1
- {"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../../libs/tooling/devkit/src/generators/distribution/generator.ts"],"names":[],"mappings":";;AAOA,sDAgDC;;AAvDD,uCAAqE;AACrE,0DAAuD;AACvD,sCAA0D;AAC1D,sEAAgF;AAChF,yCAAiE;AAGjE,SAAsB,qBAAqB,CACzC,IAAU,EACV,OAAoC;;;QAEpC,MAAM,YAAY,GAAG,IAAA,yBAAc,EAAC;YAClC,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,IAAI,EAAE,MAAA,OAAO,CAAC,IAAI,0CAAE,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;YACvD,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,YAAY,EAAE,IAAA,0BAAiB,EAAC,IAAI,CAAC;YACrC,SAAS,EAAE,OAAO,CAAC,cAAc,KAAK,MAAM;SAC7C,CAAC,CAAC;QACH,MAAM,WAAW,GAAG,GAAG,YAAY,CAAC,WAAW,eAAe,CAAC;QAC/D,MAAM,qBAAqB,GAAG,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;QACvD,IAAI,qBAAqB,EAAE,CAAC;YAC1B,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;gBACnB,MAAM,IAAI,KAAK,CACb,+BAA+B,YAAY,CAAC,WAAW,gCAAgC;oBACrF,yEAAyE,CAC5E,CAAC;YACJ,CAAC;YACD,MAAM,YAAY,GAAY,IAAA,iBAAQ,EAAC,IAAI,EAAE,WAAW,CAAC,CAAC,IAAI,CAAC;YAC/D,IAAI,OAAO,YAAY,KAAK,QAAQ,IAAI,YAAY,KAA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EAAE,CAAA,MAAA,IAAI,CAAC,IAAI,0CAAE,MAAM,EAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAA,QAAQ,CAAC,IAAI,mCAAI,EAAE,CAAC,EAC3D,OAAO,kCAAO,QAAQ,CAAC,OAAO,GAAK,IAAI,CAAC,OAAO,KAC/C,CAAA;KAAA,CAAC,CAAC;AACN,CAAC;AAED,kBAAe,qBAAqB,CAAC"}
1
+ {"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../../libs/tooling/devkit/src/generators/distribution/generator.ts"],"names":[],"mappings":";;AAOA,sDAyDC;;AAhED,uCAAqE;AACrE,0DAAmE;AACnE,sCAA4E;AAC5E,sEAAgF;AAChF,yCAAiE;AAGjE,SAAsB,qBAAqB,CACzC,IAAU,EACV,OAAoC;;;QAEpC,MAAM,YAAY,GAAG,IAAA,yBAAc,EAAC;YAClC,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,IAAI,EAAE,MAAA,OAAO,CAAC,IAAI,0CAAE,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;YACvD,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,YAAY,EAAE,IAAA,0BAAiB,EAAC,IAAI,CAAC;YACrC,SAAS,EAAE,OAAO,CAAC,cAAc,KAAK,MAAM;SAC7C,CAAC,CAAC;QACH,MAAM,WAAW,GAAG,GAAG,YAAY,CAAC,WAAW,eAAe,CAAC;QAC/D,MAAM,qBAAqB,GAAG,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;QACvD,IAAI,qBAAqB,EAAE,CAAC;YAC1B,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;gBACnB,MAAM,IAAI,KAAK,CACb,+BAA+B,YAAY,CAAC,WAAW,gCAAgC;oBACrF,yEAAyE,CA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AC,IAAI,EAAE,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;QACxD,CAAC;aAAM,CAAC;YACN,IAAA,mBAAU,EAAC,IAAI,EAAE,YAAY,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;QAC/D,CAAC;QAED,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;CAAA;AAQD,SAAS,gBAAgB,CACvB,IAAU,EACV,WAAmB,EACnB,IAAiB;IAEjB,IAAA,mBAAU,EAAC,IAAI,EAAE,WAAW,EAAE,CAAC,QAAqB,EAAE,EAAE;;QAAC,OAAA,+CACpD,QAAQ,GACR,IAAI,KACP,IAAI,EAAE,CAAA,MAAA,IAAI,CAAC,IAAI,0CAAE,MAAM,EAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAA,QAAQ,CAAC,IAAI,mCAAI,EAAE,CAAC,EAC3D,OAAO,kCAAO,QAAQ,CAAC,OAAO,GAAK,IAAI,CAAC,OAAO,KAC/C,CAAA;KAAA,CAAC,CAAC;AACN,CAAC;AAED,kBAAe,qBAAqB,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import { Tree } from '@nx/devkit';
2
+ import { PostcssAmendment } from '../lib/amend/types';
2
3
  import { FileMap } from '../lib/generate/types';
3
4
  export interface ResolvedApp {
4
5
  readonly name: string;
@@ -14,12 +15,7 @@ export interface ResolvedApp {
14
15
  * are never candidates — otherwise the standard `<app>` + `<app>-e2e` pair would defeat inference.
15
16
  */
16
17
  export declare function resolveApp(tree: Tree, app?: string): ResolvedApp;
17
- /**
18
- * The npm scope of the workspace, taken from the root manifest, so a generated import path matches
19
- * what the consumer already publishes under. Undefined for an unscoped workspace.
20
- */
21
18
  export declare function workspaceScope(tree: Tree): string | undefined;
22
- /** The file that carries the workspace path aliases — classic base config or the solution config. */
23
19
  export declare function tsconfigPathsFile(tree: Tree): string;
24
20
  export declare function writeFiles(tree: Tree, root: string, ...maps: FileMap[]): void;
25
21
  export declare function writeFilesGuarded(tree: Tree, root: string, files: FileMap): void;
@@ -27,11 +23,6 @@ export interface I18nAssetsGlob {
27
23
  readonly input: string;
28
24
  readonly output: string;
29
25
  }
30
- /**
31
- * Serves a library's i18n bundle through the application's build assets, so the namespace loader
32
- * can fetch `/i18n/<id>/<lang>.json`. A no-op when the app's build target carries no assets array
33
- * (a non-standard builder) or the glob is already present.
34
- */
35
26
  export declare function addI18nAssetsGlob(tree: Tree, app: string, glob: I18nAssetsGlob): void;
36
27
  /**
37
28
  * Registers a library's sources with the application's Tailwind entry stylesheet, so utilities
@@ -45,3 +36,4 @@ export declare function addI18nAssetsGlob(tree: Tree, app: string, glob: I18nAss
45
36
  * stylesheet, or when the source is already listed.
46
37
  */
47
38
  export declare function addTailwindSource(tree: Tree, app: string, libSourceRoot: string): void;
39
+ export declare function addPostcssPlugin(tree: Tree, amendment: PostcssAmendment): void;
@@ -7,8 +7,10 @@ exports.writeFiles = writeFiles;
7
7
  exports.writeFilesGuarded = writeFilesGuarded;
8
8
  exports.addI18nAssetsGlob = addI18nAssetsGlob;
9
9
  exports.addTailwindSource = addTailwindSource;
10
+ exports.addPostcssPlugin = addPostcssPlugin;
10
11
  const node_path_1 = require("node:path");
11
12
  const devkit_1 = require("@nx/devkit");
13
+ const merge_1 = require("../lib/amend/merge");
12
14
  /**
13
15
  * Resolves the application a scaffold drops into. Named explicitly, or — when the workspace holds
14
16
  * exactly one buildable application — inferred from it. Anything else is an error naming the
@@ -45,10 +47,6 @@ function resolveApp(tree, app) {
45
47
  .map(([name]) => name)
46
48
  .join(', ')}). Pass --app to choose one.`);
47
49
  }
48
- /**
49
- * The npm scope of the workspace, taken from the root manifest, so a generated import path matches
50
- * what the consumer already publishes under. Undefined for an unscoped workspace.
51
- */
52
50
  function workspaceScope(tree) {
53
51
  const raw = tree.read('package.json', 'utf-8');
54
52
  if (!raw) {
@@ -60,7 +58,6 @@ function workspaceScope(tree) {
60
58
  }
61
59
  return name.split('/')[0];
62
60
  }
63
- /** The file that carries the workspace path aliases — classic base config or the solution config. */
64
61
  function tsconfigPathsFile(tree) {
65
62
  return tree.exists('tsconfig.base.json')
66
63
  ? 'tsconfig.base.json'
@@ -82,11 +79,6 @@ function writeFilesGuarded(tree, root, files) {
82
79
  tree.write(full, content);
83
80
  }
84
81
  }
85
- /**
86
- * Serves a library's i18n bundle through the application's build assets, so the namespace loader
87
- * can fetch `/i18n/<id>/<lang>.json`. A no-op when the app's build target carries no assets array
88
- * (a non-standard builder) or the glob is already present.
89
- */
90
82
  function addI18nAssetsGlob(tree, app, glob) {
91
83
  var _a, _b, _c;
92
84
  const project = (0, devkit_1.readProjectConfiguration)(tree, app);
@@ -149,4 +141,24 @@ function entryStylesheet(styles) {
149
141
  }
150
142
  return undefined;
151
143
  }
144
+ function addPostcssPlugin(tree, amendment) {
145
+ var _a;
146
+ const codeConfigs = [
147
+ 'postcss.config.js',
148
+ 'postcss.config.mjs',
149
+ 'postcss.config.cjs',
150
+ '.postcssrc.js',
151
+ ];
152
+ if (codeConfigs.some((name) => tree.exists(name))) {
153
+ return;
154
+ }
155
+ const existing = tree.exists(amendment.file)
156
+ ? JSON.parse((_a = tree.read(amendment.file, 'utf-8')) !== null && _a !== void 0 ? _a : '{}')
157
+ : undefined;
158
+ const result = (0, merge_1.ensurePostcssPlugin)(existing, amendment);
159
+ if (result.added.length === 0) {
160
+ return;
161
+ }
162
+ tree.write(amendment.file, `${JSON.stringify(result.value, null, 2)}\n`);
163
+ }
152
164
  //# sourceMappingURL=shared.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../../../../libs/tooling/devkit/src/generators/shared.ts"],"names":[],"mappings":";;AAuBA,gCAoCC;AAMD,wCAUC;AAGD,8CAIC;AAED,gCAMC;AAED,8CAYC;AAYD,8CAqBC;AAaD,8CAsBC;AA5KD,yCAAkC;AAClC,uCAKoB;AAQpB;;;;;;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KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;YAChD,MAAM,KAAK,GAAI,KAA6B,CAAC,KAAK,CAAC;YACnD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;gBACxD,OAAO,KAAK,CAAC;YACf,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
1
+ {"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../../../../libs/tooling/devkit/src/generators/shared.ts"],"names":[],"mappings":";;AAyBA,gCAoCC;AAED,wCAUC;AAED,8CAIC;AAED,gCAMC;AAED,8CAYC;AAOD,8CAqBC;AAaD,8CAsBC;AAoBD,4CAqBC;AA7MD,yCAAkC;AAClC,uCAKoB;AACpB,8CAAyD;AASzD;;;;;;;;GAQG;AACH,SAAgB,UAAU,CAAC,IAAU,EAAE,GAAY;;IACjD,MAAM,QAAQ,GAAG,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;IACnC,IAAI,GAAG,EAAE,CAAC;QACR,MAAM,OAAO,GAAG,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAClC,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CAAC,qBAAqB,GAAG,sBAAsB,CAAC,CAAC;QAClE,CAAC;QACD,IAAI,OAAO,CAAC,WAAW,KAAK,aAAa,EAAE,CAAC;YAC1C,MAAM,IAAI,KAAK,CACb,IAAI,GAAG,gFAAgF,CACxF,CAAC;QACJ,CAAC;QACD,IAAI,CAAC,CAAA,MAAA,OAAO,CAAC,OAAO,0CAAG,OAAO,CAAC,CAAA,EAAE,CAAC;YAChC,MAAM,IAAI,KAAK,CACb,IAAI,GAAG,2FAA2F,CACnG,CAAC;QACJ,CAAC;QACD,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,CA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IAAI,EAAE,OAAO,CAAC,mCAAI,IAAI,CAAa;QACrE,CAAC,CAAC,SAAS,CAAC;IACd,MAAM,MAAM,GAAG,IAAA,2BAAmB,EAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;IACxD,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC9B,OAAO;IACT,CAAC;IACD,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;AAC3E,CAAC"}
package/src/index.d.ts CHANGED
@@ -1,5 +1,9 @@
1
1
  export type { FileMap, Recipe } from './lib/generate/types';
2
- export { generate } from './lib/generate/generate';
2
+ export { amendments, generate } from './lib/generate/generate';
3
+ export type { Amendment, AssetGlob, ComposePluginAmendment, BuildTargetAmendment, PostcssAmendment, StylesheetSourceAmendment, } from './lib/amend/types';
4
+ export { ensureBuildTarget, ensurePostcssPlugin, ensureStylesheetSource, joinProjectPath, resolveAssetInput, type MergeResult, } from './lib/amend/merge';
5
+ export { composeLines, composePlugin, type ComposeResult } from './lib/amend/compose';
6
+ export { describeAmendment } from './lib/amend/describe';
3
7
  export { isKebabId, toCamelCase, toPascalCase, toTitleCase } from './lib/generate/casing';
4
8
  export { angularWeaver, resolveWeaverInput, type WeaverInput, type ResolvedWeaver, } from './recipes/angular-weaver/recipe';
5
9
  export { framePlugin, resolveFramePluginInput, type FramePluginInput, type ResolvedFramePlugin, } from './recipes/frame-plugin/recipe';
package/src/index.js CHANGED
@@ -1,8 +1,20 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CATALOG_ENTRY_KEYS = exports.validateCatalog = exports.validateI18nParity = exports.KNOWN_CAPABILITIES = exports.validateManifest = exports.usageFor = exports.portableOptions = exports.nxSchemaFor = exports.kebabCase = exports.findScaffold = exports.SCAFFOLDS = exports.resolveLayoutInput = exports.layout = exports.resolveThemeInput = exports.theme = exports.resolveSettingsStoreInput = exports.settingsStore = exports.resolveAuthSourceInput = exports.authSource = exports.resolveDistributionInput = exports.angularDistribution = exports.resolveFramePluginInput = exports.framePlugin = exports.resolveWeaverInput = exports.angularWeaver = exports.toTitleCase = exports.toPascalCase = exports.toCamelCase = exports.isKebabId = exports.generate = void 0;
3
+ exports.CATALOG_ENTRY_KEYS = exports.validateCatalog = exports.validateI18nParity = exports.KNOWN_CAPABILITIES = exports.validateManifest = exports.usageFor = exports.portableOptions = exports.nxSchemaFor = exports.kebabCase = exports.findScaffold = exports.SCAFFOLDS = exports.resolveLayoutInput = exports.layout = exports.resolveThemeInput = exports.theme = exports.resolveSettingsStoreInput = exports.settingsStore = exports.resolveAuthSourceInput = exports.authSource = exports.resolveDistributionInput = exports.angularDistribution = exports.resolveFramePluginInput = exports.framePlugin = exports.resolveWeaverInput = exports.angularWeaver = exports.toTitleCase = exports.toPascalCase = exports.toCamelCase = exports.isKebabId = exports.describeAmendment = exports.composePlugin = exports.composeLines = exports.resolveAssetInput = exports.joinProjectPath = exports.ensureStylesheetSource = exports.ensurePostcssPlugin = exports.ensureBuildTarget = exports.generate = exports.amendments = void 0;
4
4
  var generate_1 = require("./lib/generate/generate");
5
+ Object.defineProperty(exports, "amendments", { enumerable: true, get: function () { return generate_1.amendments; } });
5
6
  Object.defineProperty(exports, "generate", { enumerable: true, get: function () { return generate_1.generate; } });
7
+ var merge_1 = require("./lib/amend/merge");
8
+ Object.defineProperty(exports, "ensureBuildTarget", { enumerable: true, get: function () { return merge_1.ensureBuildTarget; } });
9
+ Object.defineProperty(exports, "ensurePostcssPlugin", { enumerable: true, get: function () { return merge_1.ensurePostcssPlugin; } });
10
+ Object.defineProperty(exports, "ensureStylesheetSource", { enumerable: true, get: function () { return merge_1.ensureStylesheetSource; } });
11
+ Object.defineProperty(exports, "joinProjectPath", { enumerable: true, get: function () { return merge_1.joinProjectPath; } });
12
+ Object.defineProperty(exports, "resolveAssetInput", { enumerable: true, get: function () { return merge_1.resolveAssetInput; } });
13
+ var compose_1 = require("./lib/amend/compose");
14
+ Object.defineProperty(exports, "composeLines", { enumerable: true, get: function () { return compose_1.composeLines; } });
15
+ Object.defineProperty(exports, "composePlugin", { enumerable: true, get: function () { return compose_1.composePlugin; } });
16
+ var describe_1 = require("./lib/amend/describe");
17
+ Object.defineProperty(exports, "describeAmendment", { enumerable: true, get: function () { return describe_1.describeAmendment; } });
6
18
  var casing_1 = require("./lib/generate/casing");
7
19
  Object.defineProperty(exports, "isKebabId", { enumerable: true, get: function () { return casing_1.isKebabId; } });
8
20
  Object.defineProperty(exports, "toCamelCase", { enumerable: true, get: function () { return casing_1.toCamelCase; } });
package/src/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/tooling/devkit/src/index.ts"],"names":[],"mappings":";;;AACA,oDAAmD;AAA1C,oGAAA,QAAQ,OAAA;AACjB,gDAA0F;AAAjF,mGAAA,SAAS,OAAA;AAAE,qGAAA,WAAW,OAAA;AAAE,sGAAA,YAAY,OAAA;AAAE,qGAAA,WAAW,OAAA;AAC1D,0DAKyC;AAJvC,uGAAA,aAAa,OAAA;AACb,4GAAA,kBAAkB,OAAA;AAIpB,wDAKuC;AAJrC,qGAAA,WAAW,OAAA;AACX,iHAAA,uBAAuB,OAAA;AAIzB,gEAK+C;AAJ7C,6GAAA,mBAAmB,OAAA;AACnB,kHAAA,wBAAwB,OAAA;AAI1B,uDAKsC;AAJpC,oGAAA,UAAU,OAAA;AACV,gHAAA,sBAAsB,OAAA;AAIxB,0DAKyC;AAJvC,uGAAA,aAAa,OAAA;AACb,mHAAA,yBAAyB,OAAA;AAI3B,iDAAuG;AAA9F,+FAAA,KAAK,OAAA;AAAE,2GAAA,iBAAiB,OAAA;AACjC,kDAKiC;AAJ/B,gGAAA,MAAM,OAAA;AACN,4GAAA,kBAAkB,OAAA;AAIpB,uDAU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9F,+FAAA,KAAK,OAAA;AAAE,2GAAA,iBAAiB,OAAA;AACjC,kDAKiC;AAJ/B,gGAAA,MAAM,OAAA;AACN,4GAAA,kBAAkB,OAAA;AAIpB,uDAUmC;AATjC,sGAAA,SAAS,OAAA;AACT,yGAAA,YAAY,OAAA;AACZ,sGAAA,SAAS,OAAA;AACT,wGAAA,WAAW,OAAA;AACX,4GAAA,eAAe,OAAA;AACf,qGAAA,QAAQ,OAAA;AAMV,oDAAkG;AAAzF,4GAAA,gBAAgB,OAAA;AAAE,8GAAA,kBAAkB,OAAA;AAC7C,4CAA0E;AAAjE,0GAAA,kBAAkB,OAAA;AAC3B,kDAA6E;AAApE,0GAAA,eAAe,OAAA;AAAE,6GAAA,kBAAkB,OAAA"}
@@ -0,0 +1,12 @@
1
+ import { ComposePluginAmendment } from './types';
2
+ export interface ComposeResult {
3
+ readonly source: string;
4
+ readonly composed: boolean;
5
+ }
6
+ /**
7
+ * Registers a generated plugin in a composition root we generated ourselves. Recognition is the
8
+ * whole safety mechanism: the providers array and the shell import are matched by the shape the
9
+ * scaffold writes, and anything else is declined rather than guessed at.
10
+ */
11
+ export declare function composePlugin(source: string, amendment: ComposePluginAmendment, importPath: string): ComposeResult;
12
+ export declare function composeLines(amendment: ComposePluginAmendment, importPath: string): readonly string[];
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.composePlugin = composePlugin;
4
+ exports.composeLines = composeLines;
5
+ const PROVIDERS = /(export\s+const\s+appConfig\s*:[^=]*=\s*\{[\s\S]*?providers\s*:\s*\[)([\s\S]*?)(\n(\s*)\],)/;
6
+ const SHELL_IMPORT = /import\s*\{([^}]*)\}\s*from\s*'@loomweaver\/shell';/;
7
+ /**
8
+ * Registers a generated plugin in a composition root we generated ourselves. Recognition is the
9
+ * whole safety mechanism: the providers array and the shell import are matched by the shape the
10
+ * scaffold writes, and anything else is declined rather than guessed at.
11
+ */
12
+ function composePlugin(source, amendment, importPath) {
13
+ if (source.includes(amendment.symbol)) {
14
+ return { source, composed: true };
15
+ }
16
+ const providers = PROVIDERS.exec(source);
17
+ const shellImport = SHELL_IMPORT.exec(source);
18
+ if (!providers || !shellImport) {
19
+ return { source, composed: false };
20
+ }
21
+ const withImports = source.replace(SHELL_IMPORT, `import {${withShellSymbols(shellImport[1])}} from '@loomweaver/shell';\nimport { ${amendment.symbol} } from '${importPath}';`);
22
+ const indent = `${providers[4]} `;
23
+ const lines = [
24
+ `${indent}provideTranslationNamespaces('${amendment.id}'),`,
25
+ `${indent}provideCapabilityGrants({ ${amendment.id}: [${amendment.capabilities
26
+ .map((capability) => `'${capability}'`)
27
+ .join(', ')}] }),`,
28
+ `${indent}...providePlugins(${amendment.symbol}),`,
29
+ ].join('\n');
30
+ return {
31
+ source: withImports.replace(PROVIDERS, (_all, head, body, tail) => `${head}${body}\n${lines}${tail}`),
32
+ composed: true,
33
+ };
34
+ }
35
+ function composeLines(amendment, importPath) {
36
+ return [
37
+ `import { ${amendment.symbol} } from '${importPath}';`,
38
+ "import { providePlugins, provideCapabilityGrants, provideTranslationNamespaces } from '@loomweaver/shell';",
39
+ `provideTranslationNamespaces('${amendment.id}'),`,
40
+ `provideCapabilityGrants({ ${amendment.id}: [${amendment.capabilities
41
+ .map((capability) => `'${capability}'`)
42
+ .join(', ')}] }),`,
43
+ `...providePlugins(${amendment.symbol}),`,
44
+ ];
45
+ }
46
+ function withShellSymbols(existing) {
47
+ const wanted = [
48
+ 'provideCapabilityGrants',
49
+ 'providePlugins',
50
+ 'provideTranslationNamespaces',
51
+ ];
52
+ const present = existing
53
+ .split(',')
54
+ .map((symbol) => symbol.trim())
55
+ .filter(Boolean);
56
+ const missing = wanted.filter((symbol) => !present.some((entry) => entry.replace(/^type\s+/, '') === symbol));
57
+ if (missing.length === 0) {
58
+ return existing;
59
+ }
60
+ const multiline = existing.includes('\n');
61
+ const all = [...present, ...missing].sort((a, b) => a.localeCompare(b));
62
+ return multiline ? `\n ${all.join(',\n ')},\n` : ` ${all.join(', ')} `;
63
+ }
64
+ //# sourceMappingURL=compose.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compose.js","sourceRoot":"","sources":["../../../../../../../libs/tooling/devkit/src/lib/amend/compose.ts"],"names":[],"mappings":";;AAeA,sCAiCC;AAED,oCAaC;AAxDD,MAAM,SAAS,GAAG,6FAA6F,CAAC;AAChH,MAAM,YAAY,GAAG,qDAAqD,CAAC;AAE3E;;;;GAIG;AACH,SAAgB,aAAa,CAC3B,MAAc,EACd,SAAiC,EACjC,UAAkB;IAElB,IAAI,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC;QACtC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IACpC,CAAC;IACD,MAAM,SAAS,GAAG,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACzC,MAAM,WAAW,GAAG,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC9C,IAAI,CAAC,SAAS,IAAI,CAAC,WAAW,EAAE,CAAC;QAC/B,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;IACrC,CAAC;IACD,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,CAChC,YAAY,EACZ,WAAW,gBAAgB,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,yCAAyC,SAAS,CAAC,MAAM,YAAY,UAAU,IAAI,CAC/H,CAAC;IACF,MAAM,MAAM,GAAG,GAAG,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC;IACnC,MAAM,KAAK,GAAG;QACZ,GAAG,MAAM,iCAAiC,SAAS,CAAC,EAAE,KAAK;QAC3D,GAAG,MAAM,6BAA6B,SAAS,CAAC,EAAE,MAAM,SAAS,CAAC,YAAY;aAC3E,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,IAAI,UAAU,GAAG,CAAC;aACtC,IAAI,CAAC,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,CAAC;IACF,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,QAAQ,CAAC;IAClB,CAAC;IACD,MAAM,SAAS,GAAG,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC1C,MAAM,GAAG,GAAG,CAAC,GAAG,OAAO,EAAE,GAAG,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;IACxE,OAAO,SAAS,CAAC,CAAC,CAAC,OAAO,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;AAC3E,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { Amendment } from './types';
2
+ /**
3
+ * States an amendment as a step a reader can carry out, with what it costs to skip. A route that
4
+ * cannot reach the workspace returns these instead of performing them, so that generated output is
5
+ * never silently incomplete.
6
+ */
7
+ export declare function describeAmendment(amendment: Amendment): string;
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.describeAmendment = describeAmendment;
4
+ /**
5
+ * States an amendment as a step a reader can carry out, with what it costs to skip. A route that
6
+ * cannot reach the workspace returns these instead of performing them, so that generated output is
7
+ * never silently incomplete.
8
+ */
9
+ function describeAmendment(amendment) {
10
+ if (amendment.kind === 'postcss') {
11
+ return `Write ${amendment.file} beside your package.json, naming ${amendment.plugin}. Without it the stylesheet is read as plain CSS: no utility class is emitted, the workbench renders unstyled, and the build still reports success.`;
12
+ }
13
+ if (amendment.kind === 'stylesheet-source') {
14
+ return `Add an @source entry for '${amendment.sourceRoot}' to the application's entry stylesheet, resolved from that stylesheet. Without it none of that code's utilities are emitted.`;
15
+ }
16
+ if (amendment.kind === 'compose-plugin') {
17
+ return `Register ${amendment.id} in the composition root: import { ${amendment.symbol} }, provideTranslationNamespaces('${amendment.id}'), provideCapabilityGrants({ ${amendment.id}: [${amendment.capabilities
18
+ .map((capability) => `'${capability}'`)
19
+ .join(', ')}] }) and ...providePlugins(${amendment.symbol}). Without it none of its contributions appear.`;
20
+ }
21
+ return [
22
+ ...(amendment.styles.length > 0
23
+ ? [`name ${amendment.styles.join(', ')} in styles`]
24
+ : []),
25
+ ...(amendment.assets.length > 0
26
+ ? [
27
+ `add assets for ${amendment.assets
28
+ .map((asset) => asset.input)
29
+ .join(', ')} (the shell fetches its own strings at runtime, so without that glob every label in the chrome renders as its raw translation key)`,
30
+ ]
31
+ : []),
32
+ ...(amendment.serviceWorker
33
+ ? [
34
+ `set serviceWorker to ${amendment.serviceWorker} in the production configuration (provideShell registers a worker that 404s otherwise)`,
35
+ ]
36
+ : []),
37
+ ...(amendment.inlineCritical === undefined
38
+ ? []
39
+ : [
40
+ `set optimization.styles.inlineCritical to ${amendment.inlineCritical} in the production configuration (the generated content-security policy blocks the inline handler Angular's critical-CSS pass attaches, so a release build renders unstyled)`,
41
+ ]),
42
+ ]
43
+ .map((step, index) => `${index + 1}. ${step}`)
44
+ .join(' ');
45
+ }
46
+ //# sourceMappingURL=describe.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"describe.js","sourceRoot":"","sources":["../../../../../../../libs/tooling/devkit/src/lib/amend/describe.ts"],"names":[],"mappings":";;AAOA,8CAsCC;AA3CD;;;;GAIG;AACH,SAAgB,iBAAiB,CAAC,SAAoB;IACpD,IAAI,SAAS,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QACjC,OAAO,SAAS,SAAS,CAAC,IAAI,qCAAqC,SAAS,CAAC,MAAM,qJAAqJ,CAAC;IAC3O,CAAC;IACD,IAAI,SAAS,CAAC,IAAI,KAAK,mBAAmB,EAAE,CAAC;QAC3C,OAAO,6BAA6B,SAAS,CAAC,UAAU,+HAA+H,CAAC;IAC1L,CAAC;IACD,IAAI,SAAS,CAAC,IAAI,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import { AssetGlob, BuildTargetAmendment, PostcssAmendment } from './types';
2
+ export type JsonObject = Record<string, unknown>;
3
+ export interface MergeResult {
4
+ readonly value: JsonObject;
5
+ /** What was added, named for the run's own report. Empty when everything was already there. */
6
+ readonly added: readonly string[];
7
+ /** What could not be added because the consumer's value occupies the place it would go. */
8
+ readonly declined: readonly string[];
9
+ }
10
+ export declare function joinProjectPath(projectRoot: string, path: string): string;
11
+ export declare function resolveAssetInput(glob: AssetGlob, projectRoot: string): string;
12
+ export declare function ensurePostcssPlugin(existing: unknown, amendment: PostcssAmendment): MergeResult;
13
+ export declare function ensureBuildTarget(target: unknown, amendment: BuildTargetAmendment, projectRoot: string): MergeResult;
14
+ export declare function ensureStylesheetSource(css: string, source: string): string;
@@ -0,0 +1,142 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.joinProjectPath = joinProjectPath;
4
+ exports.resolveAssetInput = resolveAssetInput;
5
+ exports.ensurePostcssPlugin = ensurePostcssPlugin;
6
+ exports.ensureBuildTarget = ensureBuildTarget;
7
+ exports.ensureStylesheetSource = ensureStylesheetSource;
8
+ function joinProjectPath(projectRoot, path) {
9
+ const root = projectRoot.replace(/^\.?\/*/, '').replace(/\/+$/, '');
10
+ return root ? `${root}/${path}` : path;
11
+ }
12
+ function resolveAssetInput(glob, projectRoot) {
13
+ return glob.from === 'project'
14
+ ? joinProjectPath(projectRoot, glob.input)
15
+ : glob.input;
16
+ }
17
+ function ensurePostcssPlugin(existing, amendment) {
18
+ var _a;
19
+ const root = (_a = asObject(existing)) !== null && _a !== void 0 ? _a : {};
20
+ const plugins = asObject(root['plugins']);
21
+ if (plugins === undefined && root['plugins'] !== undefined) {
22
+ return {
23
+ value: root,
24
+ added: [],
25
+ declined: [`${amendment.file}: "plugins" is not an object`],
26
+ };
27
+ }
28
+ const next = Object.assign({}, (plugins !== null && plugins !== void 0 ? plugins : {}));
29
+ if (amendment.plugin in next) {
30
+ return { value: root, added: [], declined: [] };
31
+ }
32
+ next[amendment.plugin] = {};
33
+ return {
34
+ value: Object.assign(Object.assign({}, root), { plugins: next }),
35
+ added: [`${amendment.file}: ${amendment.plugin}`],
36
+ declined: [],
37
+ };
38
+ }
39
+ function ensureBuildTarget(target, amendment, projectRoot) {
40
+ var _a, _b, _c, _d;
41
+ const next = Object.assign({}, ((_a = asObject(target)) !== null && _a !== void 0 ? _a : {}));
42
+ const added = [];
43
+ const declined = [];
44
+ const options = Object.assign({}, ((_b = asObject(next['options'])) !== null && _b !== void 0 ? _b : {}));
45
+ const styles = ensureStrings(options['styles'], amendment.styles.map((style) => joinProjectPath(projectRoot, style)));
46
+ if (styles.added.length > 0) {
47
+ options['styles'] = styles.value;
48
+ added.push(...styles.added.map((entry) => `styles: ${entry}`));
49
+ }
50
+ const assets = ensureAssets(options['assets'], amendment.assets, projectRoot);
51
+ if (assets.added.length > 0) {
52
+ options['assets'] = assets.value;
53
+ added.push(...assets.added.map((entry) => `assets: ${entry}`));
54
+ }
55
+ next['options'] = options;
56
+ if (amendment.inlineCritical !== undefined || amendment.serviceWorker) {
57
+ const configurations = Object.assign({}, ((_c = asObject(next['configurations'])) !== null && _c !== void 0 ? _c : {}));
58
+ const production = Object.assign({}, ((_d = asObject(configurations['production'])) !== null && _d !== void 0 ? _d : {}));
59
+ if (amendment.serviceWorker && production['serviceWorker'] === undefined) {
60
+ production['serviceWorker'] = joinProjectPath(projectRoot, amendment.serviceWorker);
61
+ added.push(`production serviceWorker: ${production['serviceWorker']}`);
62
+ }
63
+ if (amendment.inlineCritical !== undefined) {
64
+ const critical = ensureInlineCritical(production['optimization'], amendment.inlineCritical);
65
+ if (critical.declined) {
66
+ declined.push('production optimization is a boolean, so inlineCritical cannot be set beside it — ' +
67
+ 'a release build then loads the stylesheet with an inline handler the generated ' +
68
+ 'content-security policy blocks, and renders unstyled');
69
+ }
70
+ else if (critical.changed) {
71
+ production['optimization'] = critical.value;
72
+ added.push(`production optimization.styles.inlineCritical: ${amendment.inlineCritical}`);
73
+ }
74
+ }
75
+ configurations['production'] = production;
76
+ next['configurations'] = configurations;
77
+ }
78
+ return { value: next, added, declined };
79
+ }
80
+ function ensureStylesheetSource(css, source) {
81
+ const quoted = source.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
82
+ if (new RegExp(`@source\\s+['"]${quoted}/?['"]`).test(css)) {
83
+ return css;
84
+ }
85
+ return `${css.trimEnd()}\n\n@source '${source}';\n`;
86
+ }
87
+ function ensureInlineCritical(optimization, inlineCritical) {
88
+ var _a;
89
+ if (typeof optimization === 'boolean') {
90
+ return { value: optimization, changed: false, declined: true };
91
+ }
92
+ const root = Object.assign({}, ((_a = asObject(optimization)) !== null && _a !== void 0 ? _a : {}));
93
+ const styles = asObject(root['styles']);
94
+ if (styles === undefined && root['styles'] !== undefined) {
95
+ return { value: optimization, changed: false, declined: true };
96
+ }
97
+ if ((styles === null || styles === void 0 ? void 0 : styles['inlineCritical']) !== undefined) {
98
+ return { value: optimization, changed: false, declined: false };
99
+ }
100
+ return {
101
+ value: Object.assign(Object.assign({}, root), { styles: Object.assign(Object.assign({}, (styles !== null && styles !== void 0 ? styles : {})), { inlineCritical }) }),
102
+ changed: true,
103
+ declined: false,
104
+ };
105
+ }
106
+ function ensureStrings(existing, wanted) {
107
+ const list = Array.isArray(existing) ? [...existing] : [];
108
+ const added = [];
109
+ for (const entry of wanted) {
110
+ if (!list.includes(entry)) {
111
+ list.push(entry);
112
+ added.push(entry);
113
+ }
114
+ }
115
+ return { value: list, added };
116
+ }
117
+ function ensureAssets(existing, wanted, projectRoot) {
118
+ const list = Array.isArray(existing) ? [...existing] : [];
119
+ const added = [];
120
+ for (const glob of wanted) {
121
+ const input = resolveAssetInput(glob, projectRoot);
122
+ if (list.some((entry) => inputOf(entry) === input)) {
123
+ continue;
124
+ }
125
+ list.push(Object.assign({ glob: glob.glob, input }, (glob.output === undefined ? {} : { output: glob.output })));
126
+ added.push(input);
127
+ }
128
+ return { value: list, added };
129
+ }
130
+ function inputOf(entry) {
131
+ if (typeof entry === 'string') {
132
+ return entry;
133
+ }
134
+ const asset = asObject(entry);
135
+ return typeof (asset === null || asset === void 0 ? void 0 : asset['input']) === 'string' ? asset['input'] : undefined;
136
+ }
137
+ function asObject(value) {
138
+ return typeof value === 'object' && value !== null && !Array.isArray(value)
139
+ ? value
140
+ : undefined;
141
+ }
142
+ //# sourceMappingURL=merge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"merge.js","sourceRoot":"","sources":["../../../../../../../libs/tooling/devkit/src/lib/amend/merge.ts"],"names":[],"mappings":";;AAYA,0CAGC;AAED,8CAIC;AAED,kDAuBC;AAED,8CA8DC;AAED,wDAMC;AA1GD,SAAgB,eAAe,CAAC,WAAmB,EAAE,IAAY;IAC/D,MAAM,IAAI,GAAG,WAAW,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACpE,OAAO,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AACzC,CAAC;AAED,SAAgB,iBAAiB,CAAC,IAAe,EAAE,WAAmB;IACpE,OAAO,IAAI,CAAC,IAAI,KAAK,SAAS;QAC5B,CAAC,CAAC,eAAe,CAAC,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC;QAC1C,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;AACjB,CAAC;AAED,SAAgB,mBAAmB,CACjC,QAAiB,EACjB,SAA2B;;IAE3B,MAAM,IAAI,GAAG,MAAA,QAAQ,CAAC,QAAQ,CAAC,mCAAI,EAAE,CAAC;IACtC,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;IAC1C,IAAI,OAAO,KAAK,SAAS,IAAI,IAAI,CAAC,SAAS,CAAC,KAAK,SAAS,EAAE,CAAC;QAC3D,OAAO;YACL,KAAK,EAAE,IAAI;YACX,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AC3E,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QACzE,CAAC,CAAE,KAAoB;QACvB,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC"}
@@ -0,0 +1,67 @@
1
+ /**
2
+ * What generated output needs from the workspace around it, stated as data so that every route can
3
+ * apply it with whatever it has: a filesystem, an Nx tree, or nothing but words.
4
+ *
5
+ * Every amendment is an "ensure this is present", never a "set this to". Applying one twice changes
6
+ * nothing, and a value the consumer already chose always wins.
7
+ */
8
+ export type Amendment = PostcssAmendment | BuildTargetAmendment | StylesheetSourceAmendment | ComposePluginAmendment;
9
+ /**
10
+ * An entry in a build target's `assets` array. Where the input is resolved from differs per entry
11
+ * and cannot be guessed: the project's own folder is named relative to the project, an installed
12
+ * package relative to the workspace.
13
+ */
14
+ export interface AssetGlob {
15
+ readonly glob: string;
16
+ readonly input: string;
17
+ readonly from: 'project' | 'workspace';
18
+ readonly output?: string;
19
+ }
20
+ /**
21
+ * The style pipeline the generated stylesheet needs. Without it the stylesheet is read as plain CSS,
22
+ * which emits no utility class at all and leaves the workbench unstyled without failing the build.
23
+ */
24
+ export interface PostcssAmendment {
25
+ readonly kind: 'postcss';
26
+ /** Resolved against the workspace root, not the generated project. */
27
+ readonly file: '.postcssrc.json';
28
+ readonly plugin: string;
29
+ }
30
+ /** What the application's build target needs so the generated product runs as it was built. */
31
+ export interface BuildTargetAmendment {
32
+ readonly kind: 'build-target';
33
+ /** Project-relative, because a build target names its stylesheet the way its workspace does. */
34
+ readonly styles: readonly string[];
35
+ readonly assets: readonly AssetGlob[];
36
+ readonly serviceWorker?: string;
37
+ /**
38
+ * False here is not a preference. The generated document ships a strict `script-src 'self'`, and
39
+ * the critical-CSS pass loads the stylesheet with an inline `onload` that the policy blocks, so a
40
+ * release build renders completely unstyled while reporting success.
41
+ */
42
+ readonly inlineCritical?: boolean;
43
+ }
44
+ /** A source directory the entry stylesheet must name, or its utilities are never emitted. */
45
+ export interface StylesheetSourceAmendment {
46
+ readonly kind: 'stylesheet-source';
47
+ /**
48
+ * Workspace-relative, because only the route applying this knows where the entry stylesheet sits,
49
+ * and `@source` is resolved from that stylesheet rather than from the workspace root.
50
+ */
51
+ readonly sourceRoot: string;
52
+ }
53
+ /**
54
+ * A generated plugin the distribution must register, or none of its contributions ever appear. The
55
+ * receiving file is generated too, which is the only reason composing into it is safe: where it no
56
+ * longer presents that shape, the route names these lines instead of guessing at the consumer's code.
57
+ */
58
+ export interface ComposePluginAmendment {
59
+ readonly kind: 'compose-plugin';
60
+ readonly id: string;
61
+ /** The symbol the plugin's own entry point exports. */
62
+ readonly symbol: string;
63
+ /** Exactly what the plugin's manifest declares; the broker is default-deny. */
64
+ readonly capabilities: readonly string[];
65
+ /** Workspace-relative, because only the applying route knows where the composition root sits. */
66
+ readonly sourceRoot: string;
67
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../../libs/tooling/devkit/src/lib/amend/types.ts"],"names":[],"mappings":""}