@ng-prism/core 22.0.0-beta.3 → 22.0.0-beta.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.
- package/dist/builder/shared/prism-pipeline.d.ts +1 -1
- package/dist/builder/shared/prism-pipeline.d.ts.map +1 -1
- package/dist/builder/shared/prism-pipeline.js +14 -18
- package/dist/schematics/migrations/v21-13-manifest-cache/index.d.ts.map +1 -1
- package/dist/schematics/migrations/v21-13-manifest-cache/index.js +29 -7
- package/dist/schematics/migrations/v22-0-cache-dir-rename/index.d.ts +3 -0
- package/dist/schematics/migrations/v22-0-cache-dir-rename/index.d.ts.map +1 -0
- package/dist/schematics/migrations/v22-0-cache-dir-rename/index.js +138 -0
- package/dist/schematics/ng-add/index.d.ts.map +1 -1
- package/dist/schematics/ng-add/index.js +19 -7
- package/package.json +1 -1
- package/schematics/migrations.json +6 -1
|
@@ -5,7 +5,7 @@ export interface PrismPipelineOptions {
|
|
|
5
5
|
libraryImportPath: string;
|
|
6
6
|
prismProject: string;
|
|
7
7
|
configFile: string;
|
|
8
|
-
/** Absolute path. If omitted, defaults to `<workspaceRoot
|
|
8
|
+
/** Absolute path. If omitted, defaults to `<workspaceRoot>/ng-prism-cache/<prismProject>`. */
|
|
9
9
|
cacheDir?: string;
|
|
10
10
|
}
|
|
11
11
|
export interface PrismPipelineResult {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prism-pipeline.d.ts","sourceRoot":"","sources":["../../../src/builder/shared/prism-pipeline.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"prism-pipeline.d.ts","sourceRoot":"","sources":["../../../src/builder/shared/prism-pipeline.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAGhE,OAAO,EAAiB,KAAK,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAYpE,MAAM,WAAW,oBAAoB;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,8FAA8F;IAC9F,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,mBAAmB;IAClC,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,mGAAmG;IACnG,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,OAAO,GAAG,SAAS,CAAC;IAC7B,oGAAoG;IACpG,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;CACrC;AAED,wBAAgB,mBAAmB,IAAI,kBAAkB,CAExD;AAED,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,oBAAoB,EAC7B,OAAO,EAAE,cAAc,EACvB,KAAK,EAAE,kBAAkB,GACxB,OAAO,CAAC,mBAAmB,CAAC,CAyE9B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { join, dirname } from 'path';
|
|
2
|
-
import { writeFileSync, readFileSync, mkdirSync, statSync,
|
|
2
|
+
import { writeFileSync, readFileSync, mkdirSync, statSync, existsSync, } from 'fs';
|
|
3
3
|
import ts from 'typescript';
|
|
4
4
|
import { createScanner } from '../scanner/scanner.js';
|
|
5
5
|
import { discoverSecondaryEntryPoints } from '../scanner/entry-point-discovery.js';
|
|
@@ -45,7 +45,8 @@ export async function runPrismPipeline(options, context, state) {
|
|
|
45
45
|
pages: manifest.pages,
|
|
46
46
|
meta: manifest.meta,
|
|
47
47
|
});
|
|
48
|
-
const
|
|
48
|
+
const cacheRoot = options.cacheDir ?? join(workspaceRoot, 'ng-prism-cache');
|
|
49
|
+
const cacheDir = join(cacheRoot, options.prismProject);
|
|
49
50
|
const manifestPath = join(cacheDir, 'prism-manifest.ts');
|
|
50
51
|
mkdirSync(cacheDir, { recursive: true });
|
|
51
52
|
const written = writeManifestIfChanged(manifestPath, source);
|
|
@@ -69,22 +70,17 @@ function writeManifestIfChanged(manifestPath, newContent) {
|
|
|
69
70
|
return false;
|
|
70
71
|
}
|
|
71
72
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
/* best-effort cleanup */
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
throw err;
|
|
87
|
-
}
|
|
73
|
+
// In-place write (truncate + write to the existing inode). The previous
|
|
74
|
+
// implementation used a temp file + atomic rename, which produces a fresh
|
|
75
|
+
// inode on every write. That breaks file watchers — most importantly Vite's
|
|
76
|
+
// — when the manifest lives in a cache dir outside the prism project's
|
|
77
|
+
// source root: Vite watches the file by path/inode, loses the handle on
|
|
78
|
+
// rename, and never picks up subsequent rewrites. The result for the user
|
|
79
|
+
// is that @Showcase changes never trigger an HMR / reload. The window
|
|
80
|
+
// between truncate and write is small (single syscall for kilobyte-sized
|
|
81
|
+
// manifests), so the risk of a bundler observing a partial file is
|
|
82
|
+
// negligible in practice.
|
|
83
|
+
writeFileSync(manifestPath, newContent, 'utf-8');
|
|
88
84
|
return true;
|
|
89
85
|
}
|
|
90
86
|
function isDirectory(path) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/schematics/migrations/v21-13-manifest-cache/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAA0B,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/schematics/migrations/v21-13-manifest-cache/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAA0B,MAAM,4BAA4B,CAAC;AAiM/E,wBAAgB,OAAO,IAAI,IAAI,CAiB9B"}
|
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
import { addTsConfigPath } from '../../utils/tsconfig-paths.js';
|
|
2
2
|
const OLD_IMPORT = /^import\s+\{\s*PRISM_RUNTIME_MANIFEST\s*\}\s+from\s+['"](?:\.\/prism-manifest|prism-manifest)['"]\s*;?$/m;
|
|
3
|
+
/**
|
|
4
|
+
* Matches a Vite HMR accept call whose dependency target is the legacy
|
|
5
|
+
* `./prism-manifest` module specifier. Captures everything after the dep
|
|
6
|
+
* argument so the rewrite preserves the original callback and trailing
|
|
7
|
+
* code verbatim.
|
|
8
|
+
*/
|
|
9
|
+
const OLD_HMR_ACCEPT = /\.accept\s*\(\s*(['"])\.\/prism-manifest\1\s*(,)/g;
|
|
3
10
|
function buildNewImport(prismProject) {
|
|
4
11
|
return `import { PRISM_RUNTIME_MANIFEST } from 'prism-manifest/${prismProject}';`;
|
|
5
12
|
}
|
|
13
|
+
function buildNewHmrAcceptTarget(prismProject) {
|
|
14
|
+
return `.accept('prism-manifest/${prismProject}',`;
|
|
15
|
+
}
|
|
6
16
|
function readWorkspace(tree) {
|
|
7
17
|
const buffer = tree.read('angular.json');
|
|
8
18
|
if (!buffer)
|
|
@@ -34,24 +44,36 @@ function rewriteMainTs(tree, context, workspace, prismProject) {
|
|
|
34
44
|
if (!buffer)
|
|
35
45
|
return;
|
|
36
46
|
const newImport = buildNewImport(prismProject);
|
|
47
|
+
const newHmrTarget = buildNewHmrAcceptTarget(prismProject);
|
|
37
48
|
const content = buffer.toString('utf-8');
|
|
38
|
-
|
|
49
|
+
const importMatches = OLD_IMPORT.test(content);
|
|
50
|
+
const hmrMatches = OLD_HMR_ACCEPT.test(content);
|
|
51
|
+
OLD_HMR_ACCEPT.lastIndex = 0;
|
|
52
|
+
if (content.includes(newImport) && !hmrMatches)
|
|
39
53
|
return;
|
|
40
|
-
|
|
54
|
+
let next = content;
|
|
55
|
+
if (importMatches) {
|
|
56
|
+
next = next.replace(OLD_IMPORT, newImport);
|
|
57
|
+
}
|
|
58
|
+
else if (!next.includes(newImport)) {
|
|
41
59
|
context.logger.warn(`ng-prism migration: could not find PRISM_RUNTIME_MANIFEST import in ${mainPath}. ` +
|
|
42
60
|
`Update it manually to: ${newImport}`);
|
|
43
|
-
return;
|
|
44
61
|
}
|
|
45
|
-
|
|
62
|
+
if (hmrMatches) {
|
|
63
|
+
next = next.replace(OLD_HMR_ACCEPT, newHmrTarget);
|
|
64
|
+
}
|
|
65
|
+
if (next !== content) {
|
|
66
|
+
tree.overwrite(mainPath, next);
|
|
67
|
+
}
|
|
46
68
|
}
|
|
47
69
|
function addTsConfigMapping(tree) {
|
|
48
70
|
addTsConfigPath(tree, 'tsconfig.json', 'prism-manifest/*', [
|
|
49
|
-
'
|
|
71
|
+
'./ng-prism-cache/*/prism-manifest.ts',
|
|
50
72
|
]);
|
|
51
73
|
}
|
|
52
74
|
function ensureNgPrismGitignoreEntry(tree) {
|
|
53
75
|
const path = '.gitignore';
|
|
54
|
-
const entry = '
|
|
76
|
+
const entry = 'ng-prism-cache/';
|
|
55
77
|
const buffer = tree.read(path);
|
|
56
78
|
if (!buffer) {
|
|
57
79
|
tree.create(path, entry + '\n');
|
|
@@ -88,7 +110,7 @@ function addCacheIncludeToTsconfigApp(tree, workspace, prismProject) {
|
|
|
88
110
|
const include = Array.isArray(parsed.include)
|
|
89
111
|
? parsed.include
|
|
90
112
|
: [];
|
|
91
|
-
const includeEntry =
|
|
113
|
+
const includeEntry = `../../ng-prism-cache/${prismProject}/**/*.ts`;
|
|
92
114
|
const includeChanged = !include.includes(includeEntry);
|
|
93
115
|
const nextInclude = includeChanged ? [...include, includeEntry] : include;
|
|
94
116
|
const compilerOptions = { ...(parsed.compilerOptions ?? {}) };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/schematics/migrations/v22-0-cache-dir-rename/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAA0B,MAAM,4BAA4B,CAAC;AAmJ/E,wBAAgB,OAAO,IAAI,IAAI,CAsB9B"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { addTsConfigPath } from '../../utils/tsconfig-paths.js';
|
|
2
|
+
const OLD_DIR = '.ng-prism';
|
|
3
|
+
const NEW_DIR = 'ng-prism-cache';
|
|
4
|
+
const OLD_GITIGNORE_ENTRY = '.ng-prism/';
|
|
5
|
+
const NEW_GITIGNORE_ENTRY = 'ng-prism-cache/';
|
|
6
|
+
const OLD_PATH_MAPPING = './.ng-prism/*/prism-manifest.ts';
|
|
7
|
+
const NEW_PATH_MAPPING = './ng-prism-cache/*/prism-manifest.ts';
|
|
8
|
+
function readWorkspace(tree) {
|
|
9
|
+
const buffer = tree.read('angular.json');
|
|
10
|
+
if (!buffer)
|
|
11
|
+
return undefined;
|
|
12
|
+
return JSON.parse(buffer.toString('utf-8'));
|
|
13
|
+
}
|
|
14
|
+
function findPrismProjects(workspace) {
|
|
15
|
+
const projects = workspace.projects ?? {};
|
|
16
|
+
const result = [];
|
|
17
|
+
for (const [, project] of Object.entries(projects)) {
|
|
18
|
+
const architect = project.architect ?? {};
|
|
19
|
+
for (const target of Object.values(architect)) {
|
|
20
|
+
if (target.builder === '@ng-prism/core:serve') {
|
|
21
|
+
const prismProject = target.options?.['prismProject'];
|
|
22
|
+
if (typeof prismProject === 'string' &&
|
|
23
|
+
!result.includes(prismProject)) {
|
|
24
|
+
result.push(prismProject);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return result;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Replace the `prism-manifest/*` path mapping if it still points at the old
|
|
33
|
+
* `.ng-prism/` location, while preserving any user customisation that already
|
|
34
|
+
* uses a different target.
|
|
35
|
+
*/
|
|
36
|
+
function updateTsConfigMapping(tree, context) {
|
|
37
|
+
const buffer = tree.read('tsconfig.json');
|
|
38
|
+
if (!buffer)
|
|
39
|
+
return;
|
|
40
|
+
let parsed;
|
|
41
|
+
try {
|
|
42
|
+
parsed = JSON.parse(buffer.toString('utf-8'));
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
context.logger.warn('ng-prism migration: tsconfig.json could not be parsed; skipping path-mapping update. Update "prism-manifest/*" to ' +
|
|
46
|
+
`["${NEW_PATH_MAPPING}"] manually.`);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const existing = parsed.compilerOptions?.paths?.['prism-manifest/*'];
|
|
50
|
+
if (!existing) {
|
|
51
|
+
// No existing mapping — fall through to addTsConfigPath which inserts the new default.
|
|
52
|
+
addTsConfigPath(tree, 'tsconfig.json', 'prism-manifest/*', [
|
|
53
|
+
NEW_PATH_MAPPING,
|
|
54
|
+
]);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
// Replace any entries that still reference the legacy dot-dir; leave the rest alone.
|
|
58
|
+
const updated = existing.map((entry) => entry === OLD_PATH_MAPPING ? NEW_PATH_MAPPING : entry);
|
|
59
|
+
if (updated.every((entry, i) => entry === existing[i]))
|
|
60
|
+
return;
|
|
61
|
+
parsed.compilerOptions.paths['prism-manifest/*'] = updated;
|
|
62
|
+
tree.overwrite('tsconfig.json', JSON.stringify(parsed, null, 2) + '\n');
|
|
63
|
+
}
|
|
64
|
+
function updateTsConfigAppInclude(tree, workspace, prismProject) {
|
|
65
|
+
const project = workspace.projects?.[prismProject];
|
|
66
|
+
const projectRoot = project?.root ?? `projects/${prismProject}`;
|
|
67
|
+
const path = `${projectRoot}/tsconfig.app.json`;
|
|
68
|
+
const buffer = tree.read(path);
|
|
69
|
+
if (!buffer)
|
|
70
|
+
return;
|
|
71
|
+
const sourceText = buffer.toString('utf-8');
|
|
72
|
+
let parsed;
|
|
73
|
+
try {
|
|
74
|
+
parsed = JSON.parse(sourceText);
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
if (!Array.isArray(parsed.include))
|
|
80
|
+
return;
|
|
81
|
+
const oldEntry = `../../${OLD_DIR}/${prismProject}/**/*.ts`;
|
|
82
|
+
const newEntry = `../../${NEW_DIR}/${prismProject}/**/*.ts`;
|
|
83
|
+
const include = parsed.include;
|
|
84
|
+
const oldIndex = include.indexOf(oldEntry);
|
|
85
|
+
if (oldIndex === -1 && include.includes(newEntry))
|
|
86
|
+
return;
|
|
87
|
+
if (oldIndex === -1)
|
|
88
|
+
return;
|
|
89
|
+
const next = [...include];
|
|
90
|
+
next[oldIndex] = newEntry;
|
|
91
|
+
// Avoid duplicates if user already had both entries for some reason.
|
|
92
|
+
const deduped = Array.from(new Set(next));
|
|
93
|
+
const updated = { ...parsed, include: deduped };
|
|
94
|
+
tree.overwrite(path, JSON.stringify(updated, null, 2) + '\n');
|
|
95
|
+
}
|
|
96
|
+
function renameGitignoreEntry(tree) {
|
|
97
|
+
const path = '.gitignore';
|
|
98
|
+
const buffer = tree.read(path);
|
|
99
|
+
if (!buffer)
|
|
100
|
+
return;
|
|
101
|
+
const content = buffer.toString('utf-8');
|
|
102
|
+
const lines = content.split('\n');
|
|
103
|
+
let changed = false;
|
|
104
|
+
const next = lines.map((line) => {
|
|
105
|
+
if (line.trim() === OLD_GITIGNORE_ENTRY) {
|
|
106
|
+
changed = true;
|
|
107
|
+
return line.replace(OLD_GITIGNORE_ENTRY, NEW_GITIGNORE_ENTRY);
|
|
108
|
+
}
|
|
109
|
+
return line;
|
|
110
|
+
});
|
|
111
|
+
if (!changed) {
|
|
112
|
+
// Ensure the new entry exists even if the old one was already missing.
|
|
113
|
+
if (next.some((line) => line.trim() === NEW_GITIGNORE_ENTRY))
|
|
114
|
+
return;
|
|
115
|
+
tree.overwrite(path, content.trimEnd() + '\n' + NEW_GITIGNORE_ENTRY + '\n');
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
tree.overwrite(path, next.join('\n'));
|
|
119
|
+
}
|
|
120
|
+
export function migrate() {
|
|
121
|
+
return (tree, context) => {
|
|
122
|
+
const workspace = readWorkspace(tree);
|
|
123
|
+
if (!workspace)
|
|
124
|
+
return tree;
|
|
125
|
+
const prismProjects = findPrismProjects(workspace);
|
|
126
|
+
if (prismProjects.length === 0)
|
|
127
|
+
return tree;
|
|
128
|
+
updateTsConfigMapping(tree, context);
|
|
129
|
+
for (const prismProject of prismProjects) {
|
|
130
|
+
updateTsConfigAppInclude(tree, workspace, prismProject);
|
|
131
|
+
}
|
|
132
|
+
renameGitignoreEntry(tree);
|
|
133
|
+
context.logger.info('ng-prism migration: cache directory renamed from .ng-prism/ to ng-prism-cache/. ' +
|
|
134
|
+
'You can safely delete the old .ng-prism/ directory from your workspace — ' +
|
|
135
|
+
'the builder will regenerate the manifest on next serve/build run.');
|
|
136
|
+
return tree;
|
|
137
|
+
};
|
|
138
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/schematics/ng-add/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,IAAI,EAIV,MAAM,4BAA4B,CAAC;AAGpC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/schematics/ng-add/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,IAAI,EAIV,MAAM,4BAA4B,CAAC;AAGpC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAkXtD,wBAAgB,KAAK,CAAC,OAAO,EAAE,kBAAkB,GAAG,IAAI,CAWvD"}
|
|
@@ -22,31 +22,43 @@ function addPrismAppProject(options) {
|
|
|
22
22
|
const prismRoot = `projects/${prismProjectName}`;
|
|
23
23
|
const prismSrc = `${prismRoot}/src`;
|
|
24
24
|
const zoneless = options.zoneless === true;
|
|
25
|
+
const hotConst = "const hot = (import.meta as ImportMeta & { hot?: { accept(dep: string, cb: (mod: { PRISM_RUNTIME_MANIFEST: typeof PRISM_RUNTIME_MANIFEST } | undefined) => void): void } }).hot;";
|
|
26
|
+
const hmrThen = [
|
|
27
|
+
'.then((appRef) => {',
|
|
28
|
+
` hot?.accept('prism-manifest/${prismProjectName}', (mod) => {`,
|
|
29
|
+
' if (mod) enablePrismHmr(appRef, mod.PRISM_RUNTIME_MANIFEST);',
|
|
30
|
+
' });',
|
|
31
|
+
'});',
|
|
32
|
+
].join('\n');
|
|
25
33
|
const mainTs = zoneless
|
|
26
34
|
? [
|
|
27
35
|
"import { provideZonelessChangeDetection } from '@angular/core';",
|
|
28
36
|
"import { bootstrapApplication } from '@angular/platform-browser';",
|
|
29
|
-
"import { PrismShellComponent, providePrism } from '@ng-prism/core';",
|
|
37
|
+
"import { enablePrismHmr, PrismShellComponent, providePrism } from '@ng-prism/core';",
|
|
30
38
|
`import { PRISM_RUNTIME_MANIFEST } from 'prism-manifest/${prismProjectName}';`,
|
|
31
39
|
"import config from 'ng-prism.config';",
|
|
32
40
|
'',
|
|
41
|
+
hotConst,
|
|
42
|
+
'',
|
|
33
43
|
'bootstrapApplication(PrismShellComponent, {',
|
|
34
44
|
' providers: [',
|
|
35
45
|
' provideZonelessChangeDetection(),',
|
|
36
46
|
' providePrism(PRISM_RUNTIME_MANIFEST, config),',
|
|
37
47
|
' ],',
|
|
38
|
-
'})
|
|
48
|
+
'})' + hmrThen,
|
|
39
49
|
'',
|
|
40
50
|
].join('\n')
|
|
41
51
|
: [
|
|
42
52
|
"import { bootstrapApplication } from '@angular/platform-browser';",
|
|
43
|
-
"import { PrismShellComponent, providePrism } from '@ng-prism/core';",
|
|
53
|
+
"import { enablePrismHmr, PrismShellComponent, providePrism } from '@ng-prism/core';",
|
|
44
54
|
`import { PRISM_RUNTIME_MANIFEST } from 'prism-manifest/${prismProjectName}';`,
|
|
45
55
|
"import config from 'ng-prism.config';",
|
|
46
56
|
'',
|
|
57
|
+
hotConst,
|
|
58
|
+
'',
|
|
47
59
|
'bootstrapApplication(PrismShellComponent, {',
|
|
48
60
|
' providers: [providePrism(PRISM_RUNTIME_MANIFEST, config)],',
|
|
49
|
-
'})
|
|
61
|
+
'})' + hmrThen,
|
|
50
62
|
'',
|
|
51
63
|
].join('\n');
|
|
52
64
|
if (!tree.exists(`${prismSrc}/main.ts`)) {
|
|
@@ -83,7 +95,7 @@ function addPrismAppProject(options) {
|
|
|
83
95
|
files: ['src/main.ts'],
|
|
84
96
|
include: [
|
|
85
97
|
'src/**/*.d.ts',
|
|
86
|
-
|
|
98
|
+
`../../ng-prism-cache/${prismProjectName}/**/*.ts`,
|
|
87
99
|
],
|
|
88
100
|
};
|
|
89
101
|
tree.create(tsconfigAppPath, JSON.stringify(tsconfigApp, null, 2) + '\n');
|
|
@@ -196,7 +208,7 @@ function addTsConfigPaths(options) {
|
|
|
196
208
|
`./${sourceRoot}/public-api.ts`,
|
|
197
209
|
]);
|
|
198
210
|
addTsConfigPath(tree, tsConfigPath, 'prism-manifest/*', [
|
|
199
|
-
'
|
|
211
|
+
'./ng-prism-cache/*/prism-manifest.ts',
|
|
200
212
|
]);
|
|
201
213
|
return tree;
|
|
202
214
|
};
|
|
@@ -260,7 +272,7 @@ function logSetupSummary(options) {
|
|
|
260
272
|
}
|
|
261
273
|
function addNgPrismGitignoreEntry() {
|
|
262
274
|
return (tree) => {
|
|
263
|
-
const entry = '
|
|
275
|
+
const entry = 'ng-prism-cache/';
|
|
264
276
|
const gitignorePath = '.gitignore';
|
|
265
277
|
const buffer = tree.read(gitignorePath);
|
|
266
278
|
if (buffer) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ng-prism/core",
|
|
3
|
-
"version": "22.0.0-beta.
|
|
3
|
+
"version": "22.0.0-beta.4",
|
|
4
4
|
"description": "ng-prism — the Angular-native Storybook alternative. Lightweight component showcase with @Showcase decorator, no story files needed.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ng-prism",
|
|
@@ -3,8 +3,13 @@
|
|
|
3
3
|
"schematics": {
|
|
4
4
|
"migration-v22-manifest-cache": {
|
|
5
5
|
"version": "22.0.0-beta.0",
|
|
6
|
-
"description": "Move generated prism-manifest.ts into <workspaceRoot
|
|
6
|
+
"description": "Move generated prism-manifest.ts into <workspaceRoot>/ng-prism-cache/<prismProject>/ and resolve it via a wildcard tsconfig path mapping.",
|
|
7
7
|
"factory": "../dist/schematics/migrations/v21-13-manifest-cache/index#migrate"
|
|
8
|
+
},
|
|
9
|
+
"migration-v22-cache-dir-rename": {
|
|
10
|
+
"version": "22.0.0-beta.4",
|
|
11
|
+
"description": "Rename the manifest cache directory from .ng-prism/ to ng-prism-cache/. The dot-prefixed name was silently excluded from @angular/build's watcher (hardcoded **/.*/** ignore pattern), so @Showcase decorator edits never triggered an HMR / reload.",
|
|
12
|
+
"factory": "../dist/schematics/migrations/v22-0-cache-dir-rename/index#migrate"
|
|
8
13
|
}
|
|
9
14
|
}
|
|
10
15
|
}
|