@analogjs/platform 3.0.0-beta.18 → 3.0.0-beta.19

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@analogjs/platform",
3
- "version": "3.0.0-beta.18",
3
+ "version": "3.0.0-beta.19",
4
4
  "description": "The fullstack meta-framework for Angular",
5
5
  "type": "module",
6
6
  "author": "Brandon Roberts <robertsbt@gmail.com>",
@@ -31,7 +31,7 @@
31
31
  "url": "https://github.com/sponsors/brandonroberts"
32
32
  },
33
33
  "dependencies": {
34
- "@analogjs/vite-plugin-angular": "3.0.0-beta.18",
34
+ "@analogjs/vite-plugin-angular": "3.0.0-beta.19",
35
35
  "es-toolkit": "^1.45.1",
36
36
  "front-matter": "^4.0.2",
37
37
  "magic-string": "^0.30.21",
@@ -13,14 +13,15 @@ function depsPlugin(options) {
13
13
  const workspaceRoot = options?.workspaceRoot ?? process.env["NX_WORKSPACE_ROOT"] ?? process.cwd();
14
14
  return [{
15
15
  name: "analogjs-deps-plugin",
16
- config() {
17
- const transformConfig = { exclude: ["**/*.ts", "**/*.js"] };
16
+ config(userConfig) {
17
+ const jsTransformKey = getJsTransformConfigKey();
18
+ const userTransform = userConfig?.[jsTransformKey] !== void 0 || jsTransformKey === "oxc" && !!userConfig?.esbuild;
18
19
  debugPlatform("deps transform config", {
19
- jsTransformKey: getJsTransformConfigKey(),
20
- transformExcluded: true
20
+ jsTransformKey,
21
+ transformExcluded: !userTransform
21
22
  });
22
23
  return {
23
- [getJsTransformConfigKey()]: transformConfig,
24
+ ...userTransform ? {} : { [jsTransformKey]: { exclude: ["**/*.ts", "**/*.js"] } },
24
25
  ssr: {
25
26
  noExternal: [
26
27
  "@analogjs/**",
@@ -1 +1 @@
1
- {"version":3,"file":"deps-plugin.js","names":[],"sources":["../../../src/lib/deps-plugin.ts"],"sourcesContent":["import type { Plugin } from 'vite';\nimport { crawlFrameworkPkgs } from 'vitefu';\n\nimport { angularLinkerPlugin } from './nitro/angular-linker-plugin.js';\nimport { Options } from './options.js';\nimport { debugPlatform } from './utils/debug.js';\nimport { getJsTransformConfigKey, isRolldown } from './utils/rolldown.js';\n\nconst ANGULAR_LINKED_SSR_DEPS = [\n '@angular/compiler',\n '@angular/core',\n '@angular/platform-browser',\n '@angular/platform-server',\n];\n\nexport function depsPlugin(options?: Options): Plugin[] {\n const workspaceRoot =\n options?.workspaceRoot ?? process.env['NX_WORKSPACE_ROOT'] ?? process.cwd();\n\n return [\n {\n name: 'analogjs-deps-plugin',\n config() {\n // Skip Vite's built-in ts/js transform so `@analogjs/vite-plugin-angular`\n // (when the user includes it) owns Angular file compilation. Users who\n // run an alternative compiler or compile through Angular's own\n // compilation API can override this in their own Vite config.\n const transformConfig = { exclude: ['**/*.ts', '**/*.js'] };\n debugPlatform('deps transform config', {\n jsTransformKey: getJsTransformConfigKey(),\n transformExcluded: true,\n });\n\n return {\n [getJsTransformConfigKey()]: transformConfig,\n ssr: {\n noExternal: [\n '@analogjs/**',\n 'es-toolkit',\n 'firebase/**',\n 'firebase-admin/**',\n 'rxfire',\n '@ng-web-apis/**',\n '@taiga-ui/**',\n /^@tanstack\\/angular-/,\n ],\n // The server pre-bundle is resolved separately from the client\n // one, so a secondary entry point left out of it loads its own\n // copy of `@angular/core`. `inject()` then runs against a runtime\n // with no active injection context and SSR fails with NG0203.\n // With Rolldown, the rest of Angular is pre-bundled too and the\n // partial-compilation packages are linked, so the server needs no JIT.\n optimizeDeps: {\n include: [\n ...(isRolldown() ? ANGULAR_LINKED_SSR_DEPS : []),\n '@angular/common',\n '@angular/common/http',\n '@angular/core/rxjs-interop',\n ],\n ...(isRolldown()\n ? { rolldownOptions: { plugins: [angularLinkerPlugin()] } }\n : {}),\n },\n },\n optimizeDeps: {\n include: [\n '@angular/common',\n '@angular/common/http',\n '@angular/core/rxjs-interop',\n 'front-matter',\n ],\n exclude: [\n '@angular/platform-server',\n '@analogjs/content',\n '@analogjs/router',\n '@nx/angular',\n '@nx/vite',\n '@nx/devkit',\n '@nx/js',\n '@nx/devkit',\n '@nx/cypress',\n '@nx/jest',\n '@nx/js',\n '@nx/eslint',\n '@nx/webpack',\n '@nx/web',\n '@nx/workspace',\n '@nx/eslint',\n '@nx/module-federation',\n '@nx/rspack',\n 'webpack',\n 'fsevents',\n 'nx',\n ],\n },\n };\n },\n },\n {\n name: 'analogjs-auto-discover-deps',\n async config(config, { command }) {\n const pkgConfig = await crawlFrameworkPkgs({\n root: workspaceRoot,\n isBuild: command === 'build',\n viteUserConfig: config,\n isSemiFrameworkPkgByJson(pkgJson) {\n return pkgJson['module'] && pkgJson['module'].includes('fesm');\n },\n });\n return pkgConfig;\n },\n },\n ];\n}\n"],"mappings":";;;;;AAQA,IAAM,0BAA0B;CAC9B;CACA;CACA;CACA;AACF;AAEA,SAAgB,WAAW,SAA6B;CACtD,MAAM,gBACJ,SAAS,iBAAiB,QAAQ,IAAI,wBAAwB,QAAQ,IAAI;CAE5E,OAAO,CACL;EACE,MAAM;EACN,SAAS;GAKP,MAAM,kBAAkB,EAAE,SAAS,CAAC,WAAW,SAAS,EAAE;GAC1D,cAAc,yBAAyB;IACrC,gBAAgB,wBAAwB;IACxC,mBAAmB;GACrB,CAAC;GAED,OAAO;KACJ,wBAAwB,IAAI;IAC7B,KAAK;KACH,YAAY;MACV;MACA;MACA;MACA;MACA;MACA;MACA;MACA;KACF;KAOA,cAAc;MACZ,SAAS;OACP,GAAI,WAAW,IAAI,0BAA0B,CAAC;OAC9C;OACA;OACA;MACF;MACA,GAAI,WAAW,IACX,EAAE,iBAAiB,EAAE,SAAS,CAAC,oBAAoB,CAAC,EAAE,EAAE,IACxD,CAAC;KACP;IACF;IACA,cAAc;KACZ,SAAS;MACP;MACA;MACA;MACA;KACF;KACA,SAAS;MACP;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;KACF;IACF;GACF;EACF;CACF,GACA;EACE,MAAM;EACN,MAAM,OAAO,QAAQ,EAAE,WAAW;GAShC,OAAO,MARiB,mBAAmB;IACzC,MAAM;IACN,SAAS,YAAY;IACrB,gBAAgB;IAChB,yBAAyB,SAAS;KAChC,OAAO,QAAQ,aAAa,QAAQ,SAAS,CAAC,SAAS,MAAM;IAC/D;GACF,CAAC;EAEH;CACF,CACF;AACF"}
1
+ {"version":3,"file":"deps-plugin.js","names":[],"sources":["../../../src/lib/deps-plugin.ts"],"sourcesContent":["import type { Plugin } from 'vite';\nimport { crawlFrameworkPkgs } from 'vitefu';\n\nimport { angularLinkerPlugin } from './nitro/angular-linker-plugin.js';\nimport { Options } from './options.js';\nimport { debugPlatform } from './utils/debug.js';\nimport { getJsTransformConfigKey, isRolldown } from './utils/rolldown.js';\n\nconst ANGULAR_LINKED_SSR_DEPS = [\n '@angular/compiler',\n '@angular/core',\n '@angular/platform-browser',\n '@angular/platform-server',\n];\n\nexport function depsPlugin(options?: Options): Plugin[] {\n const workspaceRoot =\n options?.workspaceRoot ?? process.env['NX_WORKSPACE_ROOT'] ?? process.cwd();\n\n return [\n {\n name: 'analogjs-deps-plugin',\n config(userConfig) {\n // Skip Vite's built-in ts/js transform so `@analogjs/vite-plugin-angular`\n // (when the user includes it) owns Angular file compilation. Users who\n // run an alternative compiler, or compile non-Angular server code with\n // Vite, set the transform in their own Vite config. Theirs is kept\n // as-is: merging would concatenate these excludes into it, and an\n // exclude wins over any include they set.\n const jsTransformKey = getJsTransformConfigKey();\n // Vite 8 still converts a user's `esbuild` object to `oxc` (unless\n // `oxc` is set), but `esbuild: false` no longer has any effect there.\n const userTransform =\n userConfig?.[jsTransformKey] !== undefined ||\n (jsTransformKey === 'oxc' && !!userConfig?.esbuild);\n debugPlatform('deps transform config', {\n jsTransformKey,\n transformExcluded: !userTransform,\n });\n\n return {\n ...(userTransform\n ? {}\n : { [jsTransformKey]: { exclude: ['**/*.ts', '**/*.js'] } }),\n ssr: {\n noExternal: [\n '@analogjs/**',\n 'es-toolkit',\n 'firebase/**',\n 'firebase-admin/**',\n 'rxfire',\n '@ng-web-apis/**',\n '@taiga-ui/**',\n /^@tanstack\\/angular-/,\n ],\n // The server pre-bundle is resolved separately from the client\n // one, so a secondary entry point left out of it loads its own\n // copy of `@angular/core`. `inject()` then runs against a runtime\n // with no active injection context and SSR fails with NG0203.\n // With Rolldown, the rest of Angular is pre-bundled too and the\n // partial-compilation packages are linked, so the server needs no JIT.\n optimizeDeps: {\n include: [\n ...(isRolldown() ? ANGULAR_LINKED_SSR_DEPS : []),\n '@angular/common',\n '@angular/common/http',\n '@angular/core/rxjs-interop',\n ],\n ...(isRolldown()\n ? { rolldownOptions: { plugins: [angularLinkerPlugin()] } }\n : {}),\n },\n },\n optimizeDeps: {\n include: [\n '@angular/common',\n '@angular/common/http',\n '@angular/core/rxjs-interop',\n 'front-matter',\n ],\n exclude: [\n '@angular/platform-server',\n '@analogjs/content',\n '@analogjs/router',\n '@nx/angular',\n '@nx/vite',\n '@nx/devkit',\n '@nx/js',\n '@nx/devkit',\n '@nx/cypress',\n '@nx/jest',\n '@nx/js',\n '@nx/eslint',\n '@nx/webpack',\n '@nx/web',\n '@nx/workspace',\n '@nx/eslint',\n '@nx/module-federation',\n '@nx/rspack',\n 'webpack',\n 'fsevents',\n 'nx',\n ],\n },\n };\n },\n },\n {\n name: 'analogjs-auto-discover-deps',\n async config(config, { command }) {\n const pkgConfig = await crawlFrameworkPkgs({\n root: workspaceRoot,\n isBuild: command === 'build',\n viteUserConfig: config,\n isSemiFrameworkPkgByJson(pkgJson) {\n return pkgJson['module'] && pkgJson['module'].includes('fesm');\n },\n });\n return pkgConfig;\n },\n },\n ];\n}\n"],"mappings":";;;;;AAQA,IAAM,0BAA0B;CAC9B;CACA;CACA;CACA;AACF;AAEA,SAAgB,WAAW,SAA6B;CACtD,MAAM,gBACJ,SAAS,iBAAiB,QAAQ,IAAI,wBAAwB,QAAQ,IAAI;CAE5E,OAAO,CACL;EACE,MAAM;EACN,OAAO,YAAY;GAOjB,MAAM,iBAAiB,wBAAwB;GAG/C,MAAM,gBACJ,aAAa,oBAAoB,KAAA,KAChC,mBAAmB,SAAS,CAAC,CAAC,YAAY;GAC7C,cAAc,yBAAyB;IACrC;IACA,mBAAmB,CAAC;GACtB,CAAC;GAED,OAAO;IACL,GAAI,gBACA,CAAC,IACD,GAAG,iBAAiB,EAAE,SAAS,CAAC,WAAW,SAAS,EAAE,EAAE;IAC5D,KAAK;KACH,YAAY;MACV;MACA;MACA;MACA;MACA;MACA;MACA;MACA;KACF;KAOA,cAAc;MACZ,SAAS;OACP,GAAI,WAAW,IAAI,0BAA0B,CAAC;OAC9C;OACA;OACA;MACF;MACA,GAAI,WAAW,IACX,EAAE,iBAAiB,EAAE,SAAS,CAAC,oBAAoB,CAAC,EAAE,EAAE,IACxD,CAAC;KACP;IACF;IACA,cAAc;KACZ,SAAS;MACP;MACA;MACA;MACA;KACF;KACA,SAAS;MACP;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;KACF;IACF;GACF;EACF;CACF,GACA;EACE,MAAM;EACN,MAAM,OAAO,QAAQ,EAAE,WAAW;GAShC,OAAO,MARiB,mBAAmB;IACzC,MAAM;IACN,SAAS,YAAY;IACrB,gBAAgB;IAChB,yBAAyB,SAAS;KAChC,OAAO,QAAQ,aAAa,QAAQ,SAAS,CAAC,SAAS,MAAM;IAC/D;GACF,CAAC;EAEH;CACF,CACF;AACF"}
@@ -0,0 +1,25 @@
1
+ type GetPageEndpointsArgs = {
2
+ workspaceRoot: string;
3
+ sourceRoot: string;
4
+ rootDir: string;
5
+ additionalPagesDirs?: string[];
6
+ };
7
+ export type PageEndpoint = {
8
+ /** Absolute path to the page's `.server.ts` file. */
9
+ file: string;
10
+ /** Route relative to the endpoint root, e.g. `/pages/users/:id`. */
11
+ route: string;
12
+ };
13
+ /**
14
+ * Discovers server-side page endpoints: every `.server.ts` file under
15
+ * `app/pages/**` and any additional pages directories, mapped to a route
16
+ * pattern. Servers mount them under their own prefix.
17
+ *
18
+ * Route transformation examples:
19
+ * - index.server.ts → /pages/index
20
+ * - users/[id].server.ts → /pages/users/:id
21
+ * - products/[...slug].server.ts → /pages/products/**:slug
22
+ * - (auth)/login.server.ts → /pages/-auth-/login
23
+ */
24
+ export declare function getPageEndpoints({ workspaceRoot, sourceRoot, rootDir, additionalPagesDirs }: GetPageEndpointsArgs): PageEndpoint[];
25
+ export {};
@@ -0,0 +1,29 @@
1
+ import { resolve } from "node:path";
2
+ import { normalizePath } from "vite";
3
+ import { globSync } from "tinyglobby";
4
+ //#region packages/platform/src/lib/get-page-endpoints.ts
5
+ /**
6
+ * Discovers server-side page endpoints: every `.server.ts` file under
7
+ * `app/pages/**` and any additional pages directories, mapped to a route
8
+ * pattern. Servers mount them under their own prefix.
9
+ *
10
+ * Route transformation examples:
11
+ * - index.server.ts → /pages/index
12
+ * - users/[id].server.ts → /pages/users/:id
13
+ * - products/[...slug].server.ts → /pages/products/**:slug
14
+ * - (auth)/login.server.ts → /pages/-auth-/login
15
+ */
16
+ function getPageEndpoints({ workspaceRoot, sourceRoot, rootDir, additionalPagesDirs }) {
17
+ const root = normalizePath(resolve(workspaceRoot, rootDir));
18
+ return globSync([`${root}/${sourceRoot}/app/pages/**/*.server.ts`, ...(additionalPagesDirs || []).map((dir) => `${workspaceRoot}${dir}/**/*.server.ts`)], {
19
+ dot: true,
20
+ absolute: true
21
+ }).map((file) => ({
22
+ file,
23
+ route: normalizePath(file).replace(/^(.*?)\/pages/, "/pages").replace(/\.server\.ts$/, "").replace(/\[\.{3}(.+)\]/g, "**:$1").replace(/\[\.{3}(\w+)\]/g, "**:$1").replace(/\/\(([^/]+)\)/g, "/-$1-").replace(/\[(\w+)\]/g, ":$1").replace(/\./g, "/")
24
+ }));
25
+ }
26
+ //#endregion
27
+ export { getPageEndpoints };
28
+
29
+ //# sourceMappingURL=get-page-endpoints.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-page-endpoints.js","names":[],"sources":["../../../src/lib/get-page-endpoints.ts"],"sourcesContent":["import { resolve } from 'node:path';\nimport { globSync } from 'tinyglobby';\nimport { normalizePath } from 'vite';\n\ntype GetPageEndpointsArgs = {\n workspaceRoot: string;\n sourceRoot: string;\n rootDir: string;\n additionalPagesDirs?: string[];\n};\n\nexport type PageEndpoint = {\n /** Absolute path to the page's `.server.ts` file. */\n file: string;\n /** Route relative to the endpoint root, e.g. `/pages/users/:id`. */\n route: string;\n};\n\n/**\n * Discovers server-side page endpoints: every `.server.ts` file under\n * `app/pages/**` and any additional pages directories, mapped to a route\n * pattern. Servers mount them under their own prefix.\n *\n * Route transformation examples:\n * - index.server.ts → /pages/index\n * - users/[id].server.ts → /pages/users/:id\n * - products/[...slug].server.ts → /pages/products/**:slug\n * - (auth)/login.server.ts → /pages/-auth-/login\n */\nexport function getPageEndpoints({\n workspaceRoot,\n sourceRoot,\n rootDir,\n additionalPagesDirs,\n}: GetPageEndpointsArgs): PageEndpoint[] {\n const root = normalizePath(resolve(workspaceRoot, rootDir));\n\n const endpointFiles: string[] = globSync(\n [\n `${root}/${sourceRoot}/app/pages/**/*.server.ts`,\n ...(additionalPagesDirs || []).map(\n (dir) => `${workspaceRoot}${dir}/**/*.server.ts`,\n ),\n ],\n { dot: true, absolute: true },\n );\n\n return endpointFiles.map((file) => ({\n file,\n route: normalizePath(file)\n .replace(/^(.*?)\\/pages/, '/pages')\n .replace(/\\.server\\.ts$/, '')\n .replace(/\\[\\.{3}(.+)\\]/g, '**:$1')\n .replace(/\\[\\.{3}(\\w+)\\]/g, '**:$1')\n // Strip Angular Router group syntax `(group)` from any segment, not\n // just trailing ones. Routes like `(auth)/login.server.ts` need to\n // become `/-auth-/login`, otherwise the literal parens leak through\n // and the endpoint is mounted under an invalid path.\n .replace(/\\/\\(([^/]+)\\)/g, '/-$1-')\n .replace(/\\[(\\w+)\\]/g, ':$1')\n .replace(/\\./g, '/'),\n }));\n}\n"],"mappings":";;;;;;;;;;;;;;;AA6BA,SAAgB,iBAAiB,EAC/B,eACA,YACA,SACA,uBACuC;CACvC,MAAM,OAAO,cAAc,QAAQ,eAAe,OAAO,CAAC;CAY1D,OAVgC,SAC9B,CACE,GAAG,KAAK,GAAG,WAAW,4BACtB,IAAI,uBAAuB,CAAC,EAAA,CAAG,KAC5B,QAAQ,GAAG,gBAAgB,IAAI,gBAClC,CACF,GACA;EAAE,KAAK;EAAM,UAAU;CAAK,CAGvB,CAAA,CAAc,KAAK,UAAU;EAClC;EACA,OAAO,cAAc,IAAI,CAAC,CACvB,QAAQ,iBAAiB,QAAQ,CAAC,CAClC,QAAQ,iBAAiB,EAAE,CAAC,CAC5B,QAAQ,kBAAkB,OAAO,CAAC,CAClC,QAAQ,mBAAmB,OAAO,CAAC,CAKnC,QAAQ,kBAAkB,OAAO,CAAC,CAClC,QAAQ,cAAc,KAAK,CAAC,CAC5B,QAAQ,OAAO,GAAG;CACvB,EAAE;AACJ"}
@@ -1,22 +1,7 @@
1
1
  import type { NitroEventHandler } from "nitro/types";
2
- type GetHandlersArgs = {
3
- workspaceRoot: string;
4
- sourceRoot: string;
5
- rootDir: string;
6
- additionalPagesDirs?: string[];
7
- };
2
+ import { getPageEndpoints } from "../get-page-endpoints.js";
8
3
  /**
9
- * Discovers and generates Nitro event handlers for server-side page routes.
10
- *
11
- * Discovers all `.server.ts` files under `app/pages/**` and any additional
12
- * pages directories, then maps each file to a Nitro route pattern under
13
- * `/api/_analog/pages/...`.
14
- *
15
- * Route transformation examples:
16
- * - index.server.ts → /api/_analog/pages/index
17
- * - users/[id].server.ts → /api/_analog/pages/users/:id
18
- * - products/[...slug].server.ts → /api/_analog/pages/products/**:slug
19
- * - (auth)/login.server.ts → /api/_analog/pages/-auth-/login
4
+ * Nitro event handlers for server-side page routes: each discovered page
5
+ * endpoint, mounted under `/api/_analog`.
20
6
  */
21
- export declare function getPageHandlers({ workspaceRoot, sourceRoot, rootDir, additionalPagesDirs }: GetHandlersArgs): NitroEventHandler[];
22
- export {};
7
+ export declare function getPageHandlers(args: Parameters<typeof getPageEndpoints>[0]): NitroEventHandler[];
@@ -1,32 +1,15 @@
1
- import { resolve } from "node:path";
2
- import { normalizePath } from "vite";
3
- import { globSync } from "tinyglobby";
1
+ import { getPageEndpoints } from "../get-page-endpoints.js";
4
2
  //#region packages/platform/src/lib/nitro/get-page-handlers.ts
5
3
  /**
6
- * Discovers and generates Nitro event handlers for server-side page routes.
7
- *
8
- * Discovers all `.server.ts` files under `app/pages/**` and any additional
9
- * pages directories, then maps each file to a Nitro route pattern under
10
- * `/api/_analog/pages/...`.
11
- *
12
- * Route transformation examples:
13
- * - index.server.ts → /api/_analog/pages/index
14
- * - users/[id].server.ts → /api/_analog/pages/users/:id
15
- * - products/[...slug].server.ts → /api/_analog/pages/products/**:slug
16
- * - (auth)/login.server.ts → /api/_analog/pages/-auth-/login
4
+ * Nitro event handlers for server-side page routes: each discovered page
5
+ * endpoint, mounted under `/api/_analog`.
17
6
  */
18
- function getPageHandlers({ workspaceRoot, sourceRoot, rootDir, additionalPagesDirs }) {
19
- const root = normalizePath(resolve(workspaceRoot, rootDir));
20
- return globSync([`${root}/${sourceRoot}/app/pages/**/*.server.ts`, ...(additionalPagesDirs || []).map((dir) => `${workspaceRoot}${dir}/**/*.server.ts`)], {
21
- dot: true,
22
- absolute: true
23
- }).map((endpointFile) => {
24
- return {
25
- handler: endpointFile,
26
- route: `/api/_analog${normalizePath(endpointFile).replace(/^(.*?)\/pages/, "/pages").replace(/\.server\.ts$/, "").replace(/\[\.{3}(.+)\]/g, "**:$1").replace(/\[\.{3}(\w+)\]/g, "**:$1").replace(/\/\(([^/]+)\)/g, "/-$1-").replace(/\[(\w+)\]/g, ":$1").replace(/\./g, "/")}`,
27
- lazy: true
28
- };
29
- });
7
+ function getPageHandlers(args) {
8
+ return getPageEndpoints(args).map(({ file, route }) => ({
9
+ handler: file,
10
+ route: `/api/_analog${route}`,
11
+ lazy: true
12
+ }));
30
13
  }
31
14
  //#endregion
32
15
  export { getPageHandlers };
@@ -1 +1 @@
1
- {"version":3,"file":"get-page-handlers.js","names":[],"sources":["../../../../src/lib/nitro/get-page-handlers.ts"],"sourcesContent":["import { resolve } from 'node:path';\nimport { globSync } from 'tinyglobby';\n\nimport type { NitroEventHandler } from 'nitro/types';\nimport { normalizePath } from 'vite';\n\ntype GetHandlersArgs = {\n workspaceRoot: string;\n sourceRoot: string;\n rootDir: string;\n additionalPagesDirs?: string[];\n};\n\n/**\n * Discovers and generates Nitro event handlers for server-side page routes.\n *\n * Discovers all `.server.ts` files under `app/pages/**` and any additional\n * pages directories, then maps each file to a Nitro route pattern under\n * `/api/_analog/pages/...`.\n *\n * Route transformation examples:\n * - index.server.ts → /api/_analog/pages/index\n * - users/[id].server.ts → /api/_analog/pages/users/:id\n * - products/[...slug].server.ts → /api/_analog/pages/products/**:slug\n * - (auth)/login.server.ts → /api/_analog/pages/-auth-/login\n */\nexport function getPageHandlers({\n workspaceRoot,\n sourceRoot,\n rootDir,\n additionalPagesDirs,\n}: GetHandlersArgs): NitroEventHandler[] {\n const root = normalizePath(resolve(workspaceRoot, rootDir));\n\n const endpointFiles: string[] = globSync(\n [\n `${root}/${sourceRoot}/app/pages/**/*.server.ts`,\n ...(additionalPagesDirs || []).map(\n (dir) => `${workspaceRoot}${dir}/**/*.server.ts`,\n ),\n ],\n { dot: true, absolute: true },\n );\n\n const handlers: NitroEventHandler[] = endpointFiles.map((endpointFile) => {\n const normalized = normalizePath(endpointFile);\n const route = normalized\n .replace(/^(.*?)\\/pages/, '/pages')\n .replace(/\\.server\\.ts$/, '')\n .replace(/\\[\\.{3}(.+)\\]/g, '**:$1')\n .replace(/\\[\\.{3}(\\w+)\\]/g, '**:$1')\n // Strip Angular Router group syntax `(group)` from any segment, not\n // just trailing ones. Routes like `(auth)/login.server.ts` need to\n // become `/-auth-/login`, otherwise the literal parens leak through\n // and the handler is mounted under an invalid Nitro path.\n .replace(/\\/\\(([^/]+)\\)/g, '/-$1-')\n .replace(/\\[(\\w+)\\]/g, ':$1')\n .replace(/\\./g, '/');\n\n return {\n handler: endpointFile,\n route: `/api/_analog${route}`,\n lazy: true,\n };\n });\n\n return handlers;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AA0BA,SAAgB,gBAAgB,EAC9B,eACA,YACA,SACA,uBACuC;CACvC,MAAM,OAAO,cAAc,QAAQ,eAAe,OAAO,CAAC;CAkC1D,OAhCgC,SAC9B,CACE,GAAG,KAAK,GAAG,WAAW,4BACtB,IAAI,uBAAuB,CAAC,EAAA,CAAG,KAC5B,QAAQ,GAAG,gBAAgB,IAAI,gBAClC,CACF,GACA;EAAE,KAAK;EAAM,UAAU;CAAK,CAGQ,CAAA,CAAc,KAAK,iBAAiB;EAexE,OAAO;GACL,SAAS;GACT,OAAO,eAhBU,cAAc,YACnB,CAAA,CACX,QAAQ,iBAAiB,QAAQ,CAAC,CAClC,QAAQ,iBAAiB,EAAE,CAAC,CAC5B,QAAQ,kBAAkB,OAAO,CAAC,CAClC,QAAQ,mBAAmB,OAAO,CAAC,CAKnC,QAAQ,kBAAkB,OAAO,CAAC,CAClC,QAAQ,cAAc,KAAK,CAAC,CAC5B,QAAQ,OAAO,GAIM;GACtB,MAAM;EACR;CACF,CAEO;AACT"}
1
+ {"version":3,"file":"get-page-handlers.js","names":[],"sources":["../../../../src/lib/nitro/get-page-handlers.ts"],"sourcesContent":["import type { NitroEventHandler } from 'nitro/types';\n\nimport { getPageEndpoints } from '../get-page-endpoints.js';\n\n/**\n * Nitro event handlers for server-side page routes: each discovered page\n * endpoint, mounted under `/api/_analog`.\n */\nexport function getPageHandlers(\n args: Parameters<typeof getPageEndpoints>[0],\n): NitroEventHandler[] {\n return getPageEndpoints(args).map(({ file, route }) => ({\n handler: file,\n route: `/api/_analog${route}`,\n lazy: true,\n }));\n}\n"],"mappings":";;;;;;AAQA,SAAgB,gBACd,MACqB;CACrB,OAAO,iBAAiB,IAAI,CAAC,CAAC,KAAK,EAAE,MAAM,aAAa;EACtD,SAAS;EACT,OAAO,eAAe;EACtB,MAAM;CACR,EAAE;AACJ"}
@@ -1,15 +1,15 @@
1
- export declare const ANALOG_JS_ROUTER = "^3.0.0-beta.18";
2
- export declare const ANALOG_JS_CONTENT = "^3.0.0-beta.18";
1
+ export declare const ANALOG_JS_ROUTER = "^3.0.0-beta.19";
2
+ export declare const ANALOG_JS_CONTENT = "^3.0.0-beta.19";
3
3
  export declare const MARKED = "^18.0.0";
4
4
  export declare const MARKED_GFM_HEADING_ID = "^4.1.1";
5
5
  export declare const MARKED_HIGHLIGHT = "^2.2.1";
6
6
  export declare const MARKED_MANGLE = "^1.1.10";
7
7
  export declare const PRISMJS = "^1.29.0";
8
8
  export declare const H3 = "^1.15.11";
9
- export declare const ANALOG_JS_PLATFORM = "^3.0.0-beta.18";
10
- export declare const ANALOG_JS_VITE_PLUGIN_ANGULAR = "^3.0.0-beta.18";
11
- export declare const ANALOG_JS_VITEST_ANGULAR = "^3.0.0-beta.18";
12
- export declare const ANALOG_JS_VITE_PLUGIN_NITRO = "^3.0.0-beta.18";
9
+ export declare const ANALOG_JS_PLATFORM = "^3.0.0-beta.19";
10
+ export declare const ANALOG_JS_VITE_PLUGIN_ANGULAR = "^3.0.0-beta.19";
11
+ export declare const ANALOG_JS_VITEST_ANGULAR = "^3.0.0-beta.19";
12
+ export declare const ANALOG_JS_VITE_PLUGIN_NITRO = "^3.0.0-beta.19";
13
13
  export declare const JSDOM = "^22.0.0";
14
14
  export declare const VITE_TSCONFIG_PATHS = "^4.2.0";
15
15
  export declare const VITE = "^8.0.0";
@@ -1,16 +1,16 @@
1
1
  //#region packages/nx-plugin/src/utils/versions/versions.ts
2
- var ANALOG_JS_ROUTER = "^3.0.0-beta.18";
3
- var ANALOG_JS_CONTENT = "^3.0.0-beta.18";
2
+ var ANALOG_JS_ROUTER = "^3.0.0-beta.19";
3
+ var ANALOG_JS_CONTENT = "^3.0.0-beta.19";
4
4
  var MARKED = "^18.0.0";
5
5
  var MARKED_GFM_HEADING_ID = "^4.1.1";
6
6
  var MARKED_HIGHLIGHT = "^2.2.1";
7
7
  var MARKED_MANGLE = "^1.1.10";
8
8
  var PRISMJS = "^1.29.0";
9
9
  var H3 = "^1.15.11";
10
- var ANALOG_JS_PLATFORM = "^3.0.0-beta.18";
11
- var ANALOG_JS_VITE_PLUGIN_ANGULAR = "^3.0.0-beta.18";
12
- var ANALOG_JS_VITEST_ANGULAR = "^3.0.0-beta.18";
13
- var ANALOG_JS_VITE_PLUGIN_NITRO = "^3.0.0-beta.18";
10
+ var ANALOG_JS_PLATFORM = "^3.0.0-beta.19";
11
+ var ANALOG_JS_VITE_PLUGIN_ANGULAR = "^3.0.0-beta.19";
12
+ var ANALOG_JS_VITEST_ANGULAR = "^3.0.0-beta.19";
13
+ var ANALOG_JS_VITE_PLUGIN_NITRO = "^3.0.0-beta.19";
14
14
  var JSDOM = "^22.0.0";
15
15
  var VITE_TSCONFIG_PATHS = "^4.2.0";
16
16
  var VITE = "^8.0.0";
@@ -1 +1 @@
1
- {"version":3,"file":"versions.js","names":[],"sources":["../../../../../../../../nx-plugin/src/utils/versions/versions.ts"],"sourcesContent":["// dependencies\nexport const ANALOG_JS_ROUTER = '^3.0.0-beta.18';\nexport const ANALOG_JS_CONTENT = '^3.0.0-beta.18';\nexport const MARKED = '^18.0.0';\nexport const MARKED_GFM_HEADING_ID = '^4.1.1';\nexport const MARKED_HIGHLIGHT = '^2.2.1';\nexport const MARKED_MANGLE = '^1.1.10';\nexport const PRISMJS = '^1.29.0';\nexport const H3 = '^1.15.11';\n\n// devDependencies\nexport const ANALOG_JS_PLATFORM = '^3.0.0-beta.18';\nexport const ANALOG_JS_VITE_PLUGIN_ANGULAR = '^3.0.0-beta.18';\nexport const ANALOG_JS_VITEST_ANGULAR = '^3.0.0-beta.18';\nexport const ANALOG_JS_VITE_PLUGIN_NITRO = '^3.0.0-beta.18';\nexport const JSDOM = '^22.0.0';\nexport const VITE_TSCONFIG_PATHS = '^4.2.0';\nexport const VITE = '^8.0.0';\nexport const VITE_7 = '^7.0.0';\nexport const VITE_6 = '^6.4.0';\nexport const VITEST = '^5.0.0';\n"],"mappings":";AACA,IAAa,mBAAmB;AAChC,IAAa,oBAAoB;AACjC,IAAa,SAAS;AACtB,IAAa,wBAAwB;AACrC,IAAa,mBAAmB;AAChC,IAAa,gBAAgB;AAC7B,IAAa,UAAU;AACvB,IAAa,KAAK;AAGlB,IAAa,qBAAqB;AAClC,IAAa,gCAAgC;AAC7C,IAAa,2BAA2B;AACxC,IAAa,8BAA8B;AAC3C,IAAa,QAAQ;AACrB,IAAa,sBAAsB;AACnC,IAAa,OAAO;AACpB,IAAa,SAAS;AACtB,IAAa,SAAS;AACtB,IAAa,SAAS"}
1
+ {"version":3,"file":"versions.js","names":[],"sources":["../../../../../../../../nx-plugin/src/utils/versions/versions.ts"],"sourcesContent":["// dependencies\nexport const ANALOG_JS_ROUTER = '^3.0.0-beta.19';\nexport const ANALOG_JS_CONTENT = '^3.0.0-beta.19';\nexport const MARKED = '^18.0.0';\nexport const MARKED_GFM_HEADING_ID = '^4.1.1';\nexport const MARKED_HIGHLIGHT = '^2.2.1';\nexport const MARKED_MANGLE = '^1.1.10';\nexport const PRISMJS = '^1.29.0';\nexport const H3 = '^1.15.11';\n\n// devDependencies\nexport const ANALOG_JS_PLATFORM = '^3.0.0-beta.19';\nexport const ANALOG_JS_VITE_PLUGIN_ANGULAR = '^3.0.0-beta.19';\nexport const ANALOG_JS_VITEST_ANGULAR = '^3.0.0-beta.19';\nexport const ANALOG_JS_VITE_PLUGIN_NITRO = '^3.0.0-beta.19';\nexport const JSDOM = '^22.0.0';\nexport const VITE_TSCONFIG_PATHS = '^4.2.0';\nexport const VITE = '^8.0.0';\nexport const VITE_7 = '^7.0.0';\nexport const VITE_6 = '^6.4.0';\nexport const VITEST = '^5.0.0';\n"],"mappings":";AACA,IAAa,mBAAmB;AAChC,IAAa,oBAAoB;AACjC,IAAa,SAAS;AACtB,IAAa,wBAAwB;AACrC,IAAa,mBAAmB;AAChC,IAAa,gBAAgB;AAC7B,IAAa,UAAU;AACvB,IAAa,KAAK;AAGlB,IAAa,qBAAqB;AAClC,IAAa,gCAAgC;AAC7C,IAAa,2BAA2B;AACxC,IAAa,8BAA8B;AAC3C,IAAa,QAAQ;AACrB,IAAa,sBAAsB;AACnC,IAAa,OAAO;AACpB,IAAa,SAAS;AACtB,IAAa,SAAS;AACtB,IAAa,SAAS"}