@cedarjs/vite 8.0.0-canary.3310 → 8.0.0-canary.3313

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":"vite-plugin-cedar-auto-import.d.ts","sourceRoot":"","sources":["../../src/plugins/vite-plugin-cedar-auto-import.ts"],"names":[],"mappings":"AAuBA,wBAAgB,sBAAsB,UA2ErC"}
1
+ {"version":3,"file":"vite-plugin-cedar-auto-import.d.ts","sourceRoot":"","sources":["../../src/plugins/vite-plugin-cedar-auto-import.ts"],"names":[],"mappings":"AA2BA,wBAAgB,sBAAsB,UAyFrC"}
@@ -13,10 +13,15 @@ import {
13
13
  getPaths,
14
14
  importStatementPath
15
15
  } from "@cedarjs/project-config";
16
+ function escapeRegExp(s) {
17
+ return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
18
+ }
16
19
  function cedarAutoImportsPlugin() {
17
20
  const config = getConfig();
18
21
  const cedarPaths = getPaths();
19
22
  const useTrustedDocumentsGqlTag = config?.graphql?.trustedDocuments;
23
+ const apiBase = cedarPaths.api.base.replace(/\\/g, "/");
24
+ const apiSrcPattern = new RegExp(`^${escapeRegExp(apiBase)}/.*\\.[tj]sx?$`);
20
25
  return [
21
26
  autoImport({
22
27
  // targets to transform
@@ -44,7 +49,14 @@ function cedarAutoImportsPlugin() {
44
49
  }),
45
50
  autoImport({
46
51
  // targets to transform
47
- include: [/\.[tj]sx?$/],
52
+ //
53
+ // This must stay scoped to api/ only. @cedarjs/context relies on
54
+ // Node's AsyncLocalStorage, which isn't available in the browser.
55
+ // If this ever matches web/ files too, an unrelated identifier
56
+ // named `context` in a web-side file (e.g. a function parameter)
57
+ // would get auto-imported from @cedarjs/context, pulling
58
+ // AsyncLocalStorage into the web build and breaking it. See #2892.
59
+ include: [apiSrcPattern],
48
60
  // global imports to register
49
61
  imports: [
50
62
  {
@@ -56,7 +68,7 @@ function cedarAutoImportsPlugin() {
56
68
  }),
57
69
  autoImport({
58
70
  // targets to transform
59
- include: [/api\/.*\.[tj]sx?$/],
71
+ include: [apiSrcPattern],
60
72
  // global imports to register
61
73
  imports: [
62
74
  // import gql from 'graphql-tag'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/vite",
3
- "version": "8.0.0-canary.3310",
3
+ "version": "8.0.0-canary.3313",
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": "8.0.0-canary.3310",
58
- "@cedarjs/api-server": "8.0.0-canary.3310",
59
- "@cedarjs/babel-config": "8.0.0-canary.3310",
60
- "@cedarjs/context": "8.0.0-canary.3310",
61
- "@cedarjs/graphql-server": "8.0.0-canary.3310",
62
- "@cedarjs/internal": "8.0.0-canary.3310",
63
- "@cedarjs/jobs": "8.0.0-canary.3310",
64
- "@cedarjs/project-config": "8.0.0-canary.3310",
65
- "@cedarjs/server-store": "8.0.0-canary.3310",
66
- "@cedarjs/structure": "8.0.0-canary.3310",
67
- "@cedarjs/testing": "8.0.0-canary.3310",
57
+ "@cedarjs/api": "8.0.0-canary.3313",
58
+ "@cedarjs/api-server": "8.0.0-canary.3313",
59
+ "@cedarjs/babel-config": "8.0.0-canary.3313",
60
+ "@cedarjs/context": "8.0.0-canary.3313",
61
+ "@cedarjs/graphql-server": "8.0.0-canary.3313",
62
+ "@cedarjs/internal": "8.0.0-canary.3313",
63
+ "@cedarjs/jobs": "8.0.0-canary.3313",
64
+ "@cedarjs/project-config": "8.0.0-canary.3313",
65
+ "@cedarjs/server-store": "8.0.0-canary.3313",
66
+ "@cedarjs/structure": "8.0.0-canary.3313",
67
+ "@cedarjs/testing": "8.0.0-canary.3313",
68
68
  "@swc/core": "1.16.13",
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": "8.0.0-canary.3310",
98
- "@cedarjs/framework-tools": "8.0.0-canary.3310",
99
- "@cedarjs/router": "8.0.0-canary.3310",
100
- "@cedarjs/web": "8.0.0-canary.3310",
97
+ "@cedarjs/auth": "8.0.0-canary.3313",
98
+ "@cedarjs/framework-tools": "8.0.0-canary.3313",
99
+ "@cedarjs/router": "8.0.0-canary.3313",
100
+ "@cedarjs/web": "8.0.0-canary.3313",
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",
@@ -119,9 +119,9 @@
119
119
  "vitest": "4.1.11"
120
120
  },
121
121
  "peerDependencies": {
122
- "@cedarjs/auth": "8.0.0-canary.3310",
123
- "@cedarjs/router": "8.0.0-canary.3310",
124
- "@cedarjs/web": "8.0.0-canary.3310",
122
+ "@cedarjs/auth": "8.0.0-canary.3313",
123
+ "@cedarjs/router": "8.0.0-canary.3313",
124
+ "@cedarjs/web": "8.0.0-canary.3313",
125
125
  "react": "19.3.0",
126
126
  "react-dom": "19.3.0"
127
127
  },