@cedarjs/vite 7.0.0-canary.3237 → 7.0.0-canary.3241

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/index.d.ts CHANGED
@@ -19,6 +19,7 @@ export { cedarRemoveFromBundle } from './plugins/vite-plugin-cedar-remove-from-b
19
19
  export { cedarjsResolveCedarStyleImportsPlugin } from './plugins/vite-plugin-cedarjs-resolve-cedar-style-imports.js';
20
20
  export { cedarjsJobPathInjectorPlugin } from './plugins/vite-plugin-cedarjs-job-path-injector.js';
21
21
  export { cedarMockCellDataPlugin } from './plugins/vite-plugin-cedar-mock-cell-data.js';
22
+ export { cedarParsedScalarsPlugin } from './plugins/vite-plugin-cedar-parsed-scalars.js';
22
23
  export { cedarMergedConfig } from './plugins/vite-plugin-merged-config.js';
23
24
  export { cedarSwapApolloProvider } from './plugins/vite-plugin-swap-apollo-provider.js';
24
25
  export { cedarUniversalDeployPlugin } from './plugins/vite-plugin-cedar-universal-deploy.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA;AAoCxC,OAAO,EAAE,yBAAyB,EAAE,MAAM,iDAAiD,CAAA;AAC3F,OAAO,EAAE,sBAAsB,EAAE,MAAM,4CAA4C,CAAA;AACnF,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAA;AAChF,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAA;AACxE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAA;AACtF,OAAO,EAAE,gCAAgC,EAAE,MAAM,wDAAwD,CAAA;AACzG,OAAO,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAA;AACtF,OAAO,EACL,uBAAuB,EACvB,wBAAw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+C,CAAA;AACvF,OAAO,EAAE,0BAA0B,EAAE,MAAM,iDAAiD,CAAA;AAC5F,OAAO,EAAE,qBAAqB,EAAE,MAAM,oDAAoD,CAAA;AAE1F,KAAK,aAAa,GAAG;IACnB,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACzB,KAAK,CAAC,EAAE,YAAY,GAAG,SAAS,CAAA;CACjC,CAAA;AAED;;GAEG;AACH,wBAAgB,KAAK,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,GAAE,aAAkB,GAAG,YAAY,EAAE,CAgDzE;AAED,8DAA8D;AAC9D,eAAe,KAAK,CAAA"}
package/dist/index.js CHANGED
@@ -20,6 +20,7 @@ import { cedarDataUriShim } from "./plugins/vite-plugin-cedar-data-uri-shim.js";
20
20
  import { cedarEntryInjectionPlugin } from "./plugins/vite-plugin-cedar-entry-injection.js";
21
21
  import { cedarHtmlEnvPlugin } from "./plugins/vite-plugin-cedar-html-env.js";
22
22
  import { cedarMockCellDataPlugin } from "./plugins/vite-plugin-cedar-mock-cell-data.js";
23
+ import { cedarParsedScalarsPlugin } from "./plugins/vite-plugin-cedar-parsed-scalars.js";
23
24
  import { cedarRemoveDevFatalErrorPage } from "./plugins/vite-plugin-cedar-remove-dev-fatal-error-page.js";
24
25
  import { cedarRemoveFromBundle } from "./plugins/vite-plugin-cedar-remove-from-bundle.js";
25
26
  import { cedarRoutesAutoLoaderPlugin } from "./plugins/vite-plugin-cedar-routes-auto-loader.js";
@@ -49,6 +50,7 @@ import { cedarRemoveFromBundle as cedarRemoveFromBundle2 } from "./plugins/vite-
49
50
  import { cedarjsResolveCedarStyleImportsPlugin as cedarjsResolveCedarStyleImportsPlugin2 } from "./plugins/vite-plugin-cedarjs-resolve-cedar-style-imports.js";
50
51
  import { cedarjsJobPathInjectorPlugin } from "./plugins/vite-plugin-cedarjs-job-path-injector.js";
51
52
  import { cedarMockCellDataPlugin as cedarMockCellDataPlugin2 } from "./plugins/vite-plugin-cedar-mock-cell-data.js";
53
+ import { cedarParsedScalarsPlugin as cedarParsedScalarsPlugin2 } from "./plugins/vite-plugin-cedar-parsed-scalars.js";
52
54
  import { cedarMergedConfig as cedarMergedConfig2 } from "./plugins/vite-plugin-merged-config.js";
53
55
  import { cedarSwapApolloProvider as cedarSwapApolloProvider2 } from "./plugins/vite-plugin-swap-apollo-provider.js";
54
56
  import { cedarUniversalDeployPlugin } from "./plugins/vite-plugin-cedar-universal-deploy.js";
