@cedarjs/vite 7.0.0-rc.128 → 7.0.1-next.305

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.
@@ -1 +1 @@
1
- {"version":3,"file":"buildApp.d.ts","sourceRoot":"","sources":["../src/buildApp.ts"],"names":[],"mappings":"AA6DA,MAAM,WAAW,oBAAoB;IACnC,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAA;IACpB,EAAE,CAAC,EAAE,OAAO,CAAA;CACb;AAED;;;;;;;;GAQG;AACH,wBAAsB,aAAa,CAAC,EAClC,OAAe,EACf,SAA0B,EAC1B,EAAU,GACX,GAAE,oBAAyB,iBA0a3B"}
1
+ {"version":3,"file":"buildApp.d.ts","sourceRoot":"","sources":["../src/buildApp.ts"],"names":[],"mappings":"AA6DA,MAAM,WAAW,oBAAoB;IACnC,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAA;IACpB,EAAE,CAAC,EAAE,OAAO,CAAA;CACb;AAED;;;;;;;;GAQG;AACH,wBAAsB,aAAa,CAAC,EAClC,OAAe,EACf,SAA0B,EAC1B,EAAU,GACX,GAAE,oBAAyB,iBAsa3B"}
package/dist/buildApp.js CHANGED
@@ -20,7 +20,7 @@ import {
20
20
  applySrcAlias
21
21
  } from "@cedarjs/internal/dist/build/api.js";
22
22
  import { findApiFiles } from "@cedarjs/internal/dist/files.js";
23
- import { getConfig, getPaths, projectSideIsEsm } from "@cedarjs/project-config";
23
+ import { getConfig, getPaths } from "@cedarjs/project-config";
24
24
  import { generateDiffSourceMap } from "./lib/generateDiffSourceMap.js";
25
25
  import { getWorkspacePackageAliases } from "./lib/workspacePackageAliases.js";
26
26
  import { cedarAutoImportsPlugin } from "./plugins/vite-plugin-cedar-auto-import.js";
@@ -60,8 +60,6 @@ async function buildCedarApp({
60
60
  };
61
61
  }
