@cedarjs/vite 5.0.0-canary.2605 → 5.0.0-canary.2606
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/buildApp.js +2 -2
- package/dist/cjs/buildApp.js +2 -2
- package/dist/cjs/index.js +8 -8
- package/dist/cjs/plugins/vite-plugin-cedar-universal-deploy.js +1 -1
- package/dist/cjs/plugins/{vite-plugin-cedar-context-wrapping.js → vite-plugin-handler-als-wrapping.js} +11 -11
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -5
- package/dist/plugins/vite-plugin-cedar-universal-deploy.js +1 -1
- package/dist/plugins/{vite-plugin-cedar-context-wrapping.d.ts → vite-plugin-handler-als-wrapping.d.ts} +5 -5
- package/dist/plugins/vite-plugin-handler-als-wrapping.d.ts.map +1 -0
- package/dist/plugins/{vite-plugin-cedar-context-wrapping.js → vite-plugin-handler-als-wrapping.js} +6 -6
- package/package.json +13 -13
- package/dist/plugins/vite-plugin-cedar-context-wrapping.d.ts.map +0 -1
package/dist/buildApp.js
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
import { findApiFiles } from "@cedarjs/internal/dist/files.js";
|
|
11
11
|
import { getConfig, getPaths, projectSideIsEsm } from "@cedarjs/project-config";
|
|
12
12
|
import { getWorkspacePackageAliases } from "./lib/workspacePackageAliases.js";
|
|
13
|
-
import {
|
|
13
|
+
import { handlerAlsWrappingPlugin } from "./plugins/vite-plugin-handler-als-wrapping.js";
|
|
14
14
|
function resolveWithExtensions(id) {
|
|
15
15
|
if (fs.existsSync(id)) {
|
|
16
16
|
return id;
|
|
@@ -225,7 +225,7 @@ async function buildCedarApp({
|
|
|
225
225
|
}
|
|
226
226
|
if (workspace.includes("api")) {
|
|
227
227
|
plugins.push(
|
|
228
|
-
|
|
228
|
+
handlerAlsWrappingPlugin({ projectIsEsm: projectSideIsEsm("api") })
|
|
229
229
|
);
|
|
230
230
|
}
|
|
231
231
|
if (babelPlugins) {
|
package/dist/cjs/buildApp.js
CHANGED
|
@@ -40,7 +40,7 @@ var import_babel_config = require("@cedarjs/babel-config");
|
|
|
40
40
|
var import_files = require("@cedarjs/internal/dist/files.js");
|
|
41
41
|
var import_project_config = require("@cedarjs/project-config");
|
|
42
42
|
var import_workspacePackageAliases = require("./lib/workspacePackageAliases.js");
|
|
43
|
-
var
|
|
43
|
+
var import_vite_plugin_handler_als_wrapping = require("./plugins/vite-plugin-handler-als-wrapping.js");
|
|
44
44
|
function resolveWithExtensions(id) {
|
|
45
45
|
if (import_node_fs.default.existsSync(id)) {
|
|
46
46
|
return id;
|
|
@@ -255,7 +255,7 @@ async function buildCedarApp({
|
|
|
255
255
|
}
|
|
256
256
|
if (workspace.includes("api")) {
|
|
257
257
|
plugins.push(
|
|
258
|
-
(0,
|
|
258
|
+
(0, import_vite_plugin_handler_als_wrapping.handlerAlsWrappingPlugin)({ projectIsEsm: (0, import_project_config.projectSideIsEsm)("api") })
|
|
259
259
|
);
|
|
260
260
|
}
|
|
261
261
|
if (babelPlugins) {
|
package/dist/cjs/index.js
CHANGED
|
@@ -28,12 +28,11 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
var index_exports = {};
|
|
30
30
|
__export(index_exports, {
|
|
31
|
-
|
|
31
|
+
applyHandlerAlsWrapping: () => import_vite_plugin_handler_als_wrapping2.applyHandlerAlsWrapping,
|
|
32
32
|
cedar: () => cedar,
|
|
33
33
|
cedarAutoImportsPlugin: () => import_vite_plugin_cedar_auto_import.cedarAutoImportsPlugin,
|
|
34
34
|
cedarCellTransform: () => import_vite_plugin_cedar_cell2.cedarCellTransform,
|
|
35
35
|
cedarCjsCompatPlugin: () => import_vite_plugin_cedar_cjs_compat.cedarCjsCompatPlugin,
|
|
36
|
-
cedarContextWrappingPlugin: () => import_vite_plugin_cedar_context_wrapping.cedarContextWrappingPlugin,
|
|
37
36
|
cedarDataUriShim: () => import_vite_plugin_cedar_data_uri_shim2.cedarDataUriShim,
|
|
38
37
|
cedarEntryInjectionPlugin: () => import_vite_plugin_cedar_entry_injection2.cedarEntryInjectionPlugin,
|
|
39
38
|
cedarHtmlEnvPlugin: () => import_vite_plugin_cedar_html_env2.cedarHtmlEnvPlugin,
|
|
@@ -48,7 +47,8 @@ __export(index_exports, {
|
|
|
48
47
|
cedarWaitForApiServer: () => import_vite_plugin_cedar_wait_for_api_server2.cedarWaitForApiServer,
|
|
49
48
|
cedarjsJobPathInjectorPlugin: () => import_vite_plugin_cedarjs_job_path_injector.cedarjsJobPathInjectorPlugin,
|
|
50
49
|
cedarjsResolveCedarStyleImportsPlugin: () => import_vite_plugin_cedarjs_resolve_cedar_style_imports2.cedarjsResolveCedarStyleImportsPlugin,
|
|
51
|
-
default: () => index_default
|
|
50
|
+
default: () => index_default,
|
|
51
|
+
handlerAlsWrappingPlugin: () => import_vite_plugin_handler_als_wrapping.handlerAlsWrappingPlugin
|
|
52
52
|
});
|
|
53
53
|
module.exports = __toCommonJS(index_exports);
|
|
54
54
|
var import_plugin_react = __toESM(require("@vitejs/plugin-react"), 1);
|
|
@@ -70,8 +70,8 @@ var import_vite_plugin_swap_apollo_provider = require("./plugins/vite-plugin-swa
|
|
|
70
70
|
var import_vite_plugin_cedar_auto_import = require("./plugins/vite-plugin-cedar-auto-import.js");
|
|
71
71
|
var import_vite_plugin_cedar_cjs_compat = require("./plugins/vite-plugin-cedar-cjs-compat.js");
|
|
72
72
|
var import_vite_plugin_cedar_cell2 = require("./plugins/vite-plugin-cedar-cell.js");
|
|
73
|
-
var
|
|
74
|
-
var
|
|
73
|
+
var import_vite_plugin_handler_als_wrapping = require("./plugins/vite-plugin-handler-als-wrapping.js");
|
|
74
|
+
var import_vite_plugin_handler_als_wrapping2 = require("./plugins/vite-plugin-handler-als-wrapping.js");
|
|
75
75
|
var import_vite_plugin_cedar_entry_injection2 = require("./plugins/vite-plugin-cedar-entry-injection.js");
|
|
76
76
|
var import_vite_plugin_cedar_html_env2 = require("./plugins/vite-plugin-cedar-html-env.js");
|
|
77
77
|
var import_vite_plugin_cedar_import_dir = require("./plugins/vite-plugin-cedar-import-dir.js");
|
|
@@ -118,12 +118,11 @@ function cedar({ mode } = {}) {
|
|
|
118
118
|
var index_default = cedar;
|
|
119
119
|
// Annotate the CommonJS export names for ESM import in node:
|
|
120
120
|
0 && (module.exports = {
|
|
121
|
-
|
|
121
|
+
applyHandlerAlsWrapping,
|
|
122
122
|
cedar,
|
|
123
123
|
cedarAutoImportsPlugin,
|
|
124
124
|
cedarCellTransform,
|
|
125
125
|
cedarCjsCompatPlugin,
|
|
126
|
-
cedarContextWrappingPlugin,
|
|
127
126
|
cedarDataUriShim,
|
|
128
127
|
cedarEntryInjectionPlugin,
|
|
129
128
|
cedarHtmlEnvPlugin,
|
|
@@ -137,5 +136,6 @@ var index_default = cedar;
|
|
|
137
136
|
cedarUniversalDeployPlugin,
|
|
138
137
|
cedarWaitForApiServer,
|
|
139
138
|
cedarjsJobPathInjectorPlugin,
|
|
140
|
-
cedarjsResolveCedarStyleImportsPlugin
|
|
139
|
+
cedarjsResolveCedarStyleImportsPlugin,
|
|
140
|
+
handlerAlsWrappingPlugin
|
|
141
141
|
});
|
|
@@ -329,7 +329,7 @@ async function generateFunctionModule(distPath) {
|
|
|
329
329
|
const ctx = await buildCedarContext(request);
|
|
330
330
|
// Wrap the handler in an AsyncLocalStorage run so the global
|
|
331
331
|
// @cedarjs/context is available inside it (and isolated per request).
|
|
332
|
-
// Mirrors the GraphQL module above and the
|
|
332
|
+
// Mirrors the GraphQL module above and the handlerAlsWrappingPlugin
|
|
333
333
|
// used for non-UD builds.
|
|
334
334
|
const { getAsyncStoreInstance } = await import(
|
|
335
335
|
'@cedarjs/context/dist/store'
|
|
@@ -26,20 +26,20 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var
|
|
30
|
-
__export(
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
var vite_plugin_handler_als_wrapping_exports = {};
|
|
30
|
+
__export(vite_plugin_handler_als_wrapping_exports, {
|
|
31
|
+
applyHandlerAlsWrapping: () => applyHandlerAlsWrapping,
|
|
32
|
+
handlerAlsWrappingPlugin: () => handlerAlsWrappingPlugin
|
|
33
33
|
});
|
|
34
|
-
module.exports = __toCommonJS(
|
|
34
|
+
module.exports = __toCommonJS(vite_plugin_handler_als_wrapping_exports);
|
|
35
35
|
var import_node_path = __toESM(require("node:path"), 1);
|
|
36
36
|
var import_vite = require("vite");
|
|
37
37
|
var import_project_config = require("@cedarjs/project-config");
|
|
38
|
-
function
|
|
38
|
+
function handlerAlsWrappingPlugin({
|
|
39
39
|
projectIsEsm = false
|
|
40
40
|
} = {}) {
|
|
41
41
|
return {
|
|
42
|
-
name: "
|
|
42
|
+
name: "handler-als-wrapping",
|
|
43
43
|
transform(code, id) {
|
|
44
44
|
let paths;
|
|
45
45
|
try {
|
|
@@ -51,12 +51,12 @@ function cedarContextWrappingPlugin({
|
|
|
51
51
|
if (!(0, import_vite.normalizePath)(id).startsWith(functionsDir + "/")) {
|
|
52
52
|
return null;
|
|
53
53
|
}
|
|
54
|
-
const wrapped =
|
|
54
|
+
const wrapped = applyHandlerAlsWrapping(code, { projectIsEsm });
|
|
55
55
|
return wrapped ? { code: wrapped, map: null } : null;
|
|
56
56
|
}
|
|
57
57
|
};
|
|
58
58
|
}
|
|
59
|
-
function
|
|
59
|
+
function applyHandlerAlsWrapping(code, { projectIsEsm = false } = {}) {
|
|
60
60
|
const handlerRe = /^export\s+(?:const|let|var)\s+handler(?:[^=]|=>)*?=(?![>=])/m;
|
|
61
61
|
const handlerMatch = handlerRe.exec(code);
|
|
62
62
|
if (!handlerMatch) {
|
|
@@ -90,6 +90,6 @@ export const handler = ${isAsync ? "async " : ""}(__rw_event, __rw__context) =>
|
|
|
90
90
|
}
|
|
91
91
|
// Annotate the CommonJS export names for ESM import in node:
|
|
92
92
|
0 && (module.exports = {
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
applyHandlerAlsWrapping,
|
|
94
|
+
handlerAlsWrappingPlugin
|
|
95
95
|
});
|
package/dist/index.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import type { PluginOption } from 'vite';
|
|
|
2
2
|
export { cedarAutoImportsPlugin } from './plugins/vite-plugin-cedar-auto-import.js';
|
|
3
3
|
export { cedarCjsCompatPlugin } from './plugins/vite-plugin-cedar-cjs-compat.js';
|
|
4
4
|
export { cedarCellTransform } from './plugins/vite-plugin-cedar-cell.js';
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
5
|
+
export { handlerAlsWrappingPlugin } from './plugins/vite-plugin-handler-als-wrapping.js';
|
|
6
|
+
export { applyHandlerAlsWrapping } from './plugins/vite-plugin-handler-als-wrapping.js';
|
|
7
7
|
export { cedarEntryInjectionPlugin } from './plugins/vite-plugin-cedar-entry-injection.js';
|
|
8
8
|
export { cedarHtmlEnvPlugin } from './plugins/vite-plugin-cedar-html-env.js';
|
|
9
9
|
export { cedarImportDirPlugin } from './plugins/vite-plugin-cedar-import-dir.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,MAAM,CAAA;AAuBxC,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,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA;AAuBxC,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,wBAAwB,EAAE,MAAM,+CAA+C,CAAA;AACxF,OAAO,EAAE,uBAAuB,EAAE,MAAM,+CAA+C,CAAA;AACvF,OAAO,EAAE,yBAAyB,EAAE,MAAM,gDAAgD,CAAA;AAC1F,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAA;AAC5E,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAA;AAChF,OAAO,EAAE,gBAAgB,EAAE,MAAM,8CAA8C,CAAA;AAC/E,OAAO,EAAE,4BAA4B,EAAE,MAAM,4DAA4D,CAAA;AACzG,OAAO,EAAE,2BAA2B,EAAE,MAAM,mDAAmD,CAAA;AAC/F,OAAO,EAAE,qBAAqB,EAAE,MAAM,mDAAmD,CAAA;AACzF,OAAO,EAAE,qCAAqC,EAAE,MAAM,8DAA8D,CAAA;AACpH,OAAO,EAAE,4BAA4B,EAAE,MAAM,oDAAoD,CAAA;AACjG,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAA;AAC3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAA;AAC1E,OAAO,EAAE,uBAAuB,EAAE,MAAM,+CAA+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;CAC1B,CAAA;AAED;;GAEG;AACH,wBAAgB,KAAK,CAAC,EAAE,IAAI,EAAE,GAAE,aAAkB,GAAG,YAAY,EAAE,CAgClE;AAED,8DAA8D;AAC9D,eAAe,KAAK,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -21,8 +21,8 @@ import { cedarSwapApolloProvider } from "./plugins/vite-plugin-swap-apollo-provi
|
|
|
21
21
|
import { cedarAutoImportsPlugin } from "./plugins/vite-plugin-cedar-auto-import.js";
|
|
22
22
|
import { cedarCjsCompatPlugin } from "./plugins/vite-plugin-cedar-cjs-compat.js";
|
|
23
23
|
import { cedarCellTransform as cedarCellTransform2 } from "./plugins/vite-plugin-cedar-cell.js";
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
24
|
+
import { handlerAlsWrappingPlugin } from "./plugins/vite-plugin-handler-als-wrapping.js";
|
|
25
|
+
import { applyHandlerAlsWrapping } from "./plugins/vite-plugin-handler-als-wrapping.js";
|
|
26
26
|
import { cedarEntryInjectionPlugin as cedarEntryInjectionPlugin2 } from "./plugins/vite-plugin-cedar-entry-injection.js";
|
|
27
27
|
import { cedarHtmlEnvPlugin as cedarHtmlEnvPlugin2 } from "./plugins/vite-plugin-cedar-html-env.js";
|
|
28
28
|
import { cedarImportDirPlugin } from "./plugins/vite-plugin-cedar-import-dir.js";
|
|
@@ -68,12 +68,11 @@ function cedar({ mode } = {}) {
|
|
|
68
68
|
}
|
|
69
69
|
var index_default = cedar;
|
|
70
70
|
export {
|
|
71
|
-
|
|
71
|
+
applyHandlerAlsWrapping,
|
|
72
72
|
cedar,
|
|
73
73
|
cedarAutoImportsPlugin,
|
|
74
74
|
cedarCellTransform2 as cedarCellTransform,
|
|
75
75
|
cedarCjsCompatPlugin,
|
|
76
|
-
cedarContextWrappingPlugin,
|
|
77
76
|
cedarDataUriShim2 as cedarDataUriShim,
|
|
78
77
|
cedarEntryInjectionPlugin2 as cedarEntryInjectionPlugin,
|
|
79
78
|
cedarHtmlEnvPlugin2 as cedarHtmlEnvPlugin,
|
|
@@ -88,5 +87,6 @@ export {
|
|
|
88
87
|
cedarWaitForApiServer2 as cedarWaitForApiServer,
|
|
89
88
|
cedarjsJobPathInjectorPlugin,
|
|
90
89
|
cedarjsResolveCedarStyleImportsPlugin2 as cedarjsResolveCedarStyleImportsPlugin,
|
|
91
|
-
index_default as default
|
|
90
|
+
index_default as default,
|
|
91
|
+
handlerAlsWrappingPlugin
|
|
92
92
|
};
|
|
@@ -296,7 +296,7 @@ async function generateFunctionModule(distPath) {
|
|
|
296
296
|
const ctx = await buildCedarContext(request);
|
|
297
297
|
// Wrap the handler in an AsyncLocalStorage run so the global
|
|
298
298
|
// @cedarjs/context is available inside it (and isolated per request).
|
|
299
|
-
// Mirrors the GraphQL module above and the
|
|
299
|
+
// Mirrors the GraphQL module above and the handlerAlsWrappingPlugin
|
|
300
300
|
// used for non-UD builds.
|
|
301
301
|
const { getAsyncStoreInstance } = await import(
|
|
302
302
|
'@cedarjs/context/dist/store'
|
|
@@ -22,10 +22,10 @@ import type { Plugin } from 'vite';
|
|
|
22
22
|
* return __rw_handler(__rw_event, __rw__context)
|
|
23
23
|
* }
|
|
24
24
|
*
|
|
25
|
-
* This replaces `babel-plugin-
|
|
25
|
+
* This replaces `babel-plugin-handler-als-wrapping` for Vite builds.
|
|
26
26
|
* The babel plugin is still used for Jest and prerender.
|
|
27
27
|
*/
|
|
28
|
-
export declare function
|
|
28
|
+
export declare function handlerAlsWrappingPlugin({ projectIsEsm, }?: {
|
|
29
29
|
projectIsEsm?: boolean;
|
|
30
30
|
}): Plugin;
|
|
31
31
|
/**
|
|
@@ -34,11 +34,11 @@ export declare function cedarContextWrappingPlugin({ projectIsEsm, }?: {
|
|
|
34
34
|
* export a `handler`.
|
|
35
35
|
*
|
|
36
36
|
* This is the context-isolation safeguard that used to be performed by
|
|
37
|
-
* `babel-plugin-
|
|
37
|
+
* `babel-plugin-handler-als-wrapping`. It is exported as a standalone
|
|
38
38
|
* function so it can be applied from build pipelines that don't go through
|
|
39
39
|
* Vite's plugin pipeline (e.g. the legacy esbuild API build).
|
|
40
40
|
*/
|
|
41
|
-
export declare function
|
|
41
|
+
export declare function applyHandlerAlsWrapping(code: string, { projectIsEsm }?: {
|
|
42
42
|
projectIsEsm?: boolean;
|
|
43
43
|
}): string | null;
|
|
44
|
-
//# sourceMappingURL=vite-plugin-
|
|
44
|
+
//# sourceMappingURL=vite-plugin-handler-als-wrapping.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vite-plugin-handler-als-wrapping.d.ts","sourceRoot":"","sources":["../../src/plugins/vite-plugin-handler-als-wrapping.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAKlC;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,wBAAwB,CAAC,EACvC,YAAoB,GACrB,GAAE;IACD,YAAY,CAAC,EAAE,OAAO,CAAA;CAClB,GAAG,MAAM,CAuBd;AAED;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,MAAM,EACZ,EAAE,YAAoB,EAAE,GAAE;IAAE,YAAY,CAAC,EAAE,OAAO,CAAA;CAAO,GACxD,MAAM,GAAG,IAAI,CAsDf"}
|
package/dist/plugins/{vite-plugin-cedar-context-wrapping.js → vite-plugin-handler-als-wrapping.js}
RENAMED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import { normalizePath } from "vite";
|
|
3
3
|
import { getPaths } from "@cedarjs/project-config";
|
|
4
|
-
function
|
|
4
|
+
function handlerAlsWrappingPlugin({
|
|
5
5
|
projectIsEsm = false
|
|
6
6
|
} = {}) {
|
|
7
7
|
return {
|
|
8
|
-
name: "
|
|
8
|
+
name: "handler-als-wrapping",
|
|
9
9
|
transform(code, id) {
|
|
10
10
|
let paths;
|
|
11
11
|
try {
|
|
@@ -17,12 +17,12 @@ function cedarContextWrappingPlugin({
|
|
|
17
17
|
if (!normalizePath(id).startsWith(functionsDir + "/")) {
|
|
18
18
|
return null;
|
|
19
19
|
}
|
|
20
|
-
const wrapped =
|
|
20
|
+
const wrapped = applyHandlerAlsWrapping(code, { projectIsEsm });
|
|
21
21
|
return wrapped ? { code: wrapped, map: null } : null;
|
|
22
22
|
}
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
|
-
function
|
|
25
|
+
function applyHandlerAlsWrapping(code, { projectIsEsm = false } = {}) {
|
|
26
26
|
const handlerRe = /^export\s+(?:const|let|var)\s+handler(?:[^=]|=>)*?=(?![>=])/m;
|
|
27
27
|
const handlerMatch = handlerRe.exec(code);
|
|
28
28
|
if (!handlerMatch) {
|
|
@@ -55,6 +55,6 @@ export const handler = ${isAsync ? "async " : ""}(__rw_event, __rw__context) =>
|
|
|
55
55
|
return before + importStatement + renamed + wrappedHandler;
|
|
56
56
|
}
|
|
57
57
|
export {
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
applyHandlerAlsWrapping,
|
|
59
|
+
handlerAlsWrappingPlugin
|
|
60
60
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/vite",
|
|
3
|
-
"version": "5.0.0-canary.
|
|
3
|
+
"version": "5.0.0-canary.2606",
|
|
4
4
|
"description": "Vite configuration package for CedarJS",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -63,15 +63,15 @@
|
|
|
63
63
|
"@babel/parser": "7.29.7",
|
|
64
64
|
"@babel/traverse": "7.29.7",
|
|
65
65
|
"@babel/types": "7.29.7",
|
|
66
|
-
"@cedarjs/api": "5.0.0-canary.
|
|
67
|
-
"@cedarjs/babel-config": "5.0.0-canary.
|
|
68
|
-
"@cedarjs/context": "5.0.0-canary.
|
|
69
|
-
"@cedarjs/cookie-jar": "5.0.0-canary.
|
|
70
|
-
"@cedarjs/graphql-server": "5.0.0-canary.
|
|
71
|
-
"@cedarjs/internal": "5.0.0-canary.
|
|
72
|
-
"@cedarjs/project-config": "5.0.0-canary.
|
|
73
|
-
"@cedarjs/server-store": "5.0.0-canary.
|
|
74
|
-
"@cedarjs/testing": "5.0.0-canary.
|
|
66
|
+
"@cedarjs/api": "5.0.0-canary.2606",
|
|
67
|
+
"@cedarjs/babel-config": "5.0.0-canary.2606",
|
|
68
|
+
"@cedarjs/context": "5.0.0-canary.2606",
|
|
69
|
+
"@cedarjs/cookie-jar": "5.0.0-canary.2606",
|
|
70
|
+
"@cedarjs/graphql-server": "5.0.0-canary.2606",
|
|
71
|
+
"@cedarjs/internal": "5.0.0-canary.2606",
|
|
72
|
+
"@cedarjs/project-config": "5.0.0-canary.2606",
|
|
73
|
+
"@cedarjs/server-store": "5.0.0-canary.2606",
|
|
74
|
+
"@cedarjs/testing": "5.0.0-canary.2606",
|
|
75
75
|
"@fastify/url-data": "6.0.3",
|
|
76
76
|
"@swc/core": "1.15.41",
|
|
77
77
|
"@universal-deploy/store": "^0.2.1",
|
|
@@ -103,9 +103,9 @@
|
|
|
103
103
|
},
|
|
104
104
|
"devDependencies": {
|
|
105
105
|
"@arethetypeswrong/cli": "0.18.4",
|
|
106
|
-
"@cedarjs/auth": "5.0.0-canary.
|
|
107
|
-
"@cedarjs/router": "5.0.0-canary.
|
|
108
|
-
"@cedarjs/web": "5.0.0-canary.
|
|
106
|
+
"@cedarjs/auth": "5.0.0-canary.2606",
|
|
107
|
+
"@cedarjs/router": "5.0.0-canary.2606",
|
|
108
|
+
"@cedarjs/web": "5.0.0-canary.2606",
|
|
109
109
|
"@hyrious/esbuild-plugin-commonjs": "0.2.6",
|
|
110
110
|
"@jridgewell/trace-mapping": "0.3.31",
|
|
111
111
|
"@types/aws-lambda": "8.10.162",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vite-plugin-cedar-context-wrapping.d.ts","sourceRoot":"","sources":["../../src/plugins/vite-plugin-cedar-context-wrapping.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAKlC;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,0BAA0B,CAAC,EACzC,YAAoB,GACrB,GAAE;IACD,YAAY,CAAC,EAAE,OAAO,CAAA;CAClB,GAAG,MAAM,CAuBd;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,MAAM,EACZ,EAAE,YAAoB,EAAE,GAAE;IAAE,YAAY,CAAC,EAAE,OAAO,CAAA;CAAO,GACxD,MAAM,GAAG,IAAI,CAsDf"}
|