@cedarjs/vite 6.0.0-canary.2796 → 6.0.0-canary.2799
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 +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -0
- package/dist/plugins/vite-plugin-cedar-api-import-guard.d.ts +13 -0
- package/dist/plugins/vite-plugin-cedar-api-import-guard.d.ts.map +1 -0
- package/dist/plugins/vite-plugin-cedar-api-import-guard.js +17 -0
- package/dist/plugins/vite-plugin-cedarjs-resolve-cedar-style-imports.d.ts.map +1 -1
- package/dist/plugins/vite-plugin-cedarjs-resolve-cedar-style-imports.js +1 -1
- package/package.json +18 -18
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { BabelOptions } from '@vitejs/plugin-react';
|
|
2
2
|
import type { PluginOption } from 'vite';
|
|
3
|
+
export { cedarApiImportGuardPlugin } from './plugins/vite-plugin-cedar-api-import-guard.js';
|
|
3
4
|
export { cedarAutoImportsPlugin } from './plugins/vite-plugin-cedar-auto-import.js';
|
|
4
5
|
export { cedarCjsCompatPlugin } from './plugins/vite-plugin-cedar-cjs-compat.js';
|
|
5
6
|
export { cedarCellTransform } from './plugins/vite-plugin-cedar-cell.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -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;
|
|
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;AAqCxC,O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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
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
cedarVitestWebConfigPlugin,
|
|
14
14
|
createAuthImportTransformPlugin
|
|
15
15
|
} from "@cedarjs/testing/web/vitest";
|
|
16
|
+
import { cedarApiImportGuardPlugin } from "./plugins/vite-plugin-cedar-api-import-guard.js";
|
|
16
17
|
import { cedarAutoImportsPlugin } from "./plugins/vite-plugin-cedar-auto-import.js";
|
|
17
18
|
import { cedarCellTransform } from "./plugins/vite-plugin-cedar-cell.js";
|
|
18
19
|
import { cedarDataUriShim } from "./plugins/vite-plugin-cedar-data-uri-shim.js";
|
|
@@ -27,6 +28,7 @@ import { cedarjsResolveCedarStyleImportsPlugin } from "./plugins/vite-plugin-ced
|
|
|
27
28
|
import { cedarTransformJsAsJsx } from "./plugins/vite-plugin-jsx-loader.js";
|
|
28
29
|
import { cedarMergedConfig } from "./plugins/vite-plugin-merged-config.js";
|
|
29
30
|
import { cedarSwapApolloProvider } from "./plugins/vite-plugin-swap-apollo-provider.js";
|
|
31
|
+
import { cedarApiImportGuardPlugin as cedarApiImportGuardPlugin2 } from "./plugins/vite-plugin-cedar-api-import-guard.js";
|
|
30
32
|
import { cedarAutoImportsPlugin as cedarAutoImportsPlugin2 } from "./plugins/vite-plugin-cedar-auto-import.js";
|
|
31
33
|
import { cedarCjsCompatPlugin } from "./plugins/vite-plugin-cedar-cjs-compat.js";
|
|
32
34
|
import { cedarCellTransform as cedarCellTransform2 } from "./plugins/vite-plugin-cedar-cell.js";
|
|
@@ -63,6 +65,9 @@ function cedar({ mode, babel } = {}) {
|
|
|
63
65
|
plugins: [...compilerPlugins, ...babel?.plugins ?? []]
|
|
64
66
|
} : void 0;
|
|
65
67
|
return [
|
|
68
|
+
// Has to come before tsconfigPaths(), which would otherwise resolve
|
|
69
|
+
// `$api/*` imports using the project's web/tsconfig.json `paths` mapping
|
|
70
|
+
cedarApiImportGuardPlugin(),
|
|
66
71
|
tsconfigPaths(),
|
|
67
72
|
gqlTagPlugin(),
|
|
68
73
|
mode === "test" && cedarJsRouterImportTransformPlugin(),
|
|
@@ -91,6 +96,7 @@ var index_default = cedar;
|
|
|
91
96
|
export {
|
|
92
97
|
applyHandlerAlsWrapping,
|
|
93
98
|
cedar,
|
|
99
|
+
cedarApiImportGuardPlugin2 as cedarApiImportGuardPlugin,
|
|
94
100
|
cedarAutoImportsPlugin2 as cedarAutoImportsPlugin,
|
|
95
101
|
cedarCellTransform2 as cedarCellTransform,
|
|
96
102
|
cedarCjsCompatPlugin,
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Plugin } from 'vite';
|
|
2
|
+
/**
|
|
3
|
+
* `$api/` imports resolve to files on the api side. They're only supported in
|
|
4
|
+
* `*.routeHooks.{js,ts}` files and in scripts run with `yarn cedar exec` – both
|
|
5
|
+
* of which run on the server. This plugin makes a `$api/` import from code that
|
|
6
|
+
* ends up in the browser bundle fail with an explanatory error instead of
|
|
7
|
+
* silently bundling server-only code (like the Prisma client) into the browser.
|
|
8
|
+
*
|
|
9
|
+
* Has to run before `vite-tsconfig-paths`, which would otherwise resolve
|
|
10
|
+
* `$api/*` using the `paths` mapping in the project's `web/tsconfig.json`.
|
|
11
|
+
*/
|
|
12
|
+
export declare function cedarApiImportGuardPlugin(): Plugin;
|
|
13
|
+
//# sourceMappingURL=vite-plugin-cedar-api-import-guard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vite-plugin-cedar-api-import-guard.d.ts","sourceRoot":"","sources":["../../src/plugins/vite-plugin-cedar-api-import-guard.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAElC;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,IAAI,MAAM,CA0BlD"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
function cedarApiImportGuardPlugin() {
|
|
2
|
+
return {
|
|
3
|
+
name: "cedar-api-import-guard",
|
|
4
|
+
enforce: "pre",
|
|
5
|
+
resolveId(id, importer) {
|
|
6
|
+
if (this.environment?.name !== "client" || !id.startsWith("$api/")) {
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
throw new Error(
|
|
10
|
+
`Cannot import "${id}" from client-side code` + (importer ? ` (imported by "${importer}")` : "") + '.\n\n"$api/" imports resolve to your api side, which must never end up in the browser bundle. They\'re only supported in server-side code, like *.routeHooks.{js,ts} files and scripts run with `yarn cedar exec`.\n\nIf you need this data in the browser, fetch it through GraphQL instead.'
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
cedarApiImportGuardPlugin
|
|
17
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite-plugin-cedarjs-resolve-cedar-style-imports.d.ts","sourceRoot":"","sources":["../../src/plugins/vite-plugin-cedarjs-resolve-cedar-style-imports.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAiClC,wBAAgB,qCAAqC,IAAI,MAAM,
|
|
1
|
+
{"version":3,"file":"vite-plugin-cedarjs-resolve-cedar-style-imports.d.ts","sourceRoot":"","sources":["../../src/plugins/vite-plugin-cedarjs-resolve-cedar-style-imports.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAiClC,wBAAgB,qCAAqC,IAAI,MAAM,CAwG9D"}
|
|
@@ -52,7 +52,7 @@ function cedarjsResolveCedarStyleImportsPlugin() {
|
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
|
-
if (cedarPaths && id.startsWith("$api/")) {
|
|
55
|
+
if (cedarPaths && id.startsWith("$api/") && this.environment?.name !== "client") {
|
|
56
56
|
const resolved = resolveFromAbsolutePath(
|
|
57
57
|
path.join(cedarPaths.api.base, id.slice("$api/".length))
|
|
58
58
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/vite",
|
|
3
|
-
"version": "6.0.0-canary.
|
|
3
|
+
"version": "6.0.0-canary.2799",
|
|
4
4
|
"description": "Vite configuration package for CedarJS",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -53,16 +53,16 @@
|
|
|
53
53
|
"@babel/parser": "7.29.7",
|
|
54
54
|
"@babel/traverse": "7.29.7",
|
|
55
55
|
"@babel/types": "7.29.7",
|
|
56
|
-
"@cedarjs/api": "6.0.0-canary.
|
|
57
|
-
"@cedarjs/api-server": "6.0.0-canary.
|
|
58
|
-
"@cedarjs/babel-config": "6.0.0-canary.
|
|
59
|
-
"@cedarjs/context": "6.0.0-canary.
|
|
60
|
-
"@cedarjs/graphql-server": "6.0.0-canary.
|
|
61
|
-
"@cedarjs/internal": "6.0.0-canary.
|
|
62
|
-
"@cedarjs/project-config": "6.0.0-canary.
|
|
63
|
-
"@cedarjs/server-store": "6.0.0-canary.
|
|
64
|
-
"@cedarjs/structure": "6.0.0-canary.
|
|
65
|
-
"@cedarjs/testing": "6.0.0-canary.
|
|
56
|
+
"@cedarjs/api": "6.0.0-canary.2799",
|
|
57
|
+
"@cedarjs/api-server": "6.0.0-canary.2799",
|
|
58
|
+
"@cedarjs/babel-config": "6.0.0-canary.2799",
|
|
59
|
+
"@cedarjs/context": "6.0.0-canary.2799",
|
|
60
|
+
"@cedarjs/graphql-server": "6.0.0-canary.2799",
|
|
61
|
+
"@cedarjs/internal": "6.0.0-canary.2799",
|
|
62
|
+
"@cedarjs/project-config": "6.0.0-canary.2799",
|
|
63
|
+
"@cedarjs/server-store": "6.0.0-canary.2799",
|
|
64
|
+
"@cedarjs/structure": "6.0.0-canary.2799",
|
|
65
|
+
"@cedarjs/testing": "6.0.0-canary.2799",
|
|
66
66
|
"@swc/core": "1.15.46",
|
|
67
67
|
"@universal-deploy/store": "^0.2.1",
|
|
68
68
|
"@universal-deploy/vite": "^0.1.9",
|
|
@@ -93,10 +93,10 @@
|
|
|
93
93
|
"yargs-parser": "21.1.1"
|
|
94
94
|
},
|
|
95
95
|
"devDependencies": {
|
|
96
|
-
"@cedarjs/auth": "6.0.0-canary.
|
|
97
|
-
"@cedarjs/framework-tools": "6.0.0-canary.
|
|
98
|
-
"@cedarjs/router": "6.0.0-canary.
|
|
99
|
-
"@cedarjs/web": "6.0.0-canary.
|
|
96
|
+
"@cedarjs/auth": "6.0.0-canary.2799",
|
|
97
|
+
"@cedarjs/framework-tools": "6.0.0-canary.2799",
|
|
98
|
+
"@cedarjs/router": "6.0.0-canary.2799",
|
|
99
|
+
"@cedarjs/web": "6.0.0-canary.2799",
|
|
100
100
|
"@dr.pogodin/react-helmet": "2.0.4",
|
|
101
101
|
"@hyrious/esbuild-plugin-commonjs": "0.2.6",
|
|
102
102
|
"@jridgewell/trace-mapping": "0.3.31",
|
|
@@ -116,9 +116,9 @@
|
|
|
116
116
|
"vitest": "4.1.10"
|
|
117
117
|
},
|
|
118
118
|
"peerDependencies": {
|
|
119
|
-
"@cedarjs/auth": "6.0.0-canary.
|
|
120
|
-
"@cedarjs/router": "6.0.0-canary.
|
|
121
|
-
"@cedarjs/web": "6.0.0-canary.
|
|
119
|
+
"@cedarjs/auth": "6.0.0-canary.2799",
|
|
120
|
+
"@cedarjs/router": "6.0.0-canary.2799",
|
|
121
|
+
"@cedarjs/web": "6.0.0-canary.2799"
|
|
122
122
|
},
|
|
123
123
|
"engines": {
|
|
124
124
|
"node": ">=24"
|