62
62
  if (workspace.includes("api")) {
63
- const isEsm = projectSideIsEsm("api");
64
- const format = isEsm ? "es" : "cjs";
65
63
  const apiFiles = findApiFiles();
66
64
  const input = {};
67
65
  for (const f of apiFiles) {
@@ -77,7 +75,7 @@ async function buildCedarApp({
77
75
  rollupOptions: {
78
76
  input,
79
77
  output: {
80
- format,
78
+ format: "es",
81
79
  preserveModules: true,
82
80
  preserveModulesRoot: cedarPaths.api.src,
83
81
  entryFileNames: "[name].js",
@@ -256,9 +254,7 @@ async function buildCedarApp({
256
254
  plugins.push(cedarDirectoryNamedImportPlugin());
257
255
  plugins.push(cedarOtelWrappingPlugin());
258
256
  plugins.push(cedarjsJobPathInjectorPlugin());
259
- plugins.push(
260
- handlerAlsWrappingPlugin({ projectIsEsm: projectSideIsEsm("api") })
261
- );
257
+ plugins.push(handlerAlsWrappingPlugin());
262
258
  }
263
259
  plugins.push(cedarMockCellDataPlugin());
264
260
  if (workspace.includes("api")) {
@@ -1,22 +1,16 @@
1
1
  import type { Paths } from '@cedarjs/project-config';
2
2
  /**
3
- * Route hooks are built as ES modules. Node reads a `.js` file as CommonJS
4
- * when the nearest package.json has no `"type": "module"`, so in a CommonJS
5
- * web side the output gets the `.mjs` extension instead.
6
- */
7
- export declare function getRouteHookDistExtension(): ".js" | ".mjs";
8
- /**
9
- * Returns the path, relative to `web/dist/ssr/routeHooks`, that the built
10
- * version of the given route hook source file is written to. The layout
11
- * mirrors `web/src`, so `web/src/pages/HomePage/HomePage.routeHooks.ts` ends
12
- * up at `pages/HomePage/HomePage.routeHooks.js` and `web/src/App.routeHooks.ts`
13
- * at `App.routeHooks.js` (`.mjs` in a CommonJS web side, see
14
- * getRouteHookDistExtension()).
3
+ * Returns the path, relative to `web/dist/ssr/routeHooks` and with a `.js`
4
+ * extension, that the built version of the given route hook source file is
5
+ * written to. The layout mirrors `web/src`, so
6
+ * `web/src/pages/HomePage/HomePage.routeHooks.ts` ends up at
7
+ * `pages/HomePage/HomePage.routeHooks.js` and `web/src/App.routeHooks.ts` at
8
+ * `App.routeHooks.js`.
15
9
  *
16
10
  * Used both by the build (to name the Rollup entries) and by the route
17
11
  * manifest (so the streaming handler can find the file at request time).
18
12
  */
19
- export declare function getRouteHookDistPath(routeHookSrcPath: string, webSrc?: string, extension?: string): string;
13
+ export declare function getRouteHookDistPath(routeHookSrcPath: string, webSrc?: string): string;
20
14
  /**
21
15
  * Bundles every `web/src/** /*.routeHooks.{js,ts,tsx,jsx}` file into
22
16
  * `web/dist/ssr/routeHooks` as a node ESM module, one output file per route
@@ -1 +1 @@
1
- {"version":3,"file":"buildRouteHooks.d.ts","sourceRoot":"","sources":["../src/buildRouteHooks.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAiBpD;;;;GAIG;AACH,wBAAgB,yBAAyB,mBAExC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAClC,gBAAgB,EAAE,MAAM,EACxB,MAAM,SAAqB,EAC3B,SAAS,SAA8B,UAGxC;AA6BD;;;;GAIG;AACH,wBAAsB,eAAe,CACnC,OAAO,EAAE,OAAO,GAAG,SAAS,EAC5B,OAAO,EAAE,KAAK,iBAyEf"}
1
+ {"version":3,"file":"buildRouteHooks.d.ts","sourceRoot":"","sources":["../src/buildRouteHooks.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAiBpD;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAClC,gBAAgB,EAAE,MAAM,EACxB,MAAM,SAAqB,UAG5B;AA6BD;;;;GAIG;AACH,wBAAsB,eAAe,CACnC,OAAO,EAAE,OAAO,GAAG,SAAS,EAC5B,OAAO,EAAE,KAAK,iBAuEf"}
@@ -3,7 +3,7 @@ import { build as viteBuild } from "vite";
3
3
  import { gqlPlugin as gqlTagPlugin } from "vite-plugin-graphql-tag";
4
4
  import tsPathsMod from "vite-tsconfig-paths";
5
5
  import { findRouteHooksSrc } from "@cedarjs/internal/dist/files.js";
6
- import { getPaths, projectSideIsEsm } from "@cedarjs/project-config";
6
+ import { getPaths } from "@cedarjs/project-config";
7
7
  import { cedarApiImportGuardPlugin } from "./plugins/vite-plugin-cedar-api-import-guard.js";
8
8
  import { cedarAutoImportsPlugin } from "./plugins/vite-plugin-cedar-auto-import.js";
9
9
  import { cedarDirectoryNamedImportPlugin } from "./plugins/vite-plugin-cedar-directory-named-import.js";
@@ -13,11 +13,8 @@ const tsconfigPaths = (
13
13
  // interop
14
14
  tsPathsMod.default?.default || tsPathsMod.default || tsPathsMod
15
15
  );
16
- function getRouteHookDistExtension() {
17
- return projectSideIsEsm("web") ? ".js" : ".mjs";
18
- }
19
- function getRouteHookDistPath(routeHookSrcPath, webSrc = getPaths().web.src, extension = getRouteHookDistExtension()) {
20
- return getRouteHookEntryName(routeHookSrcPath, webSrc) + extension;
16
+ function getRouteHookDistPath(routeHookSrcPath, webSrc = getPaths().web.src) {
17
+ return getRouteHookEntryName(routeHookSrcPath, webSrc) + ".js";
21
18
  }
22
19
  function getRouteHookEntryName(routeHookSrcPath, webSrc) {
23
20
  return path.relative(webSrc, routeHookSrcPath).replace(/\.(js|ts|tsx|jsx)$/, "").split(path.sep).join("/");
@@ -38,7 +35,6 @@ async function buildRouteHooks(verbose, rwPaths) {
38
35
  for (const routeHook of allRouteHooks) {
39
36
  input[getRouteHookEntryName(routeHook, rwPaths.web.src)] = routeHook;
40
37
  }
41
- const extension = getRouteHookDistExtension();
42
38
  await viteBuild({
43
39
  // Route hooks run in node, so the project's web/vite.config, which is set
44
40
  // up for browser and SSR builds of React code, doesn't apply. Only the
@@ -81,9 +77,9 @@ async function buildRouteHooks(verbose, rwPaths) {
81
77
  input,
82
78
  output: {
83
79
  format: "es",
84
- entryFileNames: "[name]" + extension,
80
+ entryFileNames: "[name].js",
85
81
  // Modules shared between route hooks, like the api side's db.js
86
- chunkFileNames: "chunks/[name]-[hash]" + extension,
82
+ chunkFileNames: "chunks/[name]-[hash].js",
87
83
  exports: "named"
88
84
  }
89
85
  }
@@ -100,6 +96,5 @@ async function buildRouteHooks(verbose, rwPaths) {
100
96
  }
101
97
  export {
102
98
  buildRouteHooks,
103
- getRouteHookDistExtension,
104
99
  getRouteHookDistPath
105
100
  };