@cedarjs/internal 5.0.0-canary.2614 → 5.0.0-rc.273
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/build/api.js +3 -3
- package/dist/build/esbuild-plugin-cedar-context-wrapping.d.ts +4 -0
- package/dist/build/esbuild-plugin-cedar-context-wrapping.d.ts.map +1 -0
- package/dist/build/{esbuild-plugin-handler-als-wrapping.js → esbuild-plugin-cedar-context-wrapping.js} +2 -2
- package/dist/cjs/build/api.js +3 -3
- package/dist/cjs/build/esbuild-plugin-cedar-context-wrapping.d.ts +4 -0
- package/dist/cjs/build/esbuild-plugin-cedar-context-wrapping.d.ts.map +1 -0
- package/dist/cjs/build/{esbuild-plugin-handler-als-wrapping.js → esbuild-plugin-cedar-context-wrapping.js} +6 -6
- package/package.json +9 -9
- package/dist/build/esbuild-plugin-handler-als-wrapping.d.ts +0 -4
- package/dist/build/esbuild-plugin-handler-als-wrapping.d.ts.map +0 -1
- package/dist/cjs/build/esbuild-plugin-handler-als-wrapping.d.ts +0 -4
- package/dist/cjs/build/esbuild-plugin-handler-als-wrapping.d.ts.map +0 -1
package/dist/build/api.js
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
} from "@cedarjs/babel-config";
|
|
9
9
|
import { getConfig, getPaths, projectSideIsEsm } from "@cedarjs/project-config";
|
|
10
10
|
import { findApiFiles } from "../files.js";
|
|
11
|
-
import {
|
|
11
|
+
import { applyContextWrapping } from "./esbuild-plugin-cedar-context-wrapping.js";
|
|
12
12
|
let BUILD_CTX = null;
|
|
13
13
|
const buildApi = async () => {
|
|
14
14
|
BUILD_CTX?.dispose();
|
|
@@ -47,7 +47,7 @@ const runCedarBabelTransformsPlugin = {
|
|
|
47
47
|
const functionsDir = normalizePath(
|
|
48
48
|
path.join(getPaths().api.src, "functions")
|
|
49
49
|
);
|
|
50
|
-
const code = normalizePath(args.path).startsWith(functionsDir + "/") ?
|
|
50
|
+
const code = normalizePath(args.path).startsWith(functionsDir + "/") ? applyContextWrapping(transformedCode.code, {
|
|
51
51
|
projectIsEsm: projectSideIsEsm("api")
|
|
52
52
|
}) ?? transformedCode.code : transformedCode.code;
|
|
53
53
|
return {
|
|
@@ -89,7 +89,7 @@ function createCedarViteApiPlugin() {
|
|
|
89
89
|
const functionsDir = normalizePath(
|
|
90
90
|
path.join(cedarPaths.api.src, "functions")
|
|
91
91
|
);
|
|
92
|
-
const code2 = normalizePath(id).startsWith(functionsDir + "/") ?
|
|
92
|
+
const code2 = normalizePath(id).startsWith(functionsDir + "/") ? applyContextWrapping(transformedCode.code, {
|
|
93
93
|
projectIsEsm: isEsm
|
|
94
94
|
}) ?? transformedCode.code : transformedCode.code;
|
|
95
95
|
return {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"esbuild-plugin-cedar-context-wrapping.d.ts","sourceRoot":"","sources":["../../src/build/esbuild-plugin-cedar-context-wrapping.ts"],"names":[],"mappings":"AAOA,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,MAAM,EACZ,EAAE,YAAoB,EAAE,GAAE;IAAE,YAAY,CAAC,EAAE,OAAO,CAAA;CAAO,GACxD,MAAM,GAAG,IAAI,CA0Cf"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function
|
|
1
|
+
function applyContextWrapping(code, { projectIsEsm = false } = {}) {
|
|
2
2
|
const handlerRe = /^export\s+(?:const|let|var)\s+handler(?:[^=]|=>)*?=(?![>=])/m;
|
|
3
3
|
const handlerMatch = handlerRe.exec(code);
|
|
4
4
|
if (!handlerMatch) {
|
|
@@ -31,5 +31,5 @@ export const handler = ${isAsync ? "async " : ""}(__rw_event, __rw__context) =>
|
|
|
31
31
|
return before + importStatement + renamed + wrappedHandler;
|
|
32
32
|
}
|
|
33
33
|
export {
|
|
34
|
-
|
|
34
|
+
applyContextWrapping
|
|
35
35
|
};
|
package/dist/cjs/build/api.js
CHANGED
|
@@ -42,7 +42,7 @@ var import_vite = require("vite");
|
|
|
42
42
|
var import_babel_config = require("@cedarjs/babel-config");
|
|
43
43
|
var import_project_config = require("@cedarjs/project-config");
|
|
44
44
|
var import_files = require("../files.js");
|
|
45
|
-
var
|
|
45
|
+
var import_esbuild_plugin_cedar_context_wrapping = require("./esbuild-plugin-cedar-context-wrapping.js");
|
|
46
46
|
let BUILD_CTX = null;
|
|
47
47
|
const buildApi = async () => {
|
|
48
48
|
BUILD_CTX?.dispose();
|
|
@@ -81,7 +81,7 @@ const runCedarBabelTransformsPlugin = {
|
|
|
81
81
|
const functionsDir = (0, import_vite.normalizePath)(
|
|
82
82
|
import_node_path.default.join((0, import_project_config.getPaths)().api.src, "functions")
|
|
83
83
|
);
|
|
84
|
-
const code = (0, import_vite.normalizePath)(args.path).startsWith(functionsDir + "/") ? (0,
|
|
84
|
+
const code = (0, import_vite.normalizePath)(args.path).startsWith(functionsDir + "/") ? (0, import_esbuild_plugin_cedar_context_wrapping.applyContextWrapping)(transformedCode.code, {
|
|
85
85
|
projectIsEsm: (0, import_project_config.projectSideIsEsm)("api")
|
|
86
86
|
}) ?? transformedCode.code : transformedCode.code;
|
|
87
87
|
return {
|
|
@@ -123,7 +123,7 @@ function createCedarViteApiPlugin() {
|
|
|
123
123
|
const functionsDir = (0, import_vite.normalizePath)(
|
|
124
124
|
import_node_path.default.join(cedarPaths.api.src, "functions")
|
|
125
125
|
);
|
|
126
|
-
const code2 = (0, import_vite.normalizePath)(id).startsWith(functionsDir + "/") ? (0,
|
|
126
|
+
const code2 = (0, import_vite.normalizePath)(id).startsWith(functionsDir + "/") ? (0, import_esbuild_plugin_cedar_context_wrapping.applyContextWrapping)(transformedCode.code, {
|
|
127
127
|
projectIsEsm: isEsm
|
|
128
128
|
}) ?? transformedCode.code : transformedCode.code;
|
|
129
129
|
return {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"esbuild-plugin-cedar-context-wrapping.d.ts","sourceRoot":"","sources":["../../../src/build/esbuild-plugin-cedar-context-wrapping.ts"],"names":[],"mappings":"AAOA,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,MAAM,EACZ,EAAE,YAAoB,EAAE,GAAE;IAAE,YAAY,CAAC,EAAE,OAAO,CAAA;CAAO,GACxD,MAAM,GAAG,IAAI,CA0Cf"}
|
|
@@ -16,12 +16,12 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var
|
|
20
|
-
__export(
|
|
21
|
-
|
|
19
|
+
var esbuild_plugin_cedar_context_wrapping_exports = {};
|
|
20
|
+
__export(esbuild_plugin_cedar_context_wrapping_exports, {
|
|
21
|
+
applyContextWrapping: () => applyContextWrapping
|
|
22
22
|
});
|
|
23
|
-
module.exports = __toCommonJS(
|
|
24
|
-
function
|
|
23
|
+
module.exports = __toCommonJS(esbuild_plugin_cedar_context_wrapping_exports);
|
|
24
|
+
function applyContextWrapping(code, { projectIsEsm = false } = {}) {
|
|
25
25
|
const handlerRe = /^export\s+(?:const|let|var)\s+handler(?:[^=]|=>)*?=(?![>=])/m;
|
|
26
26
|
const handlerMatch = handlerRe.exec(code);
|
|
27
27
|
if (!handlerMatch) {
|
|
@@ -55,5 +55,5 @@ export const handler = ${isAsync ? "async " : ""}(__rw_event, __rw__context) =>
|
|
|
55
55
|
}
|
|
56
56
|
// Annotate the CommonJS export names for ESM import in node:
|
|
57
57
|
0 && (module.exports = {
|
|
58
|
-
|
|
58
|
+
applyContextWrapping
|
|
59
59
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/internal",
|
|
3
|
-
"version": "5.0.0-
|
|
3
|
+
"version": "5.0.0-rc.273",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/cedarjs/cedar.git",
|
|
@@ -159,13 +159,13 @@
|
|
|
159
159
|
"@babel/plugin-transform-react-jsx": "7.29.7",
|
|
160
160
|
"@babel/plugin-transform-typescript": "^7.26.8",
|
|
161
161
|
"@babel/traverse": "7.29.7",
|
|
162
|
-
"@cedarjs/babel-config": "5.0.0-
|
|
163
|
-
"@cedarjs/cli-helpers": "5.0.0-
|
|
164
|
-
"@cedarjs/graphql-server": "5.0.0-
|
|
165
|
-
"@cedarjs/project-config": "5.0.0-
|
|
166
|
-
"@cedarjs/router": "5.0.0-
|
|
167
|
-
"@cedarjs/structure": "5.0.0-
|
|
168
|
-
"@cedarjs/utils": "5.0.0-
|
|
162
|
+
"@cedarjs/babel-config": "5.0.0-rc.273",
|
|
163
|
+
"@cedarjs/cli-helpers": "5.0.0-rc.273",
|
|
164
|
+
"@cedarjs/graphql-server": "5.0.0-rc.273",
|
|
165
|
+
"@cedarjs/project-config": "5.0.0-rc.273",
|
|
166
|
+
"@cedarjs/router": "5.0.0-rc.273",
|
|
167
|
+
"@cedarjs/structure": "5.0.0-rc.273",
|
|
168
|
+
"@cedarjs/utils": "5.0.0-rc.273",
|
|
169
169
|
"@graphql-codegen/add": "6.0.1",
|
|
170
170
|
"@graphql-codegen/cli": "6.3.1",
|
|
171
171
|
"@graphql-codegen/client-preset": "5.3.0",
|
|
@@ -206,7 +206,7 @@
|
|
|
206
206
|
},
|
|
207
207
|
"devDependencies": {
|
|
208
208
|
"@arethetypeswrong/cli": "0.18.4",
|
|
209
|
-
"@cedarjs/framework-tools": "5.0.0-
|
|
209
|
+
"@cedarjs/framework-tools": "5.0.0-rc.273",
|
|
210
210
|
"concurrently": "9.2.1",
|
|
211
211
|
"graphql-tag": "2.12.6",
|
|
212
212
|
"publint": "0.3.21",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"esbuild-plugin-handler-als-wrapping.d.ts","sourceRoot":"","sources":["../../src/build/esbuild-plugin-handler-als-wrapping.ts"],"names":[],"mappings":"AAOA,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,MAAM,EACZ,EAAE,YAAoB,EAAE,GAAE;IAAE,YAAY,CAAC,EAAE,OAAO,CAAA;CAAO,GACxD,MAAM,GAAG,IAAI,CA0Cf"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"esbuild-plugin-handler-als-wrapping.d.ts","sourceRoot":"","sources":["../../../src/build/esbuild-plugin-handler-als-wrapping.ts"],"names":[],"mappings":"AAOA,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,MAAM,EACZ,EAAE,YAAoB,EAAE,GAAE;IAAE,YAAY,CAAC,EAAE,OAAO,CAAA;CAAO,GACxD,MAAM,GAAG,IAAI,CA0Cf"}
|