@@ -79,6 +81,7 @@ function cedar({ mode, babel } = {}) {
79
81
  cedarMergedConfig(),
80
82
  cedarjsResolveCedarStyleImportsPlugin(),
81
83
  cedarSwapApolloProvider(),
84
+ cedarParsedScalarsPlugin(),
82
85
  cedarCellTransform(),
83
86
  cedarRemoveFromBundle(),
84
87
  cedarRemoveDevFatalErrorPage(),
@@ -107,6 +110,7 @@ export {
107
110
  cedarMergedConfig2 as cedarMergedConfig,
108
111
  cedarMockCellDataPlugin2 as cedarMockCellDataPlugin,
109
112
  cedarOtelWrappingPlugin,
113
+ cedarParsedScalarsPlugin2 as cedarParsedScalarsPlugin,
110
114
  cedarRemoveDevFatalErrorPage2 as cedarRemoveDevFatalErrorPage,
111
115
  cedarRemoveFromBundle2 as cedarRemoveFromBundle,
112
116
  cedarRoutesAutoLoaderPlugin2 as cedarRoutesAutoLoaderPlugin,
@@ -0,0 +1,20 @@
1
+ import type { Plugin } from 'vite';
2
+ /**
3
+ * Gives `CedarApolloProvider` the cache config for the scalars in
4
+ * `graphql.parsedScalars` in `cedar.toml`. Does nothing when no scalar is set
5
+ * to be parsed.
6
+ *
7
+ * The config comes from the project's generated GraphQL schema, so it is built
8
+ * into the virtual module `virtual:cedar-parsed-scalars` rather than into the
9
+ * provider, which is a published package that Vite pre-bundles in dev. The
10
+ * module puts the config on `globalThis.__CEDAR__PARSED_SCALARS`, where the
11
+ * provider reads it when it creates the cache, and `App` and the web test
12
+ * setup file import the module so that every entry point that renders the
13
+ * provider has it. The module is a
14
+ * dependency of the generated schema file, so a change to the schema reloads
15
+ * the app. The generated schema is only read, and `graphql` and its schema
16
+ * loader only imported, when the virtual module is actually resolved, so a
17
+ * project that doesn't use this setting doesn't pay for loading them.
18
+ */
19
+ export declare function cedarParsedScalarsPlugin(): Plugin | undefined;
20
+ //# sourceMappingURL=vite-plugin-cedar-parsed-scalars.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vite-plugin-cedar-parsed-scalars.d.ts","sourceRoot":"","sources":["../../src/plugins/vite-plugin-cedar-parsed-scalars.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAclC;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,wBAAwB,IAAI,MAAM,GAAG,SAAS,CA4E7D"}
@@ -0,0 +1,60 @@
1
+ import { normalizePath } from "vite";
2
+ import { getParsedScalars, getPaths } from "@cedarjs/project-config";
3
+ const VIRTUAL_MODULE_ID = "virtual:cedar-parsed-scalars";
4
+ const RESOLVED_VIRTUAL_MODULE_ID = "\0" + VIRTUAL_MODULE_ID;
5
+ const APP_FILE_REGEXP = /web[\\/]src[\\/]App\.(ts|tsx|js|jsx)$/;
6
+ const VITEST_WEB_SETUP_FILE_REGEXP = /[\\/]vitest-web\.setup\.(ts|js)$/;
7
+ function cedarParsedScalarsPlugin() {
8
+ if (Object.keys(getParsedScalars()).length === 0) {
9
+ return void 0;
10
+ }
11
+ return {
12
+ name: "cedar-parsed-scalars",
13
+ resolveId(id) {
14
+ if (id === VIRTUAL_MODULE_ID) {
15
+ return RESOLVED_VIRTUAL_MODULE_ID;
16
+ }
17
+ return null;
18
+ },
19
+ async load(id) {
20
+ if (id !== RESOLVED_VIRTUAL_MODULE_ID) {
21
+ return null;
22
+ }
23
+ this.addWatchFile(getPaths().generated.schema);
24
+ const { loadParsedScalarsCacheConfig } = await import("@cedarjs/internal/dist/generate/parsedScalars.js");
25
+ const config = loadParsedScalarsCacheConfig();
26
+ return `globalThis.__CEDAR__PARSED_SCALARS = ${JSON.stringify(config)}`;
27
+ },
28
+ transform(code, id) {
29
+ if (!APP_FILE_REGEXP.test(id) && !VITEST_WEB_SETUP_FILE_REGEXP.test(id)) {
30
+ return null;
31
+ }
32
+ return `import '${VIRTUAL_MODULE_ID}'
33
+ ${code}`;
34
+ },
35
+ // `this.addWatchFile` in `load` only reruns the virtual module for a
36
+ // change to a file it has already watched. The schema doesn't exist yet
37
+ // on a clean `cedar dev` (the web server and `cedar-gen-watch` start
38
+ // concurrently), so its first appearance is a 'create' event on a path
39
+ // nothing has watched yet, and reaches here without an `addWatchFile`
40
+ // call ever having registered it. Reload the virtual module for exactly
41
+ // that file, on every event type, so the app picks up the first schema
42
+ // once `cedar-gen-watch` writes it, the same way it already does for a
43
+ // later edit.
44
+ hotUpdate(options) {
45
+ if (options.file !== normalizePath(getPaths().generated.schema)) {
46
+ return;
47
+ }
48
+ const moduleGraph = this.environment.moduleGraph;
49
+ const module = moduleGraph.getModuleById(RESOLVED_VIRTUAL_MODULE_ID);
50
+ if (!module) {
51
+ return;
52
+ }
53
+ moduleGraph.invalidateModule(module);
54
+ return [module];
55
+ }
56
+ };
57
+ }
58
+ export {
59
+ cedarParsedScalarsPlugin
60
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/vite",
3
- "version": "7.0.0-canary.3237",
3
+ "version": "7.0.0-canary.3241",
4
4
  "description": "Vite configuration package for CedarJS",
5
5
  "repository": {
6
6
  "type": "git",
@@ -54,17 +54,17 @@
54
54
  "@babel/preset-typescript": "7.29.7",
55
55
  "@babel/traverse": "7.29.8",
56
56
  "@babel/types": "7.29.8",
57
- "@cedarjs/api": "7.0.0-canary.3237",
58
- "@cedarjs/api-server": "7.0.0-canary.3237",
59
- "@cedarjs/babel-config": "7.0.0-canary.3237",
60
- "@cedarjs/context": "7.0.0-canary.3237",
61
- "@cedarjs/graphql-server": "7.0.0-canary.3237",
62
- "@cedarjs/internal": "7.0.0-canary.3237",
63
- "@cedarjs/jobs": "7.0.0-canary.3237",
64
- "@cedarjs/project-config": "7.0.0-canary.3237",
65
- "@cedarjs/server-store": "7.0.0-canary.3237",
66
- "@cedarjs/structure": "7.0.0-canary.3237",
67
- "@cedarjs/testing": "7.0.0-canary.3237",
57
+ "@cedarjs/api": "7.0.0-canary.3241",
58
+ "@cedarjs/api-server": "7.0.0-canary.3241",
59
+ "@cedarjs/babel-config": "7.0.0-canary.3241",
60
+ "@cedarjs/context": "7.0.0-canary.3241",
61
+ "@cedarjs/graphql-server": "7.0.0-canary.3241",
62
+ "@cedarjs/internal": "7.0.0-canary.3241",
63
+ "@cedarjs/jobs": "7.0.0-canary.3241",
64
+ "@cedarjs/project-config": "7.0.0-canary.3241",
65
+ "@cedarjs/server-store": "7.0.0-canary.3241",
66
+ "@cedarjs/structure": "7.0.0-canary.3241",
67
+ "@cedarjs/testing": "7.0.0-canary.3241",
68
68
  "@swc/core": "1.16.2",
69
69
  "@universal-deploy/store": "^0.2.1",
70
70
  "@universal-deploy/vite": "^0.1.9",
@@ -94,10 +94,10 @@
94
94
  "yargs-parser": "21.1.1"
95
95
  },
96
96
  "devDependencies": {
97
- "@cedarjs/auth": "7.0.0-canary.3237",
98
- "@cedarjs/framework-tools": "7.0.0-canary.3237",
99
- "@cedarjs/router": "7.0.0-canary.3237",
100
- "@cedarjs/web": "7.0.0-canary.3237",
97
+ "@cedarjs/auth": "7.0.0-canary.3241",
98
+ "@cedarjs/framework-tools": "7.0.0-canary.3241",
99
+ "@cedarjs/router": "7.0.0-canary.3241",
100
+ "@cedarjs/web": "7.0.0-canary.3241",
101
101
  "@dr.pogodin/react-helmet": "2.0.4",
102
102
  "@hyrious/esbuild-plugin-commonjs": "0.2.6",
103
103
  "@jridgewell/trace-mapping": "0.3.31",
@@ -113,15 +113,15 @@
113
113
  "publint": "0.3.24",
114
114
  "react": "19.3.0",
115
115
  "react-dom": "19.3.0",
116
- "rollup": "4.63.3",
116
+ "rollup": "4.63.4",
117
117
  "ts-dedent": "2.3.0",
118
118
  "typescript": "5.9.3",
119
119
  "vitest": "4.1.11"
120
120
  },
121
121
  "peerDependencies": {
122
- "@cedarjs/auth": "7.0.0-canary.3237",
123
- "@cedarjs/router": "7.0.0-canary.3237",
124
- "@cedarjs/web": "7.0.0-canary.3237",
122
+ "@cedarjs/auth": "7.0.0-canary.3241",
123
+ "@cedarjs/router": "7.0.0-canary.3241",
124
+ "@cedarjs/web": "7.0.0-canary.3241",
125
125
  "react": "19.3.0",
126
126
  "react-dom": "19.3.0"
127
127
  },