@analogjs/content 3.0.0-alpha.3 → 3.0.0-alpha.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/package.json +1 -1
- package/plugin/package.json +0 -1
- package/plugin/src/migrations/update-markdown-renderer-feature/compat.d.ts +0 -3
- package/plugin/src/migrations/update-markdown-renderer-feature/compat.js +0 -8
- package/plugin/src/migrations/update-markdown-renderer-feature/update-markdown-renderer-feature.d.ts +0 -2
- package/plugin/src/migrations/update-markdown-renderer-feature/update-markdown-renderer-feature.js +0 -48
package/package.json
CHANGED
package/plugin/package.json
CHANGED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const update_markdown_renderer_feature_1 = tslib_1.__importDefault(require("./update-markdown-renderer-feature"));
|
|
6
|
-
const _default = (0, devkit_1.convertNxGenerator)(update_markdown_renderer_feature_1.default);
|
|
7
|
-
exports.default = _default;
|
|
8
|
-
//# sourceMappingURL=compat.js.map
|
package/plugin/src/migrations/update-markdown-renderer-feature/update-markdown-renderer-feature.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = update;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const ts_morph_1 = require("ts-morph");
|
|
6
|
-
async function update(host) {
|
|
7
|
-
let project;
|
|
8
|
-
(0, devkit_1.visitNotIgnoredFiles)(host, '/', (file) => {
|
|
9
|
-
if (file.endsWith('.ts')) {
|
|
10
|
-
const content = host.read(file, 'utf-8');
|
|
11
|
-
if (content &&
|
|
12
|
-
content.includes('withMarkdownRenderer') &&
|
|
13
|
-
!content.includes('withPrismHighlighter') &&
|
|
14
|
-
!content.includes('withShikiHighlighter')) {
|
|
15
|
-
if (!project) {
|
|
16
|
-
project = new ts_morph_1.Project({
|
|
17
|
-
useInMemoryFileSystem: true,
|
|
18
|
-
skipAddingFilesFromTsConfig: true,
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
const sourceFile = project.createSourceFile(file, content);
|
|
22
|
-
const provideContentNode = sourceFile.getFirstDescendant((node) => ts_morph_1.Node.isCallExpression(node) &&
|
|
23
|
-
node.getText().includes('provideContent') &&
|
|
24
|
-
node.getText().includes('withMarkdownRenderer'));
|
|
25
|
-
if (provideContentNode) {
|
|
26
|
-
sourceFile.addImportDeclaration({
|
|
27
|
-
moduleSpecifier: '@analogjs/content/prism-highlighter',
|
|
28
|
-
namedImports: ['withPrismHighlighter'],
|
|
29
|
-
});
|
|
30
|
-
provideContentNode.addArgument('withPrismHighlighter()');
|
|
31
|
-
}
|
|
32
|
-
host.write(file, sourceFile.getFullText());
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
// NOTE: we only add the dependency if the project is an Angular project
|
|
37
|
-
// Nx projects can add the dependency from migrations.json
|
|
38
|
-
let dependencyAdded = false;
|
|
39
|
-
if (host.exists('/angular.json')) {
|
|
40
|
-
(0, devkit_1.addDependenciesToPackageJson)(host, { 'marked-mangle': '^1.1.7' }, {});
|
|
41
|
-
dependencyAdded = true;
|
|
42
|
-
}
|
|
43
|
-
await (0, devkit_1.formatFiles)(host);
|
|
44
|
-
if (dependencyAdded) {
|
|
45
|
-
return () => (0, devkit_1.installPackagesTask)(host);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
//# sourceMappingURL=update-markdown-renderer-feature.js.map
|