@analogjs/platform 0.2.30-rc.0 → 0.2.30
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 +3 -3
- package/src/index.d.ts +1 -1
- package/src/lib/nx-plugin/src/generators/page/__snapshots__/generator.spec.ts.snap +13 -1
- package/src/lib/nx-plugin/src/generators/page/generator.js +2 -2
- package/src/lib/nx-plugin/src/generators/page/generator.js.map +1 -1
- package/src/lib/options.d.ts +28 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@analogjs/platform",
|
|
3
|
-
"version": "0.2.30
|
|
3
|
+
"version": "0.2.30",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"description": "The fullstack meta-framework for Angular",
|
|
6
6
|
"author": "Brandon Roberts <robertsbt@gmail.com>",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"nitropack": "^2.6.0",
|
|
28
|
-
"@analogjs/vite-plugin-angular": "^0.2.30
|
|
29
|
-
"@analogjs/vite-plugin-nitro": "^0.2.30
|
|
28
|
+
"@analogjs/vite-plugin-angular": "^0.2.30",
|
|
29
|
+
"@analogjs/vite-plugin-nitro": "^0.2.30"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"@nx/devkit": "^16.0.0 || ^17.0.0",
|
package/src/index.d.ts
CHANGED
|
@@ -66,6 +66,18 @@ export default class ProductsPage {}
|
|
|
66
66
|
exports[`analog-page generator > should create analog page with subfolder correctly > page 3`] = `
|
|
67
67
|
"import { Component } from '@angular/core';
|
|
68
68
|
|
|
69
|
+
@Component({
|
|
70
|
+
standalone: true,
|
|
71
|
+
imports: [],
|
|
72
|
+
template: \` <p>home page works!!</p> \`,
|
|
73
|
+
})
|
|
74
|
+
export default class HomePage {}
|
|
75
|
+
"
|
|
76
|
+
`;
|
|
77
|
+
|
|
78
|
+
exports[`analog-page generator > should create analog page with subfolder correctly > page 4`] = `
|
|
79
|
+
"import { Component } from '@angular/core';
|
|
80
|
+
|
|
69
81
|
@Component({
|
|
70
82
|
standalone: true,
|
|
71
83
|
imports: [],
|
|
@@ -75,7 +87,7 @@ export default class ProductsProductIdPage {}
|
|
|
75
87
|
"
|
|
76
88
|
`;
|
|
77
89
|
|
|
78
|
-
exports[`analog-page generator > should create analog page with subfolder correctly > page
|
|
90
|
+
exports[`analog-page generator > should create analog page with subfolder correctly > page 5`] = `
|
|
79
91
|
"import { Component } from '@angular/core';
|
|
80
92
|
|
|
81
93
|
@Component({
|
|
@@ -35,8 +35,8 @@ function addFiles(tree, options) {
|
|
|
35
35
|
template: '',
|
|
36
36
|
fileName,
|
|
37
37
|
};
|
|
38
|
-
const pageFolders = options.pathname.
|
|
39
|
-
const pageDir = path.join(options.projectRoot,
|
|
38
|
+
const pageFolders = options.pathname.split('/').slice(0, -1);
|
|
39
|
+
const pageDir = path.join(options.projectRoot, 'src/app/pages', ...pageFolders);
|
|
40
40
|
(0, devkit_1.generateFiles)(tree, path.join(__dirname, 'files'), pageDir, templateOptions);
|
|
41
41
|
}
|
|
42
42
|
async function analogPageGenerator(tree, options) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../../../../packages/nx-plugin/src/generators/page/generator.ts"],"names":[],"mappings":";;;AAAA,uCASoB;AACpB,6BAA6B;AAG7B,SAAS,gBAAgB,CACvB,IAAU,EACV,OAAkC;IAElC,MAAM,WAAW,GAAG,GAAG,IAAA,2BAAkB,EAAC,IAAI,CAAC,CAAC,OAAO,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;IAC7E,OAAO;QACL,GAAG,OAAO;QACV,WAAW;KACZ,CAAC;AACJ,CAAC;AAED,SAAS,gBAAgB,CAAC,KAAa;IACrC,MAAM,OAAO,GAAG,mCAAmC,CAAC;IACpD,IAAI,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;QACvB,OAAO,KAAK,CAAC,OAAO,CAAC,mBAAmB,EAAE,CAAC,KAAK,EAAE,EAAE;YAClD,MAAM,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;YAClC,MAAM,eAAe,GAAG,MAAM,CAAC,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,CACtE,MAAM,CAAC,WAAW,EAAE,CACrB,CAAC;YACF,OAAO,IAAI,eAAe,GAAG,CAAC;QAChC,CAAC,CAAC,CAAC;KACJ;SAAM;QACL,OAAO,KAAK,CAAC;KACd;AACH,CAAC;AAED,SAAS,QAAQ,CAAC,IAAU,EAAE,OAAyB;IACrD,MAAM,SAAS,GAAG,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC9C,MAAM,SAAS,GAAG,SAAS,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAClD,MAAM,QAAQ,GAAG,gBAAgB,CAAC,SAAS,CAAC,CAAC;IAC7C,MAAM,eAAe,GAAG;QACtB,GAAG,OAAO;QACV,GAAG,IAAA,cAAK,EAAC,SAAS,CAAC;QACnB,IAAI,EAAE,IAAA,cAAK,EAAC,SAAS,CAAC,CAAC,QAAQ;QAC/B,cAAc,EAAE,IAAA,uBAAc,EAAC,OAAO,CAAC,WAAW,CAAC;QACnD,QAAQ,EAAE,EAAE;QACZ,QAAQ;KACT,CAAC;IAEF,MAAM,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../../../../packages/nx-plugin/src/generators/page/generator.ts"],"names":[],"mappings":";;;AAAA,uCASoB;AACpB,6BAA6B;AAG7B,SAAS,gBAAgB,CACvB,IAAU,EACV,OAAkC;IAElC,MAAM,WAAW,GAAG,GAAG,IAAA,2BAAkB,EAAC,IAAI,CAA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,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC7D,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CACvB,OAAO,CAAC,WAAW,EACnB,eAAe,EACf,GAAG,WAAW,CACf,CAAC;IAEF,IAAA,sBAAa,EAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,eAAe,CAAC,CAAC;AAC/E,CAAC;AAEM,KAAK,UAAU,mBAAmB,CACvC,IAAU,EACV,OAAkC;IAElC,MAAM,iBAAiB,GAAG,gBAAgB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC1D,IAAI,OAAO,CAAC,YAAY,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE;QACjD,MAAM,IAAI,KAAK,CACb,IAAA,qBAAY,EAAA,uDAAuD,CACpE,CAAC;KACH;IACD,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAC,CAAC;IAElC,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAbD,kDAaC;AAEY,QAAA,4BAA4B,GACvC,IAAA,2BAAkB,EAAC,mBAAmB,CAAC,CAAC;AAE1C,kBAAe,mBAAmB,CAAC"}
|
package/src/lib/options.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export interface PrerenderOptions {
|
|
|
9
9
|
/**
|
|
10
10
|
* List of routes to prerender resolved statically or dynamically.
|
|
11
11
|
*/
|
|
12
|
-
routes?: string[] | (() => Promise<(string | undefined)[]>);
|
|
12
|
+
routes?: (string | PrerenderContentDir)[] | (() => Promise<(string | PrerenderContentDir | undefined)[]>);
|
|
13
13
|
sitemap?: SitemapConfig;
|
|
14
14
|
/** List of functions that run for each route after pre-rendering is complete. */
|
|
15
15
|
postRenderingHooks?: ((routes: PrerenderRoute) => Promise<void>)[];
|
|
@@ -30,3 +30,30 @@ export interface Options {
|
|
|
30
30
|
index?: string;
|
|
31
31
|
workspaceRoot?: string;
|
|
32
32
|
}
|
|
33
|
+
export interface PrerenderContentDir {
|
|
34
|
+
/**
|
|
35
|
+
* The directory where files should be grabbed from.
|
|
36
|
+
* @example `/src/contents/blog`
|
|
37
|
+
*/
|
|
38
|
+
contentDir: string;
|
|
39
|
+
/**
|
|
40
|
+
* Transform the matching content files path into a route.
|
|
41
|
+
* The function is called for each matching content file within the specified contentDir.
|
|
42
|
+
* @param file information of the matching file (`path`, `name`, `extension`, `attributes`)
|
|
43
|
+
* @returns a string with the route should be returned (e. g. `/blog/<slug>`) or the value `false`, when the route should not be prerendered.
|
|
44
|
+
*/
|
|
45
|
+
transform: (file: PrerenderContentFile) => string | false;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* @param path the path to the content file
|
|
49
|
+
* @param name the basename of the matching content file without the file extension
|
|
50
|
+
* @param extension the file extension
|
|
51
|
+
* @param attributes the frontmatter attributes extracted from the frontmatter section of the file
|
|
52
|
+
* @returns a string with the route should be returned (e. g. `/blog/<slug>`) or the value `false`, when the route should not be prerendered.
|
|
53
|
+
*/
|
|
54
|
+
export interface PrerenderContentFile {
|
|
55
|
+
path: string;
|
|
56
|
+
attributes: Record<string, any>;
|
|
57
|
+
name: string;
|
|
58
|
+
extension: string;
|
|
59
|
+
}
|