@loomweaver/devkit 0.9.0 → 0.9.1
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.
- package/README.md +1 -1
- package/package.json +1 -1
- package/src/generators/auth-source/generator.js +43 -2
- package/src/generators/auth-source/generator.js.map +1 -1
- package/src/generators/auth-source/schema.json +10 -1
- package/src/index.d.ts +3 -2
- package/src/index.js +4 -3
- package/src/index.js.map +1 -1
- package/src/lib/amend/compose.d.ts +1 -0
- package/src/lib/amend/compose.js +57 -10
- package/src/lib/amend/compose.js.map +1 -1
- package/src/lib/amend/describe.js +2 -1
- package/src/lib/amend/describe.js.map +1 -1
- package/src/lib/amend/types.d.ts +23 -0
- package/src/lib/scaffolds/scaffolds.d.ts +0 -9
- package/src/lib/scaffolds/scaffolds.js +19 -47
- package/src/lib/scaffolds/scaffolds.js.map +1 -1
- package/src/lib/scaffolds/surface.d.ts +10 -0
- package/src/lib/scaffolds/surface.js +49 -0
- package/src/lib/scaffolds/surface.js.map +1 -0
- package/src/recipes/angular-distribution/amendments.js +6 -0
- package/src/recipes/angular-distribution/amendments.js.map +1 -1
- package/src/recipes/angular-weaver/agent-files.d.ts +1 -1
- package/src/recipes/angular-weaver/agent-files.js +1 -1
- package/src/recipes/auth-source/recipe-amendments.d.ts +3 -0
- package/src/recipes/auth-source/recipe-amendments.js +52 -0
- package/src/recipes/auth-source/recipe-amendments.js.map +1 -0
- package/src/recipes/auth-source/recipe.d.ts +4 -0
- package/src/recipes/auth-source/recipe.js +172 -2
- package/src/recipes/auth-source/recipe.js.map +1 -1
- package/src/recipes/platform-version.d.ts +1 -0
- package/src/recipes/platform-version.js +5 -0
- package/src/recipes/platform-version.js.map +1 -0
package/README.md
CHANGED
|
@@ -106,7 +106,7 @@ The platform ships local/anonymous defaults; the product implements two frontend
|
|
|
106
106
|
own backend. Scaffold either into a distribution's `src/`:
|
|
107
107
|
|
|
108
108
|
```sh
|
|
109
|
-
nx g @loomweaver/devkit:auth-source --name=dev --app=acme-studio #
|
|
109
|
+
nx g @loomweaver/devkit:auth-source --name=dev --app=acme-studio # a stand-in session: AuthSource + the verbs in the rail; --bare for the source alone
|
|
110
110
|
nx g @loomweaver/devkit:settings-store --name=backend --app=acme-studio # backend-backed settings store
|
|
111
111
|
```
|
|
112
112
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loomweaver/devkit",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.1",
|
|
4
4
|
"description": "LoomWeaver: open-source plugin platform for Angular workbenches. The Nx generators: weavers, distributions, frame plugins and the integration seams, plus the manifest and i18n validators.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"loomweaver",
|
|
@@ -2,13 +2,54 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.authSourceGenerator = authSourceGenerator;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const compose_1 = require("../../lib/amend/compose");
|
|
5
6
|
const generate_1 = require("../../lib/generate/generate");
|
|
7
|
+
const recipe_amendments_1 = require("../../recipes/auth-source/recipe-amendments");
|
|
6
8
|
const recipe_1 = require("../../recipes/auth-source/recipe");
|
|
7
9
|
const shared_1 = require("../shared");
|
|
8
10
|
async function authSourceGenerator(tree, options) {
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
+
const app = (0, shared_1.resolveApp)(tree, options.app);
|
|
12
|
+
const root = options.directory ?? `${app.root}/src/auth`;
|
|
13
|
+
const input = { name: options.name, bare: options.bare };
|
|
14
|
+
(0, shared_1.writeFilesGuarded)(tree, root, (0, generate_1.generate)(recipe_1.authSource, input));
|
|
15
|
+
for (const amendment of (0, recipe_amendments_1.authSourceAmendments)(input, root)) {
|
|
16
|
+
if (amendment.kind === 'build-target') {
|
|
17
|
+
for (const asset of amendment.assets) {
|
|
18
|
+
(0, shared_1.addI18nAssetsGlob)(tree, app.name, {
|
|
19
|
+
input: asset.input,
|
|
20
|
+
output: asset.output ?? '',
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
else if (amendment.kind === 'compose-plugin') {
|
|
25
|
+
composeIntoApp(tree, app.root, root, amendment);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
11
28
|
await (0, devkit_1.formatFiles)(tree);
|
|
12
29
|
}
|
|
30
|
+
function composeIntoApp(tree, appRoot, sourceRoot, amendment) {
|
|
31
|
+
const config = `${appRoot}/src/app/app.config.ts`;
|
|
32
|
+
const source = tree.read(config, 'utf8');
|
|
33
|
+
if (source === null) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const importPath = relativeImport(`${appRoot}/src/app`, sourceRoot);
|
|
37
|
+
const result = (0, compose_1.composePlugin)(source, amendment, importPath);
|
|
38
|
+
if (result.composed && result.source !== source) {
|
|
39
|
+
tree.write(config, result.source);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function relativeImport(fromDir, toDir) {
|
|
43
|
+
const from = fromDir.split('/').filter(Boolean);
|
|
44
|
+
const to = toDir.split('/').filter(Boolean);
|
|
45
|
+
let shared = 0;
|
|
46
|
+
while (shared < from.length && shared < to.length && from[shared] === to[shared]) {
|
|
47
|
+
shared += 1;
|
|
48
|
+
}
|
|
49
|
+
const up = from.slice(shared).map(() => '..');
|
|
50
|
+
const down = to.slice(shared);
|
|
51
|
+
const parts = [...up, ...down];
|
|
52
|
+
return parts.length === 0 ? '.' : (parts[0] === '..' ? parts : ['.', ...parts]).join('/');
|
|
53
|
+
}
|
|
13
54
|
exports.default = authSourceGenerator;
|
|
14
55
|
//# sourceMappingURL=generator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../../libs/tooling/devkit/src/generators/auth-source/generator.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../../libs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KAAK,GAAG,CAAC,GAAG,EAAE,EAAE,GAAG,IAAI,CAAC,CAAC;IAC/B,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC5F,CAAC;AAED,kBAAe,mBAAmB,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/schema",
|
|
3
3
|
"$id": "LoomWeaverAuthSource",
|
|
4
|
-
"title": "Scaffold a
|
|
4
|
+
"title": "Scaffold a stand-in session a user can operate: the AuthSource, the sign-in, switch and sign-out verbs in the rail, composed in",
|
|
5
5
|
"type": "object",
|
|
6
6
|
"properties": {
|
|
7
7
|
"name": {
|
|
@@ -9,9 +9,18 @@
|
|
|
9
9
|
"description": "Source name in kebab-case, e.g. 'dev'.",
|
|
10
10
|
"pattern": "^[a-z][a-z0-9]*(-[a-z0-9]+)*$"
|
|
11
11
|
},
|
|
12
|
+
"bare": {
|
|
13
|
+
"type": "boolean",
|
|
14
|
+
"description": "Write the AuthSource alone, without the verbs, for a product that maps a session of its own onto it.",
|
|
15
|
+
"default": false
|
|
16
|
+
},
|
|
12
17
|
"app": {
|
|
13
18
|
"type": "string",
|
|
14
19
|
"description": "Application to drop into. Inferred when the workspace has exactly one."
|
|
20
|
+
},
|
|
21
|
+
"directory": {
|
|
22
|
+
"type": "string",
|
|
23
|
+
"description": "Where the files land, relative to the workspace root."
|
|
15
24
|
}
|
|
16
25
|
},
|
|
17
26
|
"required": ["name"]
|
package/src/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export type { FileMap, Recipe } from './lib/generate/types';
|
|
2
2
|
export { amendments, generate } from './lib/generate/generate';
|
|
3
|
-
export type { Amendment, AssetGlob, ComposePluginAmendment, BuildTargetAmendment, PackageAmendment, PostcssAmendment, StylesheetSourceAmendment, } from './lib/amend/types';
|
|
3
|
+
export type { Amendment, AssetGlob, ComposePluginAmendment, BuildTargetAmendment, PackageAmendment, PostcssAmendment, StylesheetSourceAmendment, ImportedSymbols, ProviderLine, } from './lib/amend/types';
|
|
4
4
|
export { ensureBuildTarget, ensureDependency, ensurePostcssPlugin, ensureStylesheetSource, joinProjectPath, resolveAssetInput, type MergeResult, } from './lib/amend/merge';
|
|
5
5
|
export { composeLines, composePlugin, type ComposeResult, } from './lib/amend/compose';
|
|
6
6
|
export { describeAmendment } from './lib/amend/describe';
|
|
@@ -12,7 +12,8 @@ export { authSource, resolveAuthSourceInput, type AuthSourceInput, type Resolved
|
|
|
12
12
|
export { settingsStore, resolveSettingsStoreInput, type SettingsStoreInput, type ResolvedSettingsStore, } from './recipes/settings-store/recipe';
|
|
13
13
|
export { theme, resolveThemeInput, type ThemeInput, type ResolvedTheme, } from './recipes/theme/recipe';
|
|
14
14
|
export { layout, resolveLayoutInput, type LayoutInput, type ResolvedLayout, } from './recipes/layout/recipe';
|
|
15
|
-
export { SCAFFOLDS, findScaffold, kebabCase,
|
|
15
|
+
export { SCAFFOLDS, findScaffold, kebabCase, type ScaffoldDescriptor, type ScaffoldOption, type ScaffoldValues, } from './lib/scaffolds/scaffolds';
|
|
16
|
+
export { nxSchemaFor, portableOptions, usageFor } from './lib/scaffolds/surface';
|
|
16
17
|
export type { Finding, FindingLevel } from './lib/validate/types';
|
|
17
18
|
export { validateManifest, KNOWN_CAPABILITIES, type ManifestLike, } from './lib/validate/manifest';
|
|
18
19
|
export { validateI18nParity, type I18nBundle } from './lib/validate/i18n';
|
package/src/index.js
CHANGED
|
@@ -46,9 +46,10 @@ var scaffolds_1 = require("./lib/scaffolds/scaffolds");
|
|
|
46
46
|
Object.defineProperty(exports, "SCAFFOLDS", { enumerable: true, get: function () { return scaffolds_1.SCAFFOLDS; } });
|
|
47
47
|
Object.defineProperty(exports, "findScaffold", { enumerable: true, get: function () { return scaffolds_1.findScaffold; } });
|
|
48
48
|
Object.defineProperty(exports, "kebabCase", { enumerable: true, get: function () { return scaffolds_1.kebabCase; } });
|
|
49
|
-
|
|
50
|
-
Object.defineProperty(exports, "
|
|
51
|
-
Object.defineProperty(exports, "
|
|
49
|
+
var surface_1 = require("./lib/scaffolds/surface");
|
|
50
|
+
Object.defineProperty(exports, "nxSchemaFor", { enumerable: true, get: function () { return surface_1.nxSchemaFor; } });
|
|
51
|
+
Object.defineProperty(exports, "portableOptions", { enumerable: true, get: function () { return surface_1.portableOptions; } });
|
|
52
|
+
Object.defineProperty(exports, "usageFor", { enumerable: true, get: function () { return surface_1.usageFor; } });
|
|
52
53
|
var manifest_1 = require("./lib/validate/manifest");
|
|
53
54
|
Object.defineProperty(exports, "validateManifest", { enumerable: true, get: function () { return manifest_1.validateManifest; } });
|
|
54
55
|
Object.defineProperty(exports, "KNOWN_CAPABILITIES", { enumerable: true, get: function () { return manifest_1.KNOWN_CAPABILITIES; } });
|
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,oDAA+D;AAAtD,sGAAA,UAAU,OAAA;AAAE,oGAAA,QAAQ,OAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/tooling/devkit/src/index.ts"],"names":[],"mappings":";;;AACA,oDAA+D;AAAtD,sGAAA,UAAU,OAAA;AAAE,oGAAA,QAAQ,OAAA;AAY7B,2CAQ2B;AAPzB,0GAAA,iBAAiB,OAAA;AACjB,yGAAA,gBAAgB,OAAA;AAChB,4GAAA,mBAAmB,OAAA;AACnB,+GAAA,sBAAsB,OAAA;AACtB,wGAAA,eAAe,OAAA;AACf,0GAAA,iBAAiB,OAAA;AAGnB,+CAI6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2
2
|
export interface ComposeResult {
|
|
3
3
|
readonly source: string;
|
|
4
4
|
readonly composed: boolean;
|
|
5
|
+
readonly kept: readonly string[];
|
|
5
6
|
}
|
|
6
7
|
/**
|
|
7
8
|
* Registers a generated plugin in a composition root we generated ourselves. Recognition is the
|
package/src/lib/amend/compose.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.composePlugin = composePlugin;
|
|
4
4
|
exports.composeLines = composeLines;
|
|
5
5
|
const APP_CONFIG = /export\s+const\s+appConfig\s*:[^=]*=\s*\{/;
|
|
6
|
+
const NAMESPACES = /provideTranslationNamespaces\(([^)]*)\)/;
|
|
6
7
|
const PROVIDERS_OPEN = /providers\s*:\s*\[/g;
|
|
7
8
|
const SHELL_IMPORT = /import\s*\{([^}]*)\}\s*from\s*'@loomweaver\/shell';/;
|
|
8
9
|
function closingLine(source, from) {
|
|
@@ -37,34 +38,79 @@ function providersBlock(source) {
|
|
|
37
38
|
*/
|
|
38
39
|
function composePlugin(source, amendment, importPath) {
|
|
39
40
|
if (source.includes(amendment.symbol)) {
|
|
40
|
-
return { source, composed: true };
|
|
41
|
+
return { source, composed: true, kept: [] };
|
|
41
42
|
}
|
|
42
43
|
const shellImport = SHELL_IMPORT.exec(source);
|
|
43
44
|
if (!shellImport || !providersBlock(source)) {
|
|
44
|
-
return { source, composed: false };
|
|
45
|
+
return { source, composed: false, kept: [] };
|
|
45
46
|
}
|
|
46
|
-
const
|
|
47
|
-
const
|
|
47
|
+
const wanted = providersToAdd(source, amendment);
|
|
48
|
+
const ownSymbols = [amendment.symbol, ...wanted.flatMap((provider) => provider.own ?? [])];
|
|
49
|
+
const foreign = wanted.flatMap((provider) => provider.from ?? []);
|
|
50
|
+
const withImports = source.replace(SHELL_IMPORT, () => [
|
|
51
|
+
`import {${withShellSymbols(shellImport[1], wanted)}} from '@loomweaver/shell';`,
|
|
52
|
+
...foreign.map((entry) => `import { ${[...entry.symbols].toSorted((a, b) => a.localeCompare(b)).join(', ')} } from '${entry.path}';`),
|
|
53
|
+
`import { ${ownSymbols.toSorted((a, b) => a.localeCompare(b)).join(', ')} } from '${importPath}';`,
|
|
54
|
+
].join('\n'));
|
|
55
|
+
const joined = joinNamespaces(withImports, amendment.id);
|
|
56
|
+
const block = providersBlock(joined.source);
|
|
48
57
|
if (!block) {
|
|
49
|
-
return { source, composed: false };
|
|
58
|
+
return { source, composed: false, kept: [] };
|
|
50
59
|
}
|
|
51
60
|
const indent = `${block.indent} `;
|
|
52
61
|
const lines = [
|
|
53
|
-
`${indent}
|
|
62
|
+
...wanted.map((provider) => `${indent}${provider.line}`),
|
|
63
|
+
...(joined.joined ? [] : [`${indent}provideTranslationNamespaces('${amendment.id}'),`]),
|
|
54
64
|
`${indent}provideCapabilityGrants({ ${amendment.id}: [${amendment.capabilities
|
|
55
65
|
.map((capability) => `'${capability}'`)
|
|
56
66
|
.join(', ')}] }),`,
|
|
57
67
|
`${indent}...providePlugins(${amendment.symbol}),`,
|
|
58
68
|
].join('\n');
|
|
59
69
|
return {
|
|
60
|
-
source: `${
|
|
70
|
+
source: `${joined.source.slice(0, block.insertAt)}\n${lines}${joined.source.slice(block.insertAt)}`,
|
|
61
71
|
composed: true,
|
|
72
|
+
kept: keptProviders(source, amendment).map((provider) => provider.line),
|
|
62
73
|
};
|
|
63
74
|
}
|
|
75
|
+
function joinNamespaces(source, id) {
|
|
76
|
+
const existing = NAMESPACES.exec(source);
|
|
77
|
+
if (!existing) {
|
|
78
|
+
return { source, joined: false };
|
|
79
|
+
}
|
|
80
|
+
const names = existing[1]
|
|
81
|
+
.split(',')
|
|
82
|
+
.map((name) => name.trim())
|
|
83
|
+
.filter(Boolean);
|
|
84
|
+
if (names.includes(`'${id}'`)) {
|
|
85
|
+
return { source, joined: true };
|
|
86
|
+
}
|
|
87
|
+
return {
|
|
88
|
+
source: source.replace(NAMESPACES, () => `provideTranslationNamespaces(${[...names, `'${id}'`].join(', ')})`),
|
|
89
|
+
joined: true,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
function providersToAdd(source, amendment) {
|
|
93
|
+
return (amendment.providers ?? []).filter((provider) => !(provider.unless && source.includes(provider.unless)));
|
|
94
|
+
}
|
|
95
|
+
function keptProviders(source, amendment) {
|
|
96
|
+
return (amendment.providers ?? []).filter((provider) => provider.unless !== undefined && source.includes(provider.unless));
|
|
97
|
+
}
|
|
64
98
|
function composeLines(amendment, importPath) {
|
|
99
|
+
const providers = amendment.providers ?? [];
|
|
100
|
+
const own = [amendment.symbol, ...providers.flatMap((provider) => provider.own ?? [])];
|
|
101
|
+
const shell = [
|
|
102
|
+
'providePlugins',
|
|
103
|
+
'provideCapabilityGrants',
|
|
104
|
+
'provideTranslationNamespaces',
|
|
105
|
+
...providers.flatMap((provider) => provider.shell ?? []),
|
|
106
|
+
];
|
|
65
107
|
return [
|
|
66
|
-
`import { ${
|
|
67
|
-
|
|
108
|
+
`import { ${own.join(', ')} } from '${importPath}';`,
|
|
109
|
+
`import { ${shell.join(', ')} } from '@loomweaver/shell';`,
|
|
110
|
+
...providers
|
|
111
|
+
.flatMap((provider) => provider.from ?? [])
|
|
112
|
+
.map((entry) => `import { ${entry.symbols.join(', ')} } from '${entry.path}';`),
|
|
113
|
+
...providers.map((provider) => provider.line),
|
|
68
114
|
`provideTranslationNamespaces('${amendment.id}'),`,
|
|
69
115
|
`provideCapabilityGrants({ ${amendment.id}: [${amendment.capabilities
|
|
70
116
|
.map((capability) => `'${capability}'`)
|
|
@@ -72,11 +118,12 @@ function composeLines(amendment, importPath) {
|
|
|
72
118
|
`...providePlugins(${amendment.symbol}),`,
|
|
73
119
|
];
|
|
74
120
|
}
|
|
75
|
-
function withShellSymbols(existing) {
|
|
121
|
+
function withShellSymbols(existing, providers) {
|
|
76
122
|
const wanted = [
|
|
77
123
|
'provideCapabilityGrants',
|
|
78
124
|
'providePlugins',
|
|
79
125
|
'provideTranslationNamespaces',
|
|
126
|
+
...providers.flatMap((provider) => provider.shell ?? []),
|
|
80
127
|
];
|
|
81
128
|
const present = existing
|
|
82
129
|
.split(',')
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compose.js","sourceRoot":"","sources":["../../../../../../../libs/tooling/devkit/src/lib/amend/compose.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"compose.js","sourceRoot":"","sources":["../../../../../../../libs/tooling/devkit/src/lib/amend/compose.ts"],"names":[],"mappings":";;AAkDA,sCA6CC;AA4CD,oCAyBC;AA5JD,MAAM,UAAU,GAAG,2CAA2C,CAAC;AAC/D,MAAM,UAAU,GAAG,yCAAyC,CAAC;AAC7D,MAAM,cAAc,GAAG,qBAAqB,CAAC;AAC7C,MAAM,YAAY,GAAG,qDAAqD,CAAC;AAO3E,SAAS,WAAW,CAAC,MAAc,EAAE,IAAY;IAC/C,IAAI,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACvC,OAAO,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC;QACpB,IAAI,KAAK,GAAG,KAAK,CAAC;QAClB,OAAO,KAAK,GAAG,IAAI,IAAI,MAAM,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;YAC9D,KAAK,IAAI,CAAC,CAAC;QACb,CAAC;QACD,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QACvC,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAClC,IAAI,OAAO,KAAK,CAAC,CAAC,EAAE,CAAC;YACnB,OAAO,EAAE,QAAQ,EAAE,KAAK,GAAG,OAAO,EAAE,MAAM,EAAE,GAAG,CAAC,KAAK,CAAC,OAAO,GAAG,CAAC,CAAC,EAAE,CAAC;QACvE,CAAC;QACD,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,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AAM,CAAC,IAAI,EAAE,CAAC;SAC9B,MAAM,CAAC,OAAO,CAAC,CAAC;IACnB,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAC3B,CAAC,MAAM,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,KAAK,MAAM,CAAC,CAC/E,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,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5E,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"}
|
|
@@ -17,7 +17,8 @@ function describeAmendment(amendment) {
|
|
|
17
17
|
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.`;
|
|
18
18
|
}
|
|
19
19
|
if (amendment.kind === 'compose-plugin') {
|
|
20
|
-
|
|
20
|
+
const providers = (amendment.providers ?? []).map((provider) => provider.line.replace(/,$/, ''));
|
|
21
|
+
return `Register ${amendment.id} in the composition root: import { ${amendment.symbol} }, ${providers.map((line) => `${line}, `).join('')}provideTranslationNamespaces('${amendment.id}'), provideCapabilityGrants({ ${amendment.id}: [${amendment.capabilities
|
|
21
22
|
.map((capability) => `'${capability}'`)
|
|
22
23
|
.join(', ')}] }) and ...providePlugins(${amendment.symbol}). Without it none of its contributions appear.`;
|
|
23
24
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"describe.js","sourceRoot":"","sources":["../../../../../../../libs/tooling/devkit/src/lib/amend/describe.ts"],"names":[],"mappings":";;AAOA,
|
|
1
|
+
{"version":3,"file":"describe.js","sourceRoot":"","sources":["../../../../../../../libs/tooling/devkit/src/lib/amend/describe.ts"],"names":[],"mappings":";;AAOA,8CA4CC;AAjDD;;;;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,SAAS,EAAE,CAAC;QACjC,OAAO,OAAO,SAAS,CAAC,IAAI,IAAI,SAAS,CAAC,OAAO,mJAAmJ,CAAC;IACvM,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,KAAK,gBAAgB,EAAE,CAAC;QACxC,MAAM,SAAS,GAAG,CAAC,SAAS,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC;QACjG,OAAO,YAAY,SAAS,CAAC,EAAE,sCAAsC,SAAS,CAAC,MAAM,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,iCAAiC,SAAS,CAAC,EAAE,iCAAiC,SAAS,CAAC,EAAE,MAAM,SAAS,CAAC,YAAY;aAC5P,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,IAAI,UAAU,GAAG,CAAC;aACtC,IAAI,CACH,IAAI,CACL,8BAA8B,SAAS,CAAC,MAAM,iDAAiD,CAAC;IACrG,CAAC;IACD,OAAO;QACL,GAAG,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC;YAC7B,CAAC,CAAC,CAAC,QAAQ,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC;YACnD,CAAC,CAAC,EAAE,CAAC;QACP,GAAG,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC;YAC7B,CAAC,CAAC;gBACE,kBAAkB,SAAS,CAAC,MAAM;qBAC/B,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC;qBAC3B,IAAI,CACH,IAAI,CACL,oIAAoI;aACxI;YACH,CAAC,CAAC,EAAE,CAAC;QACP,GAAG,CAAC,SAAS,CAAC,aAAa;YACzB,CAAC,CAAC;gBACE,wBAAwB,SAAS,CAAC,aAAa,wFAAwF;aACxI;YACH,CAAC,CAAC,EAAE,CAAC;QACP,GAAG,CAAC,SAAS,CAAC,cAAc,KAAK,SAAS;YACxC,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC;gBACE,6CAA6C,SAAS,CAAC,cAAc,8KAA8K;aACpP,CAAC;KACP;SACE,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,GAAG,KAAK,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC;SAC7C,IAAI,CAAC,GAAG,CAAC,CAAC;AACf,CAAC"}
|
package/src/lib/amend/types.d.ts
CHANGED
|
@@ -64,6 +64,29 @@ export interface ComposePluginAmendment {
|
|
|
64
64
|
readonly capabilities: readonly string[];
|
|
65
65
|
/** Workspace-relative, because only the applying route knows where the composition root sits. */
|
|
66
66
|
readonly sourceRoot: string;
|
|
67
|
+
/** Provider lines the plugin needs beside its own registration, ensured in the same array. */
|
|
68
|
+
readonly providers?: readonly ProviderLine[];
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* One provider line composed beside a plugin, with the imports it needs. A line whose `unless`
|
|
72
|
+
* marker is already in the file is kept as the consumer wrote it and reported, never doubled: in
|
|
73
|
+
* Angular the last provider wins, so a second `provideAuthSource` would silently replace a real one.
|
|
74
|
+
*/
|
|
75
|
+
export interface ProviderLine {
|
|
76
|
+
/** The line as it goes into the providers array, trailing comma included. */
|
|
77
|
+
readonly line: string;
|
|
78
|
+
/** Symbols the line needs from the shell. */
|
|
79
|
+
readonly shell?: readonly string[];
|
|
80
|
+
/** Symbols the line needs from the plugin's own entry point. */
|
|
81
|
+
readonly own?: readonly string[];
|
|
82
|
+
/** Symbols the line needs from other packages. */
|
|
83
|
+
readonly from?: readonly ImportedSymbols[];
|
|
84
|
+
/** Text whose presence means the file already carries what this line provides. */
|
|
85
|
+
readonly unless?: string;
|
|
86
|
+
}
|
|
87
|
+
export interface ImportedSymbols {
|
|
88
|
+
readonly path: string;
|
|
89
|
+
readonly symbols: readonly string[];
|
|
67
90
|
}
|
|
68
91
|
/**
|
|
69
92
|
* A package the generated files import and the consumer's project may not carry. Stated as a need
|
|
@@ -29,12 +29,3 @@ export declare function bool(values: ScaffoldValues, name: string): boolean | un
|
|
|
29
29
|
export declare function kebabCase(name: string): string;
|
|
30
30
|
export declare const SCAFFOLDS: readonly ScaffoldDescriptor[];
|
|
31
31
|
export declare function findScaffold(name: string): ScaffoldDescriptor | undefined;
|
|
32
|
-
/** The option surface an adapter that only produces files can offer. */
|
|
33
|
-
export declare function portableOptions(scaffold: ScaffoldDescriptor): readonly ScaffoldOption[];
|
|
34
|
-
/**
|
|
35
|
-
* The JSON Schema an Nx generator loads. Nx reads it from disk before any of our code runs, so the
|
|
36
|
-
* file cannot be computed at call time — instead it is checked against this shape by a test, which
|
|
37
|
-
* fails the moment the two drift apart.
|
|
38
|
-
*/
|
|
39
|
-
export declare function nxSchemaFor(scaffold: ScaffoldDescriptor): Record<string, unknown>;
|
|
40
|
-
export declare function usageFor(scaffold: ScaffoldDescriptor): string;
|
|
@@ -5,11 +5,9 @@ exports.str = str;
|
|
|
5
5
|
exports.bool = bool;
|
|
6
6
|
exports.kebabCase = kebabCase;
|
|
7
7
|
exports.findScaffold = findScaffold;
|
|
8
|
-
exports.portableOptions = portableOptions;
|
|
9
|
-
exports.nxSchemaFor = nxSchemaFor;
|
|
10
|
-
exports.usageFor = usageFor;
|
|
11
8
|
const recipe_1 = require("../../recipes/angular-distribution/recipe");
|
|
12
9
|
const amendments_1 = require("../../recipes/angular-weaver/amendments");
|
|
10
|
+
const recipe_amendments_1 = require("../../recipes/auth-source/recipe-amendments");
|
|
13
11
|
const recipe_2 = require("../../recipes/angular-weaver/recipe");
|
|
14
12
|
const recipe_3 = require("../../recipes/auth-source/recipe");
|
|
15
13
|
const recipe_4 = require("../../recipes/layout/recipe");
|
|
@@ -67,6 +65,9 @@ const APP_OPTION = {
|
|
|
67
65
|
description: 'Application to drop into. Inferred when the workspace has exactly one.',
|
|
68
66
|
workspaceOnly: true,
|
|
69
67
|
};
|
|
68
|
+
function authSourceInput(values) {
|
|
69
|
+
return { name: str(values, 'name') ?? '', bare: bool(values, 'bare') };
|
|
70
|
+
}
|
|
70
71
|
exports.SCAFFOLDS = [
|
|
71
72
|
{
|
|
72
73
|
name: 'weaver',
|
|
@@ -224,7 +225,7 @@ exports.SCAFFOLDS = [
|
|
|
224
225
|
},
|
|
225
226
|
{
|
|
226
227
|
name: 'auth-source',
|
|
227
|
-
summary: 'a
|
|
228
|
+
summary: 'a stand-in session a user can operate: the AuthSource, the sign-in, switch and sign-out verbs in the rail, composed in',
|
|
228
229
|
options: [
|
|
229
230
|
{
|
|
230
231
|
name: 'name',
|
|
@@ -233,9 +234,22 @@ exports.SCAFFOLDS = [
|
|
|
233
234
|
required: true,
|
|
234
235
|
pattern: ID_PATTERN,
|
|
235
236
|
},
|
|
237
|
+
{
|
|
238
|
+
name: 'bare',
|
|
239
|
+
type: 'boolean',
|
|
240
|
+
description: 'Write the AuthSource alone, without the verbs, for a product that maps a session of its own onto it.',
|
|
241
|
+
default: false,
|
|
242
|
+
},
|
|
236
243
|
APP_OPTION,
|
|
244
|
+
{
|
|
245
|
+
name: 'directory',
|
|
246
|
+
type: 'string',
|
|
247
|
+
description: 'Where the files land, relative to the workspace root.',
|
|
248
|
+
workspaceOnly: true,
|
|
249
|
+
},
|
|
237
250
|
],
|
|
238
|
-
build: (values) => (0, generate_1.generate)(recipe_3.authSource,
|
|
251
|
+
build: (values) => (0, generate_1.generate)(recipe_3.authSource, authSourceInput(values)),
|
|
252
|
+
amend: (values) => (0, recipe_amendments_1.authSourceAmendments)(authSourceInput(values), str(values, 'directory')),
|
|
239
253
|
},
|
|
240
254
|
{
|
|
241
255
|
name: 'settings-store',
|
|
@@ -294,46 +308,4 @@ exports.SCAFFOLDS = [
|
|
|
294
308
|
function findScaffold(name) {
|
|
295
309
|
return exports.SCAFFOLDS.find((scaffold) => scaffold.name === name);
|
|
296
310
|
}
|
|
297
|
-
/** The option surface an adapter that only produces files can offer. */
|
|
298
|
-
function portableOptions(scaffold) {
|
|
299
|
-
return scaffold.options.filter((option) => !option.workspaceOnly);
|
|
300
|
-
}
|
|
301
|
-
/**
|
|
302
|
-
* The JSON Schema an Nx generator loads. Nx reads it from disk before any of our code runs, so the
|
|
303
|
-
* file cannot be computed at call time — instead it is checked against this shape by a test, which
|
|
304
|
-
* fails the moment the two drift apart.
|
|
305
|
-
*/
|
|
306
|
-
function nxSchemaFor(scaffold) {
|
|
307
|
-
const properties = {};
|
|
308
|
-
for (const option of scaffold.options) {
|
|
309
|
-
properties[option.name] = {
|
|
310
|
-
type: option.type,
|
|
311
|
-
description: option.description,
|
|
312
|
-
...(option.pattern && { pattern: option.pattern }),
|
|
313
|
-
...(option.choices && { enum: option.choices }),
|
|
314
|
-
...(option.default !== undefined && { default: option.default }),
|
|
315
|
-
};
|
|
316
|
-
}
|
|
317
|
-
return {
|
|
318
|
-
$schema: 'https://json-schema.org/schema',
|
|
319
|
-
$id: `LoomWeaver${scaffold.name
|
|
320
|
-
.split('-')
|
|
321
|
-
.map((part) => part[0].toUpperCase() + part.slice(1))
|
|
322
|
-
.join('')}`,
|
|
323
|
-
title: `Scaffold ${scaffold.summary}`,
|
|
324
|
-
type: 'object',
|
|
325
|
-
properties,
|
|
326
|
-
required: scaffold.options
|
|
327
|
-
.filter((option) => option.required)
|
|
328
|
-
.map((option) => option.name),
|
|
329
|
-
};
|
|
330
|
-
}
|
|
331
|
-
function usageFor(scaffold) {
|
|
332
|
-
const parts = portableOptions(scaffold).map((option) => {
|
|
333
|
-
const flag = `--${kebabCase(option.name)}`;
|
|
334
|
-
const body = option.type === 'boolean' ? flag : `${flag} <${option.name}>`;
|
|
335
|
-
return option.required ? body : `[${body}]`;
|
|
336
|
-
});
|
|
337
|
-
return [scaffold.name, ...parts].join(' ');
|
|
338
|
-
}
|
|
339
311
|
//# sourceMappingURL=scaffolds.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scaffolds.js","sourceRoot":"","sources":["../../../../../../../libs/tooling/devkit/src/lib/scaffolds/scaffolds.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"scaffolds.js","sourceRoot":"","sources":["../../../../../../../libs/tooling/devkit/src/lib/scaffolds/scaffolds.ts"],"names":[],"mappings":";;;AA0CA,kBAGC;AAED,oBAMC;AAGD,8BAEC;AAqTD,oCAEC;AAjXD,sEAAgF;AAChF,wEAA2E;AAC3E,mFAAmF;AACnF,gEAAoE;AACpE,6DAAoF;AACpF,wDAAqD;AACrD,8DAAgE;AAChE,gEAAoE;AACpE,uDAAqE;AAErE,mDAA4D;AAE5D,qCAA0D;AA8B1D,SAAgB,GAAG,CAAC,MAAsB,EAAE,IAAY;IACtD,MAAM,KAAK,GAAG,MAAM,C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U;aACpB;YACD;gBACE,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,WAAW,EACT,2LAA2L;gBAC7L,OAAO,EAAE,CAAC,SAAS,EAAE,WAAW,CAAC;gBACjC,OAAO,EAAE,SAAS;aACnB;YACD,UAAU;SACX;QACD,KAAK,EAAE,CAAC,MAAM,EAAE,EAAE,CAChB,IAAA,mBAAQ,EAAC,cAAK,EAAE;YACd,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,IAAI,EAAE;YAC/B,MAAM,EAAG,GAAG,CAAC,MAAM,EAAE,QAAQ,CAA6B,IAAI,SAAS;SACxE,CAAC;KACL;IACD;QACE,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,iDAAiD;QAC1D,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,yCAAyC;aACvD;YACD,UAAU;SACX;QACD,KAAK,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,IAAA,mBAAQ,EAAC,eAAM,EAAE,EAAE,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;KACnE;CACF,CAAC;AAEF,SAAgB,YAAY,CAAC,IAAY;IACvC,OAAO,iBAAS,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;AAC9D,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ScaffoldDescriptor, ScaffoldOption } from './scaffolds';
|
|
2
|
+
/** The option surface an adapter that only produces files can offer. */
|
|
3
|
+
export declare function portableOptions(scaffold: ScaffoldDescriptor): readonly ScaffoldOption[];
|
|
4
|
+
/**
|
|
5
|
+
* The JSON Schema an Nx generator loads. Nx reads it from disk before any of our code runs, so the
|
|
6
|
+
* file cannot be computed at call time — instead it is checked against this shape by a test, which
|
|
7
|
+
* fails the moment the two drift apart.
|
|
8
|
+
*/
|
|
9
|
+
export declare function nxSchemaFor(scaffold: ScaffoldDescriptor): Record<string, unknown>;
|
|
10
|
+
export declare function usageFor(scaffold: ScaffoldDescriptor): string;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.portableOptions = portableOptions;
|
|
4
|
+
exports.nxSchemaFor = nxSchemaFor;
|
|
5
|
+
exports.usageFor = usageFor;
|
|
6
|
+
const scaffolds_1 = require("./scaffolds");
|
|
7
|
+
/** The option surface an adapter that only produces files can offer. */
|
|
8
|
+
function portableOptions(scaffold) {
|
|
9
|
+
return scaffold.options.filter((option) => !option.workspaceOnly);
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* The JSON Schema an Nx generator loads. Nx reads it from disk before any of our code runs, so the
|
|
13
|
+
* file cannot be computed at call time — instead it is checked against this shape by a test, which
|
|
14
|
+
* fails the moment the two drift apart.
|
|
15
|
+
*/
|
|
16
|
+
function nxSchemaFor(scaffold) {
|
|
17
|
+
const properties = {};
|
|
18
|
+
for (const option of scaffold.options) {
|
|
19
|
+
properties[option.name] = {
|
|
20
|
+
type: option.type,
|
|
21
|
+
description: option.description,
|
|
22
|
+
...(option.pattern && { pattern: option.pattern }),
|
|
23
|
+
...(option.choices && { enum: option.choices }),
|
|
24
|
+
...(option.default !== undefined && { default: option.default }),
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
return {
|
|
28
|
+
$schema: 'https://json-schema.org/schema',
|
|
29
|
+
$id: `LoomWeaver${scaffold.name
|
|
30
|
+
.split('-')
|
|
31
|
+
.map((part) => part[0].toUpperCase() + part.slice(1))
|
|
32
|
+
.join('')}`,
|
|
33
|
+
title: `Scaffold ${scaffold.summary}`,
|
|
34
|
+
type: 'object',
|
|
35
|
+
properties,
|
|
36
|
+
required: scaffold.options
|
|
37
|
+
.filter((option) => option.required)
|
|
38
|
+
.map((option) => option.name),
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function usageFor(scaffold) {
|
|
42
|
+
const parts = portableOptions(scaffold).map((option) => {
|
|
43
|
+
const flag = `--${(0, scaffolds_1.kebabCase)(option.name)}`;
|
|
44
|
+
const body = option.type === 'boolean' ? flag : `${flag} <${option.name}>`;
|
|
45
|
+
return option.required ? body : `[${body}]`;
|
|
46
|
+
});
|
|
47
|
+
return [scaffold.name, ...parts].join(' ');
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=surface.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"surface.js","sourceRoot":"","sources":["../../../../../../../libs/tooling/devkit/src/lib/scaffolds/surface.ts"],"names":[],"mappings":";;AAGA,0CAIC;AAOD,kCA0BC;AAED,4BAOC;AAjDD,2CAA4E;AAE5E,wEAAwE;AACxE,SAAgB,eAAe,CAC7B,QAA4B;IAE5B,OAAO,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;AACpE,CAAC;AAED;;;;GAIG;AACH,SAAgB,WAAW,CACzB,QAA4B;IAE5B,MAAM,UAAU,GAA4B,EAAE,CAAC;IAC/C,KAAK,MAAM,MAAM,IAAI,QAAQ,CAAC,OAAO,EAAE,CAAC;QACtC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG;YACxB,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,WAAW,EAAE,MAAM,CAAC,WAAW;YAC/B,GAAG,CAAC,MAAM,CAAC,OAAO,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC;YAClD,GAAG,CAAC,MAAM,CAAC,OAAO,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC;YAC/C,GAAG,CAAC,MAAM,CAAC,OAAO,KAAK,SAAS,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,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|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.distributionAmendments = distributionAmendments;
|
|
4
|
+
const platform_version_1 = require("../platform-version");
|
|
4
5
|
function distributionAmendments(d) {
|
|
5
6
|
return [
|
|
7
|
+
{
|
|
8
|
+
kind: 'package',
|
|
9
|
+
name: '@loomweaver/frame-kit',
|
|
10
|
+
version: `^${platform_version_1.PLATFORM_VERSION}`,
|
|
11
|
+
},
|
|
6
12
|
...(d.styles === 'tailwind'
|
|
7
13
|
? [
|
|
8
14
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"amendments.js","sourceRoot":"","sources":["../../../../../../../libs/tooling/devkit/src/recipes/angular-distribution/amendments.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"amendments.js","sourceRoot":"","sources":["../../../../../../../libs/tooling/devkit/src/recipes/angular-distribution/amendments.ts"],"names":[],"mappings":";;AAIA,wDAwCC;AA3CD,0DAAuD;AAGvD,SAAgB,sBAAsB,CACpC,CAAuB;IAEvB,OAAO;QACL;YACE,IAAI,EAAE,SAAkB;YACxB,IAAI,EAAE,uBAAuB;YAC7B,OAAO,EAAE,IAAI,mCAAgB,EAAE;SAChC;QACD,GAAG,CAAC,CAAC,CAAC,MAAM,KAAK,UAAU;YACzB,CAAC,CAAC;gBACE;oBACE,IAAI,EAAE,SAAkB;oBACxB,IAAI,EAAE,iBAA0B;oBAChC,MAAM,EAAE,sBAAsB;iBAC/B;aACF;YACH,CAAC,CAAC,EAAE,CAAC;QACP;YACE,IAAI,EAAE,cAAuB;YAC7B,MAAM,EAAE,CAAC,gBAAgB,CAAC;YAC1B,MAAM,EAAE;gBACN,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAkB,EAAE;gBAC3D;oBACE,IAAI,EAAE,MAAM;oBACZ,KAAK,EAAE,qCAAqC;oBAC5C,IAAI,EAAE,WAAoB;oBAC1B,MAAM,EAAE,MAAM;iBACf;gBACD;oBACE,IAAI,EAAE,MAAM;oBACZ,KAAK,EAAE,yCAAyC;oBAChD,IAAI,EAAE,WAAoB;oBAC1B,MAAM,EAAE,WAAW;iBACpB;aACF;YACD,aAAa,EAAE,kBAAkB;YACjC,cAAc,EAAE,KAAK;SACtB;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -6,7 +6,7 @@ import type { ResolvedWeaver } from './recipe';
|
|
|
6
6
|
* declares as a peer: two different ranges resolve to two copies, and an event built by one is not
|
|
7
7
|
* the event the other switches on. `check-agent-versions` fails the build when either drifts.
|
|
8
8
|
*/
|
|
9
|
-
export declare const AG_UI_ADAPTER_VERSION = "0.9.
|
|
9
|
+
export declare const AG_UI_ADAPTER_VERSION = "0.9.1";
|
|
10
10
|
export declare const AG_UI_PROTOCOL_VERSION = "0.0.x";
|
|
11
11
|
export declare function agentSurfaceBlock(w: ResolvedWeaver): string;
|
|
12
12
|
export declare function agentFiles(w: ResolvedWeaver): FileMap;
|
|
@@ -11,7 +11,7 @@ const agent_stand_in_1 = require("./agent-stand-in");
|
|
|
11
11
|
* declares as a peer: two different ranges resolve to two copies, and an event built by one is not
|
|
12
12
|
* the event the other switches on. `check-agent-versions` fails the build when either drifts.
|
|
13
13
|
*/
|
|
14
|
-
exports.AG_UI_ADAPTER_VERSION = '0.9.
|
|
14
|
+
exports.AG_UI_ADAPTER_VERSION = '0.9.1';
|
|
15
15
|
exports.AG_UI_PROTOCOL_VERSION = '0.0.x';
|
|
16
16
|
function connectionFile(w) {
|
|
17
17
|
return `import { signal } from '@angular/core';
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.authSourceAmendments = authSourceAmendments;
|
|
4
|
+
const merge_1 = require("../../lib/amend/merge");
|
|
5
|
+
const recipe_1 = require("./recipe");
|
|
6
|
+
function authSourceAmendments(input, where) {
|
|
7
|
+
const a = (0, recipe_1.resolveAuthSourceInput)(input);
|
|
8
|
+
const directory = (0, merge_1.normalizeProjectRoot)(where ?? '');
|
|
9
|
+
if (a.bare || !directory) {
|
|
10
|
+
return [];
|
|
11
|
+
}
|
|
12
|
+
return [
|
|
13
|
+
{
|
|
14
|
+
kind: 'build-target',
|
|
15
|
+
styles: [],
|
|
16
|
+
assets: [
|
|
17
|
+
{
|
|
18
|
+
glob: '**/*.json',
|
|
19
|
+
input: `${directory}/i18n`,
|
|
20
|
+
from: 'workspace',
|
|
21
|
+
output: `i18n/${recipe_1.SESSION_PLUGIN_ID}`,
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
kind: 'compose-plugin',
|
|
27
|
+
id: recipe_1.SESSION_PLUGIN_ID,
|
|
28
|
+
symbol: (0, recipe_1.sessionPluginSymbol)(a),
|
|
29
|
+
capabilities: ['contributions'],
|
|
30
|
+
sourceRoot: directory,
|
|
31
|
+
providers: [
|
|
32
|
+
{
|
|
33
|
+
line: `provideAuthSource(() => ${a.propertyName}AuthSource()),`,
|
|
34
|
+
shell: ['provideAuthSource'],
|
|
35
|
+
own: [`${a.propertyName}AuthSource`],
|
|
36
|
+
unless: 'provideAuthSource(',
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
line: 'provideIcons({ account: heroUserCircle, signOut: heroArrowRightStartOnRectangle }),',
|
|
40
|
+
shell: ['provideIcons'],
|
|
41
|
+
from: [
|
|
42
|
+
{
|
|
43
|
+
path: '@ng-icons/heroicons/outline',
|
|
44
|
+
symbols: ['heroArrowRightStartOnRectangle', 'heroUserCircle'],
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
},
|
|
50
|
+
];
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=recipe-amendments.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recipe-amendments.js","sourceRoot":"","sources":["../../../../../../../libs/tooling/devkit/src/recipes/auth-source/recipe-amendments.ts"],"names":[],"mappings":";;AASA,oDAgDC;AAxDD,iDAA6D;AAC7D,qCAKkB;AAElB,SAAgB,oBAAoB,CAClC,KAAsB,EACtB,KAAyB;IAEzB,MAAM,CAAC,GAAG,IAAA,+BAAsB,EAAC,KAAK,CAAC,CAAC;IACxC,MAAM,SAAS,GAAG,IAAA,4BAAoB,EAAC,KAAK,IAAI,EAAE,CAAC,CAAC;IACpD,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;QACzB,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,OAAO;QACL;YACE,IAAI,EAAE,cAAc;YACpB,MAAM,EAAE,EAAE;YACV,MAAM,EAAE;gBACN;oBACE,IAAI,EAAE,WAAW;oBACjB,KAAK,EAAE,GAAG,SAAS,OAAO;oBAC1B,IAAI,EAAE,WAAW;oBACjB,MAAM,EAAE,QAAQ,0BAAiB,EAAE;iBACpC;aACF;SACF;QACD;YACE,IAAI,EAAE,gBAAgB;YACtB,EAAE,EAAE,0BAAiB;YACrB,MAAM,EAAE,IAAA,4BAAmB,EAAC,CAAC,CAAC;YAC9B,YAAY,EAAE,CAAC,eAAe,CAAC;YAC/B,UAAU,EAAE,SAAS;YACrB,SAAS,EAAE;gBACT;oBACE,IAAI,EAAE,2BAA2B,CAAC,CAAC,YAAY,gBAAgB;oBAC/D,KAAK,EAAE,CAAC,mBAAmB,CAAC;oBAC5B,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,YAAY,YAAY,CAAC;oBACpC,MAAM,EAAE,oBAAoB;iBAC7B;gBACD;oBACE,IAAI,EAAE,qFAAqF;oBAC3F,KAAK,EAAE,CAAC,cAAc,CAAC;oBACvB,IAAI,EAAE;wBACJ;4BACE,IAAI,EAAE,6BAA6B;4BACnC,OAAO,EAAE,CAAC,gCAAgC,EAAE,gBAAgB,CAAC;yBAC9D;qBACF;iBACF;aACF;SACF;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { Recipe } from '../../lib/generate/types';
|
|
2
2
|
export interface AuthSourceInput {
|
|
3
3
|
readonly name: string;
|
|
4
|
+
readonly bare?: boolean;
|
|
4
5
|
}
|
|
5
6
|
export interface ResolvedAuthSource {
|
|
6
7
|
readonly name: string;
|
|
7
8
|
readonly className: string;
|
|
8
9
|
readonly propertyName: string;
|
|
10
|
+
readonly bare: boolean;
|
|
9
11
|
}
|
|
12
|
+
export declare const SESSION_PLUGIN_ID = "session";
|
|
10
13
|
export declare function resolveAuthSourceInput(input: AuthSourceInput): ResolvedAuthSource;
|
|
14
|
+
export declare function sessionPluginSymbol(a: ResolvedAuthSource): string;
|
|
11
15
|
export declare const authSource: Recipe<AuthSourceInput>;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.authSource = void 0;
|
|
3
|
+
exports.authSource = exports.SESSION_PLUGIN_ID = void 0;
|
|
4
4
|
exports.resolveAuthSourceInput = resolveAuthSourceInput;
|
|
5
|
+
exports.sessionPluginSymbol = sessionPluginSymbol;
|
|
5
6
|
const casing_1 = require("../../lib/generate/casing");
|
|
7
|
+
exports.SESSION_PLUGIN_ID = 'session';
|
|
6
8
|
function resolveAuthSourceInput(input) {
|
|
7
9
|
if (!(0, casing_1.isKebabId)(input.name)) {
|
|
8
10
|
throw new Error(`Auth source name must be kebab-case (e.g. "dev"); got "${input.name}".`);
|
|
@@ -11,8 +13,12 @@ function resolveAuthSourceInput(input) {
|
|
|
11
13
|
name: input.name,
|
|
12
14
|
className: (0, casing_1.toPascalCase)(input.name),
|
|
13
15
|
propertyName: (0, casing_1.toCamelCase)(input.name),
|
|
16
|
+
bare: input.bare ?? false,
|
|
14
17
|
};
|
|
15
18
|
}
|
|
19
|
+
function sessionPluginSymbol(a) {
|
|
20
|
+
return `${a.propertyName}SessionPlugin`;
|
|
21
|
+
}
|
|
16
22
|
function moduleFile(a) {
|
|
17
23
|
return `// Provider-neutral AuthSource. LoomWeaver owns no authentication — it only reacts to
|
|
18
24
|
// a session snapshot. Wire it with: provideAuthSource(() => ${a.propertyName}AuthSource()).
|
|
@@ -51,11 +57,175 @@ export function cycle${a.className}User(): void {
|
|
|
51
57
|
}
|
|
52
58
|
`;
|
|
53
59
|
}
|
|
60
|
+
function pluginFile(a) {
|
|
61
|
+
return `// The verbs a user needs to operate the stand-in session: sign in, switch the account, sign
|
|
62
|
+
// out, from a rail item whose menu carries them. This is presentation for a product that has no
|
|
63
|
+
// backend yet; nothing here protects anything. Delete it once your own session arrives.
|
|
64
|
+
import type { Disposable, Plugin, PluginContext } from '@loomweaver/plugin-sdk';
|
|
65
|
+
import { cycle${a.className}User, ${a.propertyName}AuthSource } from './${a.name}-auth-source';
|
|
66
|
+
|
|
67
|
+
const MENU = 'session.account/menu';
|
|
68
|
+
const snapshot = ${a.propertyName}AuthSource();
|
|
69
|
+
|
|
70
|
+
let drawn: Disposable[] = [];
|
|
71
|
+
|
|
72
|
+
function signIn(): void {
|
|
73
|
+
if (!snapshot().authenticated) {
|
|
74
|
+
cycle${a.className}User();
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function switchAccount(): void {
|
|
79
|
+
cycle${a.className}User();
|
|
80
|
+
if (!snapshot().authenticated) {
|
|
81
|
+
cycle${a.className}User();
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function signOut(): void {
|
|
86
|
+
while (snapshot().authenticated) {
|
|
87
|
+
cycle${a.className}User();
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function initialsOf(name: string): string {
|
|
92
|
+
return name
|
|
93
|
+
.split(' ')
|
|
94
|
+
.map((word) => word[0] ?? '')
|
|
95
|
+
.join('')
|
|
96
|
+
.slice(0, 2)
|
|
97
|
+
.toUpperCase();
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function draw(ctx: PluginContext): void {
|
|
101
|
+
for (const part of drawn) {
|
|
102
|
+
part.dispose();
|
|
103
|
+
}
|
|
104
|
+
const current = snapshot();
|
|
105
|
+
const name = current.displayName ?? '';
|
|
106
|
+
drawn = [
|
|
107
|
+
ctx.registerRailItem({
|
|
108
|
+
id: 'session.account',
|
|
109
|
+
rail: 'primary',
|
|
110
|
+
icon: 'account',
|
|
111
|
+
title: current.authenticated ? name : 'session.signIn',
|
|
112
|
+
anchor: 'bottom',
|
|
113
|
+
order: 20,
|
|
114
|
+
menu: MENU,
|
|
115
|
+
menuTrigger: 'primary',
|
|
116
|
+
...(current.authenticated ? { initials: initialsOf(name) } : {}),
|
|
117
|
+
menuHeader: current.authenticated
|
|
118
|
+
? {
|
|
119
|
+
title: name,
|
|
120
|
+
detail: \`session.role.\${current.roles.includes('admin') ? 'admin' : 'user'}\`,
|
|
121
|
+
initials: initialsOf(name),
|
|
122
|
+
}
|
|
123
|
+
: { title: 'session.signedOut', icon: 'account' },
|
|
124
|
+
}),
|
|
125
|
+
...(current.authenticated
|
|
126
|
+
? [
|
|
127
|
+
ctx.registerMenuItem({
|
|
128
|
+
id: 'session.menu.switch',
|
|
129
|
+
menu: MENU,
|
|
130
|
+
command: 'session.switchAccount',
|
|
131
|
+
group: 'account',
|
|
132
|
+
order: 10,
|
|
133
|
+
}),
|
|
134
|
+
ctx.registerMenuItem({
|
|
135
|
+
id: 'session.menu.signOut',
|
|
136
|
+
menu: MENU,
|
|
137
|
+
command: 'session.signOut',
|
|
138
|
+
group: 'account',
|
|
139
|
+
order: 20,
|
|
140
|
+
}),
|
|
141
|
+
]
|
|
142
|
+
: [
|
|
143
|
+
ctx.registerMenuItem({
|
|
144
|
+
id: 'session.menu.signIn',
|
|
145
|
+
menu: MENU,
|
|
146
|
+
command: 'session.signIn',
|
|
147
|
+
group: 'account',
|
|
148
|
+
order: 10,
|
|
149
|
+
}),
|
|
150
|
+
]),
|
|
151
|
+
];
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export const ${sessionPluginSymbol(a)}: Plugin = {
|
|
155
|
+
manifest: { id: 'session', name: 'Account', capabilities: ['contributions'] },
|
|
156
|
+
activate(ctx) {
|
|
157
|
+
const then = (step: () => void) => () => {
|
|
158
|
+
step();
|
|
159
|
+
draw(ctx);
|
|
160
|
+
};
|
|
161
|
+
ctx.registerCommand({
|
|
162
|
+
id: 'session.signIn',
|
|
163
|
+
title: 'session.signIn',
|
|
164
|
+
icon: 'account',
|
|
165
|
+
access: { authenticated: false },
|
|
166
|
+
run: then(signIn),
|
|
167
|
+
});
|
|
168
|
+
ctx.registerCommand({
|
|
169
|
+
id: 'session.switchAccount',
|
|
170
|
+
title: 'session.switchAccount',
|
|
171
|
+
icon: 'account',
|
|
172
|
+
access: { authenticated: true },
|
|
173
|
+
run: then(switchAccount),
|
|
174
|
+
});
|
|
175
|
+
ctx.registerCommand({
|
|
176
|
+
id: 'session.signOut',
|
|
177
|
+
title: 'session.signOut',
|
|
178
|
+
icon: 'signOut',
|
|
179
|
+
access: { authenticated: true },
|
|
180
|
+
run: then(signOut),
|
|
181
|
+
});
|
|
182
|
+
draw(ctx);
|
|
183
|
+
},
|
|
184
|
+
deactivate() {
|
|
185
|
+
for (const part of drawn) {
|
|
186
|
+
part.dispose();
|
|
187
|
+
}
|
|
188
|
+
drawn = [];
|
|
189
|
+
},
|
|
190
|
+
};
|
|
191
|
+
`;
|
|
192
|
+
}
|
|
193
|
+
function indexFile(a) {
|
|
194
|
+
return `export { cycle${a.className}User, ${a.propertyName}AuthSource } from './${a.name}-auth-source';
|
|
195
|
+
export { ${sessionPluginSymbol(a)} } from './${a.name}-session.plugin';
|
|
196
|
+
`;
|
|
197
|
+
}
|
|
198
|
+
const I18N = {
|
|
199
|
+
en: {
|
|
200
|
+
signIn: 'Sign in',
|
|
201
|
+
switchAccount: 'Switch account',
|
|
202
|
+
signOut: 'Sign out',
|
|
203
|
+
signedOut: 'Not signed in',
|
|
204
|
+
role: { user: 'User', admin: 'Administrator' },
|
|
205
|
+
},
|
|
206
|
+
de: {
|
|
207
|
+
signIn: 'Anmelden',
|
|
208
|
+
switchAccount: 'Konto wechseln',
|
|
209
|
+
signOut: 'Abmelden',
|
|
210
|
+
signedOut: 'Nicht angemeldet',
|
|
211
|
+
role: { user: 'Benutzer', admin: 'Administrator' },
|
|
212
|
+
},
|
|
213
|
+
};
|
|
54
214
|
exports.authSource = {
|
|
55
215
|
id: 'auth-source',
|
|
56
216
|
build(input) {
|
|
57
217
|
const a = resolveAuthSourceInput(input);
|
|
58
|
-
|
|
218
|
+
const source = { [`${a.name}-auth-source.ts`]: moduleFile(a) };
|
|
219
|
+
if (a.bare) {
|
|
220
|
+
return source;
|
|
221
|
+
}
|
|
222
|
+
return {
|
|
223
|
+
...source,
|
|
224
|
+
[`${a.name}-session.plugin.ts`]: pluginFile(a),
|
|
225
|
+
'index.ts': indexFile(a),
|
|
226
|
+
'i18n/en.json': `${JSON.stringify(I18N.en, null, 2)}\n`,
|
|
227
|
+
'i18n/de.json': `${JSON.stringify(I18N.de, null, 2)}\n`,
|
|
228
|
+
};
|
|
59
229
|
},
|
|
60
230
|
};
|
|
61
231
|
//# sourceMappingURL=recipe.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recipe.js","sourceRoot":"","sources":["../../../../../../../libs/tooling/devkit/src/recipes/auth-source/recipe.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"recipe.js","sourceRoot":"","sources":["../../../../../../../libs/tooling/devkit/src/recipes/auth-source/recipe.ts"],"names":[],"mappings":";;;AAiBA,wDAUC;AAED,kDAEC;AA9BD,sDAAiF;AAcpE,QAAA,iBAAiB,GAAG,SAAS,CAAC;AAE3C,SAAgB,sBAAsB,CAAC,KAAsB;IAC3D,IAAI,CAAC,IAAA,kBAAS,EAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;QAC3B,MAAM,IAAI,KA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@
|
|
|
1
|
+
{"version":3,"file":"platform-version.js","sourceRoot":"","sources":["../../../../../../libs/tooling/devkit/src/recipes/platform-version.ts"],"names":[],"mappings":";;;AAAa,QAAA,gBAAgB,GAAG,OAAO,CAAC"}
|