@cedarjs/babel-config 7.0.0-canary.2983 → 7.0.0-canary.2985
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/api.d.ts +4 -12
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +14 -41
- package/dist/plugins/babel-plugin-redwood-routes-auto-loader.d.ts.map +1 -1
- package/dist/web.d.ts +1 -6
- package/dist/web.d.ts.map +1 -1
- package/dist/web.js +5 -15
- package/package.json +3 -4
- package/dist/plugins/babel-plugin-handler-als-wrapping.d.ts +0 -7
- package/dist/plugins/babel-plugin-handler-als-wrapping.d.ts.map +0 -1
- package/dist/plugins/babel-plugin-handler-als-wrapping.js +0 -114
- package/dist/plugins/babel-plugin-redwood-remove-dev-fatal-error-page.d.ts +0 -5
- package/dist/plugins/babel-plugin-redwood-remove-dev-fatal-error-page.d.ts.map +0 -1
- package/dist/plugins/babel-plugin-redwood-remove-dev-fatal-error-page.js +0 -21
package/dist/api.d.ts
CHANGED
|
@@ -6,9 +6,8 @@ export declare const getApiSideBabelPresets: ({ presetEnv }?: {
|
|
|
6
6
|
}) => TransformOptions["presets"];
|
|
7
7
|
export type PluginList = PluginShape[];
|
|
8
8
|
type PluginShape = [PluginTarget, PluginOptions, undefined | string] | [PluginTarget, PluginOptions];
|
|
9
|
-
export declare const getApiSideBabelPlugins: ({ forVite
|
|
9
|
+
export declare const getApiSideBabelPlugins: ({ forVite }?: {
|
|
10
10
|
forVite?: boolean | undefined;
|
|
11
|
-
projectIsEsm?: boolean | undefined;
|
|
12
11
|
}) => PluginList;
|
|
13
12
|
/**
|
|
14
13
|
* Purpose-built equivalent of `getApiSideBabelPlugins({ forVite: true })` for
|
|
@@ -33,22 +32,15 @@ export declare const getApiSideBabelPlugins: ({ forVite, projectIsEsm, }?: {
|
|
|
33
32
|
* is why the Vite pipelines skip Babel entirely unless the project has a
|
|
34
33
|
* custom api/babel.config.js.
|
|
35
34
|
*
|
|
36
|
-
* The `projectIsEsm` option needs no equivalent here: it only affects the
|
|
37
|
-
* module-resolver `resolvePath` hook, which is a `!forVite` plugin.
|
|
38
35
|
*/
|
|
39
36
|
export declare const getApiSideBabelPluginsForVite: () => PluginList;
|
|
40
37
|
export declare const getApiSideBabelConfigPath: () => string | undefined;
|
|
41
|
-
export declare const getApiSideBabelOverrides: ({ forVite
|
|
38
|
+
export declare const getApiSideBabelOverrides: ({ forVite }?: {
|
|
42
39
|
forVite?: boolean | undefined;
|
|
43
|
-
projectIsEsm?: boolean | undefined;
|
|
44
|
-
forJest?: boolean | undefined;
|
|
45
40
|
}) => TransformOptions[];
|
|
46
41
|
/**
|
|
47
|
-
* The default api-side Babel config for
|
|
48
|
-
*
|
|
49
|
-
* wrapping override is always included: it only matches api/src/functions
|
|
50
|
-
* files, and for the parse-only ESLint consumer transform plugins have no
|
|
51
|
-
* effect.
|
|
42
|
+
* The default api-side Babel config for the Babel ESLint parser
|
|
43
|
+
* (@cedarjs/eslint-config).
|
|
52
44
|
*/
|
|
53
45
|
export declare const getApiSideDefaultBabelConfig: () => {
|
|
54
46
|
presets: import("@babel/core").PluginItem[] | null | undefined;
|
package/dist/api.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAMhF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAMhF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AAUtD,eAAO,MAAM,YAAY,OAAO,CAAA;AAEhC,eAAO,MAAM,sBAAsB,GACjC;;CAAoC,KAqBf,gBAAgB,CAAC,SAAS,CAChD,CAAA;AAKD,MAAM,MAAM,UAAU,GAAG,WAAW,EAAE,CAAA;AACtC,KAAK,WAAW,GACZ,CAAC,YAAY,EAAE,aAAa,EAAE,SAAS,GAAG,MAAM,CAAC,GACjD,CAAC,YAAY,EAAE,aAAa,CAAC,CAAA;AAEjC,eAAO,MAAM,sBAAsB,GAAI;;CAAwB,eA4G9D,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,6BAA6B,QAAO,UAEhD,CAAA;AAED,eAAO,MAAM,yBAAyB,0BAOrC,CAAA;AAED,eAAO,MAAM,wBAAwB,GAAI;;CAAwB,KAU3C,gBAAgB,EACrC,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,4BAA4B;;;;;;;CASxC,CAAA;AAGD,eAAO,MAAM,wBAAwB,GAAI,uBAGtC,mBAAwB,SAc1B,CAAA;AAED,eAAO,MAAM,kBAAkB,GAC7B,YAAY,MAAM,EAClB,UAAU,MAAM,EAChB,SAAS,gBAAgB,CAAC,SAAS,CAAC,EACpC,aAAY,gBAAgB,CAAC,YAAY,CAAY,EACrD,iBAAe,EAIf,iBAAgB,gBAAgB,CAAC,gBAAgB,CAAa,0DAoB/D,CAAA"}
|
package/dist/api.js
CHANGED
|
@@ -2,13 +2,12 @@ import fs from "node:fs";
|
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { transformAsync } from "@babel/core";
|
|
4
4
|
import { resolvePath } from "babel-plugin-module-resolver";
|
|
5
|
-
import { getPaths
|
|
5
|
+
import { getPaths } from "@cedarjs/project-config";
|
|
6
6
|
import {
|
|
7
7
|
getPathsFromTypeScriptConfig,
|
|
8
8
|
parseTypeScriptConfigFiles,
|
|
9
9
|
registerBabel
|
|
10
10
|
} from "./common.js";
|
|
11
|
-
import handlerAlsWrappingPlugin from "./plugins/babel-plugin-handler-als-wrapping.js";
|
|
12
11
|
import pluginRedwoodDirectoryNamedImport from "./plugins/babel-plugin-redwood-directory-named-import.js";
|
|
13
12
|
import pluginRedwoodImportDir from "./plugins/babel-plugin-redwood-import-dir.js";
|
|
14
13
|
import pluginRedwoodJobPathInjector from "./plugins/babel-plugin-redwood-job-path-injector.js";
|
|
@@ -35,10 +34,7 @@ const getApiSideBabelPresets = ({ presetEnv } = { presetEnv: false }) => {
|
|
|
35
34
|
]
|
|
36
35
|
].filter(Boolean);
|
|
37
36
|
};
|
|
38
|
-
const getApiSideBabelPlugins = ({
|
|
39
|
-
forVite = false,
|
|
40
|
-
projectIsEsm = false
|
|
41
|
-
} = {}) => {
|
|
37
|
+
const getApiSideBabelPlugins = ({ forVite = false } = {}) => {
|
|
42
38
|
if (forVite) {
|
|
43
39
|
return getApiSideBabelPluginsForVite();
|
|
44
40
|
}
|
|
@@ -47,14 +43,13 @@ const getApiSideBabelPlugins = ({
|
|
|
47
43
|
// Needed to support `/** @jsxImportSource custom-jsx-library */`
|
|
48
44
|
// comments in JSX files
|
|
49
45
|
["@babel/plugin-transform-react-jsx", { runtime: "automatic" }],
|
|
50
|
-
// For the non-Vite consumers this function serves (
|
|
51
|
-
//
|
|
52
|
-
// data-migrate CJS and prerender CJS):
|
|
46
|
+
// For the non-Vite consumers this function serves (the Babel ESLint
|
|
47
|
+
// parser and registerApiSideBabelHook):
|
|
53
48
|
// • alias config: rewrites `src/` and tsconfig paths to relative paths
|
|
54
|
-
// • resolvePath: appends `.js`/`.jsx` to extensionless imports
|
|
55
|
-
//
|
|
56
|
-
//
|
|
57
|
-
//
|
|
49
|
+
// • resolvePath: appends `.js`/`.jsx` to extensionless imports so Node's
|
|
50
|
+
// module resolver can find them, and strips `.js` suffixes in
|
|
51
|
+
// data-migrate / prerender contexts where the TypeScript source is
|
|
52
|
+
// `.ts` but callers write `.js` import specifiers.
|
|
58
53
|
[
|
|
59
54
|
"babel-plugin-module-resolver",
|
|
60
55
|
{
|
|
@@ -72,7 +67,7 @@ const getApiSideBabelPlugins = ({
|
|
|
72
67
|
const isPrerender = process.argv[2] === "prerender";
|
|
73
68
|
const importPath = /.*\/.*\.js$/.test(sourcePath) && (isDataMigrate || isPrerender) ? sourcePath.replace(/\.js$/, "") : sourcePath;
|
|
74
69
|
const resolvedPath = resolvePath(importPath, currentFile, opts);
|
|
75
|
-
if (!resolvedPath ||
|
|
70
|
+
if (!resolvedPath || resolvedPath.includes("/**/")) {
|
|
76
71
|
return resolvedPath;
|
|
77
72
|
}
|
|
78
73
|
const currentFileDir = path.dirname(currentFile);
|
|
@@ -135,26 +130,8 @@ const getApiSideBabelConfigPath = () => {
|
|
|
135
130
|
return;
|
|
136
131
|
}
|
|
137
132
|
};
|
|
138
|
-
const getApiSideBabelOverrides = ({
|
|
139
|
-
forVite = false,
|
|
140
|
-
projectIsEsm = false,
|
|
141
|
-
forJest = false
|
|
142
|
-
} = {}) => {
|
|
133
|
+
const getApiSideBabelOverrides = ({ forVite = false } = {}) => {
|
|
143
134
|
const overrides = [
|
|
144
|
-
// Apply handler ALS wrapping to all functions (Jest only; Vite uses
|
|
145
|
-
// handlerAlsWrappingPlugin instead)
|
|
146
|
-
forJest && {
|
|
147
|
-
// match */api/src/functions/*.js|ts
|
|
148
|
-
test: /.+api(?:[\\|/])src(?:[\\|/])functions(?:[\\|/]).+.(?:js|ts)$/,
|
|
149
|
-
plugins: [
|
|
150
|
-
[
|
|
151
|
-
handlerAlsWrappingPlugin,
|
|
152
|
-
{
|
|
153
|
-
projectIsEsm
|
|
154
|
-
}
|
|
155
|
-
]
|
|
156
|
-
]
|
|
157
|
-
},
|
|
158
135
|
// Add import names and paths to job definitions. Vite uses
|
|
159
136
|
// cedarjsJobPathInjectorPlugin instead.
|
|
160
137
|
!forVite && {
|
|
@@ -169,7 +146,7 @@ const getApiSideDefaultBabelConfig = () => {
|
|
|
169
146
|
return {
|
|
170
147
|
presets: getApiSideBabelPresets(),
|
|
171
148
|
plugins: getApiSideBabelPlugins(),
|
|
172
|
-
overrides: getApiSideBabelOverrides(
|
|
149
|
+
overrides: getApiSideBabelOverrides(),
|
|
173
150
|
extends: getApiSideBabelConfigPath(),
|
|
174
151
|
babelrc: false,
|
|
175
152
|
ignore: ["node_modules"]
|
|
@@ -179,17 +156,16 @@ const registerApiSideBabelHook = ({
|
|
|
179
156
|
plugins = [],
|
|
180
157
|
...rest
|
|
181
158
|
} = {}) => {
|
|
182
|
-
const projectIsEsm = projectSideIsEsm("api");
|
|
183
159
|
registerBabel({
|
|
184
160
|
presets: getApiSideBabelPresets({
|
|
185
161
|
presetEnv: true
|
|
186
162
|
}),
|
|
187
|
-
overrides: getApiSideBabelOverrides(
|
|
163
|
+
overrides: getApiSideBabelOverrides(),
|
|
188
164
|
extends: getApiSideBabelConfigPath(),
|
|
189
165
|
babelrc: false,
|
|
190
166
|
ignore: ["node_modules"],
|
|
191
167
|
extensions: [".js", ".ts", ".jsx", ".tsx"],
|
|
192
|
-
plugins: [...getApiSideBabelPlugins(
|
|
168
|
+
plugins: [...getApiSideBabelPlugins(), ...plugins],
|
|
193
169
|
cache: false,
|
|
194
170
|
...rest
|
|
195
171
|
});
|
|
@@ -197,10 +173,7 @@ const registerApiSideBabelHook = ({
|
|
|
197
173
|
const transformWithBabel = async (sourceCode, filename, plugins, sourceMaps = "inline", forVite = false, inputSourceMap = void 0) => {
|
|
198
174
|
const result = transformAsync(sourceCode, {
|
|
199
175
|
presets: getApiSideBabelPresets(),
|
|
200
|
-
overrides: getApiSideBabelOverrides({
|
|
201
|
-
forVite,
|
|
202
|
-
projectIsEsm: projectSideIsEsm("api")
|
|
203
|
-
}),
|
|
176
|
+
overrides: getApiSideBabelOverrides({ forVite }),
|
|
204
177
|
extends: getApiSideBabelConfigPath(),
|
|
205
178
|
babelrc: false,
|
|
206
179
|
ignore: ["node_modules"],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"babel-plugin-redwood-routes-auto-loader.d.ts","sourceRoot":"","sources":["../../src/plugins/babel-plugin-redwood-routes-auto-loader.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAWnD,MAAM,WAAW,aAAa;IAC5B,YAAY,CAAC,EAAE,OAAO,CAAA;CACvB;
|
|
1
|
+
{"version":3,"file":"babel-plugin-redwood-routes-auto-loader.d.ts","sourceRoot":"","sources":["../../src/plugins/babel-plugin-redwood-routes-auto-loader.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAWnD,MAAM,WAAW,aAAa;IAC5B,YAAY,CAAC,EAAE,OAAO,CAAA;CACvB;AA8CD,MAAM,CAAC,OAAO,WACZ,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;IAAE,KAAK,EAAE,OAAO,KAAK,CAAA;CAAE,EACrC,EAAE,YAAoB,EAAE,EAAE,aAAa,GACtC,SAAS,CA8LX"}
|
package/dist/web.d.ts
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import type { TransformOptions } from '@babel/core';
|
|
2
2
|
import type { RegisterHookOptions } from './common.js';
|
|
3
3
|
export interface Flags {
|
|
4
|
-
/**
|
|
5
|
-
* Will change the alias for module-resolver plugin and include a few extra
|
|
6
|
-
* babel plugins
|
|
7
|
-
*/
|
|
8
|
-
forJest?: boolean;
|
|
9
4
|
/** changes what babel-plugin-redwood-routes-auto-loader does */
|
|
10
5
|
forPrerender?: boolean;
|
|
11
6
|
/**
|
|
@@ -19,7 +14,7 @@ export interface Flags {
|
|
|
19
14
|
*/
|
|
20
15
|
forVite?: boolean;
|
|
21
16
|
}
|
|
22
|
-
export declare const getWebSideBabelPlugins: ({
|
|
17
|
+
export declare const getWebSideBabelPlugins: ({ forVite }?: Flags) => TransformOptions[];
|
|
23
18
|
export declare const getWebSideOverrides: ({ forPrerender, forVite }?: Flags) => TransformOptions[];
|
|
24
19
|
export declare const getWebSideBabelPresets: (options: Flags) => ((string | undefined)[] | (string | object)[])[];
|
|
25
20
|
export declare const getWebSideBabelConfigPath: () => string | undefined;
|
package/dist/web.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web.d.ts","sourceRoot":"","sources":["../src/web.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAKnD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AAetD,MAAM,WAAW,KAAK;IACpB
|
|
1
|
+
{"version":3,"file":"web.d.ts","sourceRoot":"","sources":["../src/web.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAKnD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AAetD,MAAM,WAAW,KAAK;IACpB,gEAAgE;IAChE,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB;;;OAGG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,eAAO,MAAM,sBAAsB,GAAI,cAAa,KAAU,uBAgG7D,CAAA;AAED,eAAO,MAAM,mBAAmB,GAC9B,4BAA2B,KAA+B,KACzD,gBAAgB,EAwClB,CAAA;AAED,eAAO,MAAM,sBAAsB,GAAI,SAAS,KAAK,qDAwCpD,CAAA;AAED,eAAO,MAAM,yBAAyB,0BAOrC,CAAA;AAED,eAAO,MAAM,4BAA4B,GAAI,UAAS,KAAU;;;;;;;CAa/D,CAAA;AAGD,eAAO,MAAM,wBAAwB,GAAI,mCAItC,mBAAwB,SAY1B,CAAA"}
|
package/dist/web.js
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
getPathsFromTypeScriptConfig
|
|
10
10
|
} from "./common.js";
|
|
11
11
|
const require2 = createRequire(import.meta.url);
|
|
12
|
-
const getWebSideBabelPlugins = ({
|
|
12
|
+
const getWebSideBabelPlugins = ({ forVite } = {}) => {
|
|
13
13
|
const config = getConfig();
|
|
14
14
|
const useReactCompiler = config.experimental?.reactCompiler?.enabled && config.experimental?.reactCompiler?.lintOnly === false;
|
|
15
15
|
const useTrustedDocumentsGqlTag = config.graphql.trustedDocuments;
|
|
@@ -26,10 +26,7 @@ const getWebSideBabelPlugins = ({ forJest, forVite } = { forJest: false }) => {
|
|
|
26
26
|
"babel-plugin-module-resolver",
|
|
27
27
|
{
|
|
28
28
|
alias: {
|
|
29
|
-
|
|
30
|
-
// determining the `cwd`:
|
|
31
|
-
// https://github.com/facebook/jest/issues/7359
|
|
32
|
-
src: forJest ? rwjsPaths.web.src : "./src",
|
|
29
|
+
src: "./src",
|
|
33
30
|
// adds the paths from [ts|js]config.json to the module resolver
|
|
34
31
|
...getPathsFromTypeScriptConfig(tsConfigs.web, rwjsPaths.web.base),
|
|
35
32
|
$api: rwjsPaths.api.base
|
|
@@ -90,11 +87,6 @@ const getWebSideBabelPlugins = ({ forJest, forVite } = { forJest: false }) => {
|
|
|
90
87
|
"babel-plugin-graphql-tag",
|
|
91
88
|
void 0,
|
|
92
89
|
"rwjs-babel-graphql-tag"
|
|
93
|
-
],
|
|
94
|
-
forJest && process.env.NODE_ENV !== "development" && [
|
|
95
|
-
require2("./plugins/babel-plugin-redwood-remove-dev-fatal-error-page").default,
|
|
96
|
-
void 0,
|
|
97
|
-
"rwjs-remove-dev-fatal-error-page"
|
|
98
90
|
]
|
|
99
91
|
].filter(Boolean);
|
|
100
92
|
return plugins;
|
|
@@ -120,11 +112,9 @@ const getWebSideOverrides = ({ forPrerender, forVite } = { forPrerender: false }
|
|
|
120
112
|
},
|
|
121
113
|
// ** Files ending in `Cell.mock.[js,ts]` **
|
|
122
114
|
// Automatically determine keys for saving and retrieving mock data.
|
|
123
|
-
// Only required for storybook and jest
|
|
124
115
|
// Vite/Vitest runs the mock-cell-data transform via its own plugin
|
|
125
|
-
// (vite-plugin-cedar-mock-cell-data)
|
|
126
|
-
// Babel
|
|
127
|
-
// the override active for non-Vite contexts.
|
|
116
|
+
// (vite-plugin-cedar-mock-cell-data); this override covers the non-Vite
|
|
117
|
+
// Babel contexts.
|
|
128
118
|
!forVite && process.env.NODE_ENV !== "production" && {
|
|
129
119
|
test: /.+Cell.mock.(js|ts)$/,
|
|
130
120
|
plugins: [
|
|
@@ -139,7 +129,7 @@ const getWebSideOverrides = ({ forPrerender, forVite } = { forPrerender: false }
|
|
|
139
129
|
);
|
|
140
130
|
};
|
|
141
131
|
const getWebSideBabelPresets = (options) => {
|
|
142
|
-
if (options.forPrerender || options.
|
|
132
|
+
if (options.forPrerender || options.forJavaScriptLinting) {
|
|
143
133
|
let reactPresetConfig = { runtime: "automatic" };
|
|
144
134
|
if (getWebSideBabelConfigPath()) {
|
|
145
135
|
const userProjectConfig = require2(getWebSideBabelConfigPath());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/babel-config",
|
|
3
|
-
"version": "7.0.0-canary.
|
|
3
|
+
"version": "7.0.0-canary.2985",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/cedarjs/cedar.git",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"@babel/preset-typescript": "7.29.7",
|
|
36
36
|
"@babel/register": "7.29.7",
|
|
37
37
|
"@babel/traverse": "7.29.8",
|
|
38
|
-
"@cedarjs/project-config": "7.0.0-canary.
|
|
38
|
+
"@cedarjs/project-config": "7.0.0-canary.2985",
|
|
39
39
|
"babel-plugin-auto-import": "1.1.0",
|
|
40
40
|
"babel-plugin-graphql-tag": "3.3.0",
|
|
41
41
|
"babel-plugin-module-resolver": "5.0.3",
|
|
@@ -44,8 +44,7 @@
|
|
|
44
44
|
"typescript": "5.9.3"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@cedarjs/framework-tools": "7.0.0-canary.
|
|
48
|
-
"@jridgewell/trace-mapping": "0.3.31",
|
|
47
|
+
"@cedarjs/framework-tools": "7.0.0-canary.2985",
|
|
49
48
|
"@types/babel-plugin-tester": "11.0.0",
|
|
50
49
|
"@types/babel__core": "7.20.5",
|
|
51
50
|
"@types/babel__register": "7.17.3",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"babel-plugin-handler-als-wrapping.d.ts","sourceRoot":"","sources":["../../src/plugins/babel-plugin-handler-als-wrapping.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAkEnD,MAAM,CAAC,OAAO,WACZ,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;IAAE,KAAK,EAAE,OAAO,KAAK,CAAA;CAAE,EACrC,EAAE,YAAoB,EAAE,GAAE;IAAE,YAAY,CAAC,EAAE,OAAO,CAAA;CAAO,GACxD,SAAS,CA+DX"}
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
function generateWrappedHandler(t, isAsync) {
|
|
2
|
-
const contextStoreVariableDeclaration = t.variableDeclaration("const", [
|
|
3
|
-
t.variableDeclarator(
|
|
4
|
-
t.identifier("__cedar_contextStore"),
|
|
5
|
-
t.callExpression(
|
|
6
|
-
t.memberExpression(
|
|
7
|
-
t.callExpression(t.identifier("__cedar_getAsyncStoreInstance"), []),
|
|
8
|
-
t.identifier("getStore")
|
|
9
|
-
),
|
|
10
|
-
[]
|
|
11
|
-
)
|
|
12
|
-
)
|
|
13
|
-
]);
|
|
14
|
-
t.addComment(
|
|
15
|
-
contextStoreVariableDeclaration,
|
|
16
|
-
"leading",
|
|
17
|
-
" The store will be undefined if no context isolation has been performed yet",
|
|
18
|
-
true
|
|
19
|
-
);
|
|
20
|
-
return t.arrowFunctionExpression(
|
|
21
|
-
[t.identifier("__cedar_event"), t.identifier("__cedar_context")],
|
|
22
|
-
t.blockStatement([
|
|
23
|
-
contextStoreVariableDeclaration,
|
|
24
|
-
t.ifStatement(
|
|
25
|
-
t.binaryExpression(
|
|
26
|
-
"===",
|
|
27
|
-
t.identifier("__cedar_contextStore"),
|
|
28
|
-
t.identifier("undefined")
|
|
29
|
-
),
|
|
30
|
-
t.blockStatement([
|
|
31
|
-
t.returnStatement(
|
|
32
|
-
t.callExpression(
|
|
33
|
-
t.memberExpression(
|
|
34
|
-
t.callExpression(
|
|
35
|
-
t.identifier("__cedar_getAsyncStoreInstance"),
|
|
36
|
-
[]
|
|
37
|
-
),
|
|
38
|
-
t.identifier("run")
|
|
39
|
-
),
|
|
40
|
-
[
|
|
41
|
-
t.newExpression(t.identifier("Map"), []),
|
|
42
|
-
t.identifier("__cedar_handler"),
|
|
43
|
-
t.identifier("__cedar_event"),
|
|
44
|
-
t.identifier("__cedar_context")
|
|
45
|
-
]
|
|
46
|
-
)
|
|
47
|
-
)
|
|
48
|
-
])
|
|
49
|
-
),
|
|
50
|
-
t.returnStatement(
|
|
51
|
-
t.callExpression(t.identifier("__cedar_handler"), [
|
|
52
|
-
t.identifier("__cedar_event"),
|
|
53
|
-
t.identifier("__cedar_context")
|
|
54
|
-
])
|
|
55
|
-
)
|
|
56
|
-
]),
|
|
57
|
-
isAsync
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
function babel_plugin_handler_als_wrapping_default({ types: t }, { projectIsEsm = false } = {}) {
|
|
61
|
-
return {
|
|
62
|
-
name: "babel-plugin-handler-als-wrapping",
|
|
63
|
-
visitor: {
|
|
64
|
-
ExportNamedDeclaration(path, _state) {
|
|
65
|
-
const declaration = path.node.declaration;
|
|
66
|
-
if (!t.isVariableDeclaration(declaration)) {
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
const identifier = declaration.declarations[0].id;
|
|
70
|
-
if (!t.isIdentifier(identifier)) {
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
if (identifier.name !== "handler") {
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
const parentNode = path.parentPath.node;
|
|
77
|
-
if (!t.isProgram(parentNode)) {
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
path.insertBefore(
|
|
81
|
-
// import { getAsyncStoreInstance as __cedar_getAsyncStoreInstance } from '@cedarjs/context/dist/store'
|
|
82
|
-
t.importDeclaration(
|
|
83
|
-
[
|
|
84
|
-
t.importSpecifier(
|
|
85
|
-
t.identifier("__cedar_getAsyncStoreInstance"),
|
|
86
|
-
t.identifier("getAsyncStoreInstance")
|
|
87
|
-
)
|
|
88
|
-
],
|
|
89
|
-
t.stringLiteral(
|
|
90
|
-
projectIsEsm ? "@cedarjs/context/dist/store.js" : "@cedarjs/context/dist/store"
|
|
91
|
-
)
|
|
92
|
-
)
|
|
93
|
-
);
|
|
94
|
-
path.insertBefore(
|
|
95
|
-
t.variableDeclaration("const", [
|
|
96
|
-
t.variableDeclarator(
|
|
97
|
-
t.identifier("__cedar_handler"),
|
|
98
|
-
declaration.declarations[0].init
|
|
99
|
-
)
|
|
100
|
-
])
|
|
101
|
-
);
|
|
102
|
-
let isAsync = false;
|
|
103
|
-
const originalInit = declaration.declarations[0].init;
|
|
104
|
-
if (t.isFunction(originalInit)) {
|
|
105
|
-
isAsync = originalInit.async;
|
|
106
|
-
}
|
|
107
|
-
declaration.declarations[0].init = generateWrappedHandler(t, isAsync);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
export {
|
|
113
|
-
babel_plugin_handler_als_wrapping_default as default
|
|
114
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"babel-plugin-redwood-remove-dev-fatal-error-page.d.ts","sourceRoot":"","sources":["../../src/plugins/babel-plugin-redwood-remove-dev-fatal-error-page.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAOnD,MAAM,CAAC,OAAO,WAAW,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;IAAE,KAAK,EAAE,OAAO,KAAK,CAAA;CAAE,GAAG,SAAS,CAuBzE"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
function babel_plugin_redwood_remove_dev_fatal_error_page_default({ types: t }) {
|
|
2
|
-
return {
|
|
3
|
-
name: "babel-plugin-redwood-remove-dev-fatal-error-page",
|
|
4
|
-
visitor: {
|
|
5
|
-
ImportDeclaration(path) {
|
|
6
|
-
if (path.node.source.value === "@cedarjs/web/dist/components/DevFatalErrorPage") {
|
|
7
|
-
const variableDeclaration = t.variableDeclaration("const", [
|
|
8
|
-
t.variableDeclarator(
|
|
9
|
-
t.identifier("DevFatalErrorPage"),
|
|
10
|
-
t.identifier("undefined")
|
|
11
|
-
)
|
|
12
|
-
]);
|
|
13
|
-
path.replaceWith(variableDeclaration);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
export {
|
|
20
|
-
babel_plugin_redwood_remove_dev_fatal_error_page_default as default
|
|
21
|
-
};
|