@cedarjs/babel-config 6.0.0-canary.2773 → 6.0.0-canary.2776
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.js +35 -73
- package/dist/common.d.ts.map +1 -1
- package/dist/common.js +20 -55
- package/dist/index.js +27 -47
- package/dist/plugins/babel-plugin-handler-als-wrapping.js +3 -23
- package/dist/plugins/babel-plugin-redwood-directory-named-import.js +9 -39
- package/dist/plugins/babel-plugin-redwood-import-dir.js +10 -40
- package/dist/plugins/babel-plugin-redwood-job-path-injector.js +7 -37
- package/dist/plugins/babel-plugin-redwood-mock-cell-data.d.ts.map +1 -1
- package/dist/plugins/babel-plugin-redwood-mock-cell-data.js +19 -52
- package/dist/plugins/babel-plugin-redwood-remove-dev-fatal-error-page.js +3 -23
- package/dist/plugins/babel-plugin-redwood-routes-auto-loader.js +27 -51
- package/dist/web.d.ts.map +1 -1
- package/dist/web.js +27 -60
- package/package.json +6 -6
- package/dist/plugins/prettier.config.js +0 -28
package/dist/api.js
CHANGED
|
@@ -1,54 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var api_exports = {};
|
|
30
|
-
__export(api_exports, {
|
|
31
|
-
TARGETS_NODE: () => TARGETS_NODE,
|
|
32
|
-
getApiSideBabelConfigPath: () => getApiSideBabelConfigPath,
|
|
33
|
-
getApiSideBabelOverrides: () => getApiSideBabelOverrides,
|
|
34
|
-
getApiSideBabelPlugins: () => getApiSideBabelPlugins,
|
|
35
|
-
getApiSideBabelPluginsForVite: () => getApiSideBabelPluginsForVite,
|
|
36
|
-
getApiSideBabelPresets: () => getApiSideBabelPresets,
|
|
37
|
-
getApiSideDefaultBabelConfig: () => getApiSideDefaultBabelConfig,
|
|
38
|
-
registerApiSideBabelHook: () => registerApiSideBabelHook,
|
|
39
|
-
transformWithBabel: () => transformWithBabel
|
|
40
|
-
});
|
|
41
|
-
module.exports = __toCommonJS(api_exports);
|
|
42
|
-
var import_node_fs = __toESM(require("node:fs"));
|
|
43
|
-
var import_node_path = __toESM(require("node:path"));
|
|
44
|
-
var import_core = require("@babel/core");
|
|
45
|
-
var import_babel_plugin_module_resolver = require("babel-plugin-module-resolver");
|
|
46
|
-
var import_project_config = require("@cedarjs/project-config");
|
|
47
|
-
var import_common = require("./common.js");
|
|
48
|
-
var import_babel_plugin_handler_als_wrapping = __toESM(require("./plugins/babel-plugin-handler-als-wrapping.js"));
|
|
49
|
-
var import_babel_plugin_redwood_directory_named_import = __toESM(require("./plugins/babel-plugin-redwood-directory-named-import.js"));
|
|
50
|
-
var import_babel_plugin_redwood_import_dir = __toESM(require("./plugins/babel-plugin-redwood-import-dir.js"));
|
|
51
|
-
var import_babel_plugin_redwood_job_path_injector = __toESM(require("./plugins/babel-plugin-redwood-job-path-injector.js"));
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { transformAsync } from "@babel/core";
|
|
4
|
+
import { resolvePath } from "babel-plugin-module-resolver";
|
|
5
|
+
import { getPaths, projectSideIsEsm } from "@cedarjs/project-config";
|
|
6
|
+
import {
|
|
7
|
+
getPathsFromTypeScriptConfig,
|
|
8
|
+
parseTypeScriptConfigFiles,
|
|
9
|
+
registerBabel
|
|
10
|
+
} from "./common.js";
|
|
11
|
+
import handlerAlsWrappingPlugin from "./plugins/babel-plugin-handler-als-wrapping.js";
|
|
12
|
+
import pluginRedwoodDirectoryNamedImport from "./plugins/babel-plugin-redwood-directory-named-import.js";
|
|
13
|
+
import pluginRedwoodImportDir from "./plugins/babel-plugin-redwood-import-dir.js";
|
|
14
|
+
import pluginRedwoodJobPathInjector from "./plugins/babel-plugin-redwood-job-path-injector.js";
|
|
52
15
|
const TARGETS_NODE = "24";
|
|
53
16
|
const getApiSideBabelPresets = ({ presetEnv } = { presetEnv: false }) => {
|
|
54
17
|
return [
|
|
@@ -79,7 +42,7 @@ const getApiSideBabelPlugins = ({
|
|
|
79
42
|
if (forVite) {
|
|
80
43
|
return getApiSideBabelPluginsForVite();
|
|
81
44
|
}
|
|
82
|
-
const tsConfig =
|
|
45
|
+
const tsConfig = parseTypeScriptConfigFiles();
|
|
83
46
|
const plugins = [
|
|
84
47
|
// Needed to support `/** @jsxImportSource custom-jsx-library */`
|
|
85
48
|
// comments in JSX files
|
|
@@ -98,9 +61,9 @@ const getApiSideBabelPlugins = ({
|
|
|
98
61
|
alias: {
|
|
99
62
|
src: "./src",
|
|
100
63
|
// adds the paths from [ts|js]config.json to the module resolver
|
|
101
|
-
...
|
|
64
|
+
...getPathsFromTypeScriptConfig(tsConfig.api, getPaths().api.base)
|
|
102
65
|
},
|
|
103
|
-
root: [
|
|
66
|
+
root: [getPaths().api.base],
|
|
104
67
|
cwd: "packagejson",
|
|
105
68
|
loglevel: "silent",
|
|
106
69
|
// to silence the unnecessary warnings
|
|
@@ -108,16 +71,16 @@ const getApiSideBabelPlugins = ({
|
|
|
108
71
|
const isDataMigrate = process.argv[2] === "data-migrate";
|
|
109
72
|
const isPrerender = process.argv[2] === "prerender";
|
|
110
73
|
const importPath = /.*\/.*\.js$/.test(sourcePath) && (isDataMigrate || isPrerender) ? sourcePath.replace(/\.js$/, "") : sourcePath;
|
|
111
|
-
const resolvedPath =
|
|
74
|
+
const resolvedPath = resolvePath(importPath, currentFile, opts);
|
|
112
75
|
if (!resolvedPath || !projectIsEsm || resolvedPath.includes("/**/")) {
|
|
113
76
|
return resolvedPath;
|
|
114
77
|
}
|
|
115
|
-
const currentFileDir =
|
|
116
|
-
const joinedPath =
|
|
117
|
-
if (
|
|
78
|
+
const currentFileDir = path.dirname(currentFile);
|
|
79
|
+
const joinedPath = path.join(currentFileDir, resolvedPath);
|
|
80
|
+
if (fs.existsSync(joinedPath + ".js") || fs.existsSync(joinedPath + ".ts")) {
|
|
118
81
|
return resolvedPath + ".js";
|
|
119
82
|
}
|
|
120
|
-
if (
|
|
83
|
+
if (fs.existsSync(joinedPath + ".jsx") || fs.existsSync(joinedPath + ".tsx")) {
|
|
121
84
|
return resolvedPath + ".jsx";
|
|
122
85
|
}
|
|
123
86
|
return resolvedPath;
|
|
@@ -128,7 +91,7 @@ const getApiSideBabelPlugins = ({
|
|
|
128
91
|
// Vite/esbuild use cedarDirectoryNamedImportPlugin / applyDirectoryNamedImport
|
|
129
92
|
// instead of this babel plugin
|
|
130
93
|
[
|
|
131
|
-
|
|
94
|
+
pluginRedwoodDirectoryNamedImport,
|
|
132
95
|
void 0,
|
|
133
96
|
"rwjs-babel-directory-named-modules"
|
|
134
97
|
],
|
|
@@ -157,7 +120,7 @@ const getApiSideBabelPlugins = ({
|
|
|
157
120
|
// For Vite builds, glob imports are handled by cedarImportDirPlugin (Vite)
|
|
158
121
|
// or applyImportDir (esbuild). Keep the Babel plugin only for
|
|
159
122
|
// non-Vite consumers: Jest, console, and data-migrate.
|
|
160
|
-
[
|
|
123
|
+
[pluginRedwoodImportDir, {}, "rwjs-babel-glob-import-dir"]
|
|
161
124
|
];
|
|
162
125
|
return plugins;
|
|
163
126
|
};
|
|
@@ -165,8 +128,8 @@ const getApiSideBabelPluginsForVite = () => {
|
|
|
165
128
|
return [];
|
|
166
129
|
};
|
|
167
130
|
const getApiSideBabelConfigPath = () => {
|
|
168
|
-
const p =
|
|
169
|
-
if (
|
|
131
|
+
const p = path.join(getPaths().api.base, "babel.config.js");
|
|
132
|
+
if (fs.existsSync(p)) {
|
|
170
133
|
return p;
|
|
171
134
|
} else {
|
|
172
135
|
return;
|
|
@@ -185,7 +148,7 @@ const getApiSideBabelOverrides = ({
|
|
|
185
148
|
test: /.+api(?:[\\|/])src(?:[\\|/])functions(?:[\\|/]).+.(?:js|ts)$/,
|
|
186
149
|
plugins: [
|
|
187
150
|
[
|
|
188
|
-
|
|
151
|
+
handlerAlsWrappingPlugin,
|
|
189
152
|
{
|
|
190
153
|
projectIsEsm
|
|
191
154
|
}
|
|
@@ -197,7 +160,7 @@ const getApiSideBabelOverrides = ({
|
|
|
197
160
|
!forVite && {
|
|
198
161
|
// match */api/src/jobs/*.js|ts
|
|
199
162
|
test: /.+api(?:[\\|/])src(?:[\\|/])jobs(?:[\\|/]).+.(?:js|ts)$/,
|
|
200
|
-
plugins: [[
|
|
163
|
+
plugins: [[pluginRedwoodJobPathInjector]]
|
|
201
164
|
}
|
|
202
165
|
].filter(Boolean);
|
|
203
166
|
return overrides;
|
|
@@ -216,8 +179,8 @@ const registerApiSideBabelHook = ({
|
|
|
216
179
|
plugins = [],
|
|
217
180
|
...rest
|
|
218
181
|
} = {}) => {
|
|
219
|
-
const projectIsEsm =
|
|
220
|
-
|
|
182
|
+
const projectIsEsm = projectSideIsEsm("api");
|
|
183
|
+
registerBabel({
|
|
221
184
|
presets: getApiSideBabelPresets({
|
|
222
185
|
presetEnv: true
|
|
223
186
|
}),
|
|
@@ -232,16 +195,16 @@ const registerApiSideBabelHook = ({
|
|
|
232
195
|
});
|
|
233
196
|
};
|
|
234
197
|
const transformWithBabel = async (sourceCode, filename, plugins, sourceMaps = "inline", forVite = false, inputSourceMap = void 0) => {
|
|
235
|
-
const result =
|
|
198
|
+
const result = transformAsync(sourceCode, {
|
|
236
199
|
presets: getApiSideBabelPresets(),
|
|
237
200
|
overrides: getApiSideBabelOverrides({
|
|
238
201
|
forVite,
|
|
239
|
-
projectIsEsm:
|
|
202
|
+
projectIsEsm: projectSideIsEsm("api")
|
|
240
203
|
}),
|
|
241
204
|
extends: getApiSideBabelConfigPath(),
|
|
242
205
|
babelrc: false,
|
|
243
206
|
ignore: ["node_modules"],
|
|
244
|
-
cwd:
|
|
207
|
+
cwd: getPaths().api.base,
|
|
245
208
|
filename,
|
|
246
209
|
// The default 'inline' embeds the map as a data URL in result.code,
|
|
247
210
|
// which esbuild consumes when it reads from the result. Vite callers
|
|
@@ -253,8 +216,7 @@ const transformWithBabel = async (sourceCode, filename, plugins, sourceMaps = "i
|
|
|
253
216
|
});
|
|
254
217
|
return result;
|
|
255
218
|
};
|
|
256
|
-
|
|
257
|
-
0 && (module.exports = {
|
|
219
|
+
export {
|
|
258
220
|
TARGETS_NODE,
|
|
259
221
|
getApiSideBabelConfigPath,
|
|
260
222
|
getApiSideBabelOverrides,
|
|
@@ -264,4 +226,4 @@ const transformWithBabel = async (sourceCode, filename, plugins, sourceMaps = "i
|
|
|
264
226
|
getApiSideDefaultBabelConfig,
|
|
265
227
|
registerApiSideBabelHook,
|
|
266
228
|
transformWithBabel
|
|
267
|
-
}
|
|
229
|
+
};
|
package/dist/common.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAC/D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAMtD,OAAO,KAAK,EAAE,KAAK,IAAI,QAAQ,EAAE,MAAM,UAAU,CAAA;AAOjD,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,OAAO,CAAC,EAAE,UAAU,EAAE,CAAA;IACtB,SAAS,CAAC,EAAE,gBAAgB,CAAC,WAAW,CAAC,CAAA;IACzC,OAAO,CAAC,EAAE,QAAQ,CAAA;CACnB;AAED,sEAAsE;AACtE,MAAM,WAAW,oBAAqB,SAAQ,gBAAgB;IAC5D,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;IACrB,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB;AAkBD,eAAO,MAAM,aAAa,GAAI,SAAS,eAAe,SAOrD,CAAA;AAID,eAAO,MAAM,wBAAwB,0BAEpC,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,0BAA0B;;;CAuBtC,CAAA;AAED,KAAK,uBAAuB,GAAG;IAC7B,eAAe,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAA;KAAE,CAAA;CACtE,CAAA;AACD;;;;;GAKG;AACH,eAAO,MAAM,4BAA4B,GACvC,QAAQ,uBAAuB,EAC/B,SAAS,MAAM,KACd,MAAM,CAAC,MAAM,EAAE,MAAM,CAqCvB,CAAA"}
|
package/dist/common.js
CHANGED
|
@@ -1,63 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var common_exports = {};
|
|
30
|
-
__export(common_exports, {
|
|
31
|
-
getPathsFromTypeScriptConfig: () => getPathsFromTypeScriptConfig,
|
|
32
|
-
getRouteHookBabelPlugins: () => getRouteHookBabelPlugins,
|
|
33
|
-
parseTypeScriptConfigFiles: () => parseTypeScriptConfigFiles,
|
|
34
|
-
registerBabel: () => registerBabel
|
|
35
|
-
});
|
|
36
|
-
module.exports = __toCommonJS(common_exports);
|
|
37
|
-
var import_node_fs = __toESM(require("node:fs"));
|
|
38
|
-
var import_path = __toESM(require("path"));
|
|
39
|
-
var import_typescript = require("typescript");
|
|
40
|
-
var import_project_config = require("@cedarjs/project-config");
|
|
41
|
-
var import_web = require("./web.js");
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import { createRequire } from "node:module";
|
|
3
|
+
import path from "path";
|
|
4
|
+
import { parseConfigFileTextToJson } from "typescript";
|
|
5
|
+
import { getPaths } from "@cedarjs/project-config";
|
|
6
|
+
import { getWebSideBabelPlugins } from "./web.js";
|
|
7
|
+
const require2 = createRequire(import.meta.url);
|
|
42
8
|
const registerBabel = (options) => {
|
|
43
|
-
|
|
9
|
+
require2("@babel/register")(options);
|
|
44
10
|
};
|
|
45
11
|
const getRouteHookBabelPlugins = () => {
|
|
46
|
-
return [...
|
|
12
|
+
return [...getWebSideBabelPlugins()];
|
|
47
13
|
};
|
|
48
14
|
const parseTypeScriptConfigFiles = () => {
|
|
49
|
-
const rwPaths =
|
|
15
|
+
const rwPaths = getPaths();
|
|
50
16
|
const parseConfigFile = (basePath) => {
|
|
51
|
-
let configPath =
|
|
52
|
-
if (!
|
|
53
|
-
configPath =
|
|
54
|
-
if (!
|
|
17
|
+
let configPath = path.join(basePath, "tsconfig.json");
|
|
18
|
+
if (!fs.existsSync(configPath)) {
|
|
19
|
+
configPath = path.join(basePath, "jsconfig.json");
|
|
20
|
+
if (!fs.existsSync(configPath)) {
|
|
55
21
|
return null;
|
|
56
22
|
}
|
|
57
23
|
}
|
|
58
|
-
return
|
|
24
|
+
return parseConfigFileTextToJson(
|
|
59
25
|
configPath,
|
|
60
|
-
|
|
26
|
+
fs.readFileSync(configPath, "utf-8")
|
|
61
27
|
);
|
|
62
28
|
};
|
|
63
29
|
const apiConfig = parseConfigFile(rwPaths.api.base);
|
|
@@ -77,7 +43,7 @@ const getPathsFromTypeScriptConfig = (config, rootDir) => {
|
|
|
77
43
|
const { baseUrl, paths } = config.compilerOptions;
|
|
78
44
|
let absoluteBase;
|
|
79
45
|
if (baseUrl) {
|
|
80
|
-
absoluteBase =
|
|
46
|
+
absoluteBase = path.isAbsolute(baseUrl) ? baseUrl : path.join(rootDir, baseUrl);
|
|
81
47
|
} else {
|
|
82
48
|
absoluteBase = rootDir;
|
|
83
49
|
}
|
|
@@ -87,15 +53,14 @@ const getPathsFromTypeScriptConfig = (config, rootDir) => {
|
|
|
87
53
|
continue;
|
|
88
54
|
}
|
|
89
55
|
const aliasKey = key.replace("/*", "");
|
|
90
|
-
const aliasValue =
|
|
56
|
+
const aliasValue = path.join(absoluteBase, value[0].replace("/*", ""));
|
|
91
57
|
pathsObj[aliasKey] = aliasValue;
|
|
92
58
|
}
|
|
93
59
|
return pathsObj;
|
|
94
60
|
};
|
|
95
|
-
|
|
96
|
-
0 && (module.exports = {
|
|
61
|
+
export {
|
|
97
62
|
getPathsFromTypeScriptConfig,
|
|
98
63
|
getRouteHookBabelPlugins,
|
|
99
64
|
parseTypeScriptConfigFiles,
|
|
100
65
|
registerBabel
|
|
101
|
-
}
|
|
66
|
+
};
|
package/dist/index.js
CHANGED
|
@@ -1,55 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
getApiSideDefaultBabelConfig: () => import_api.getApiSideDefaultBabelConfig,
|
|
27
|
-
getPathsFromConfig: () => import_common.getPathsFromTypeScriptConfig,
|
|
28
|
-
getRouteHookBabelPlugins: () => import_common.getRouteHookBabelPlugins,
|
|
29
|
-
getWebSideBabelConfigPath: () => import_web.getWebSideBabelConfigPath,
|
|
30
|
-
getWebSideBabelPlugins: () => import_web.getWebSideBabelPlugins,
|
|
31
|
-
getWebSideBabelPresets: () => import_web.getWebSideBabelPresets,
|
|
32
|
-
getWebSideDefaultBabelConfig: () => import_web.getWebSideDefaultBabelConfig,
|
|
33
|
-
getWebSideOverrides: () => import_web.getWebSideOverrides,
|
|
34
|
-
parseTypeScriptConfigFiles: () => import_common.parseTypeScriptConfigFiles,
|
|
35
|
-
registerApiSideBabelHook: () => import_api.registerApiSideBabelHook,
|
|
36
|
-
registerBabel: () => import_common.registerBabel,
|
|
37
|
-
registerWebSideBabelHook: () => import_web.registerWebSideBabelHook,
|
|
38
|
-
transformWithBabel: () => import_api.transformWithBabel
|
|
39
|
-
});
|
|
40
|
-
module.exports = __toCommonJS(index_exports);
|
|
41
|
-
var import_api = require("./api.js");
|
|
42
|
-
var import_web = require("./web.js");
|
|
43
|
-
var import_common = require("./common.js");
|
|
44
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
45
|
-
0 && (module.exports = {
|
|
1
|
+
import {
|
|
2
|
+
TARGETS_NODE,
|
|
3
|
+
getApiSideBabelConfigPath,
|
|
4
|
+
getApiSideBabelPlugins,
|
|
5
|
+
getApiSideBabelPluginsForVite,
|
|
6
|
+
getApiSideBabelPresets,
|
|
7
|
+
getApiSideDefaultBabelConfig,
|
|
8
|
+
registerApiSideBabelHook,
|
|
9
|
+
transformWithBabel
|
|
10
|
+
} from "./api.js";
|
|
11
|
+
import {
|
|
12
|
+
getWebSideBabelConfigPath,
|
|
13
|
+
getWebSideBabelPlugins,
|
|
14
|
+
getWebSideBabelPresets,
|
|
15
|
+
getWebSideDefaultBabelConfig,
|
|
16
|
+
getWebSideOverrides,
|
|
17
|
+
registerWebSideBabelHook
|
|
18
|
+
} from "./web.js";
|
|
19
|
+
import {
|
|
20
|
+
getPathsFromTypeScriptConfig,
|
|
21
|
+
getRouteHookBabelPlugins,
|
|
22
|
+
parseTypeScriptConfigFiles,
|
|
23
|
+
registerBabel
|
|
24
|
+
} from "./common.js";
|
|
25
|
+
export {
|
|
46
26
|
TARGETS_NODE,
|
|
47
27
|
getApiSideBabelConfigPath,
|
|
48
28
|
getApiSideBabelPlugins,
|
|
49
29
|
getApiSideBabelPluginsForVite,
|
|
50
30
|
getApiSideBabelPresets,
|
|
51
31
|
getApiSideDefaultBabelConfig,
|
|
52
|
-
getPathsFromConfig,
|
|
32
|
+
getPathsFromTypeScriptConfig as getPathsFromConfig,
|
|
53
33
|
getRouteHookBabelPlugins,
|
|
54
34
|
getWebSideBabelConfigPath,
|
|
55
35
|
getWebSideBabelPlugins,
|
|
@@ -61,4 +41,4 @@ var import_common = require("./common.js");
|
|
|
61
41
|
registerBabel,
|
|
62
42
|
registerWebSideBabelHook,
|
|
63
43
|
transformWithBabel
|
|
64
|
-
}
|
|
44
|
+
};
|
|
@@ -1,26 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var babel_plugin_handler_als_wrapping_exports = {};
|
|
20
|
-
__export(babel_plugin_handler_als_wrapping_exports, {
|
|
21
|
-
default: () => babel_plugin_handler_als_wrapping_default
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(babel_plugin_handler_als_wrapping_exports);
|
|
24
1
|
function generateWrappedHandler(t, isAsync) {
|
|
25
2
|
const contextStoreVariableDeclaration = t.variableDeclaration("const", [
|
|
26
3
|
t.variableDeclarator(
|
|
@@ -132,3 +109,6 @@ function babel_plugin_handler_als_wrapping_default({ types: t }, { projectIsEsm
|
|
|
132
109
|
}
|
|
133
110
|
};
|
|
134
111
|
}
|
|
112
|
+
export {
|
|
113
|
+
babel_plugin_handler_als_wrapping_default as default
|
|
114
|
+
};
|
|
@@ -1,47 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var babel_plugin_redwood_directory_named_import_exports = {};
|
|
30
|
-
__export(babel_plugin_redwood_directory_named_import_exports, {
|
|
31
|
-
default: () => babel_plugin_redwood_directory_named_import_default
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(babel_plugin_redwood_directory_named_import_exports);
|
|
34
|
-
var import_path = __toESM(require("path"));
|
|
35
|
-
var import_project_config = require("@cedarjs/project-config");
|
|
1
|
+
import path from "path";
|
|
2
|
+
import { resolveFile } from "@cedarjs/project-config";
|
|
36
3
|
const getNewPath = (value, filename) => {
|
|
37
|
-
const dirname =
|
|
38
|
-
const basename =
|
|
4
|
+
const dirname = path.dirname(value);
|
|
5
|
+
const basename = path.basename(value);
|
|
39
6
|
const indexImportPath = [dirname, basename, "index"].join("/");
|
|
40
|
-
if (
|
|
7
|
+
if (resolveFile(path.resolve(path.dirname(filename), indexImportPath))) {
|
|
41
8
|
return indexImportPath;
|
|
42
9
|
} else {
|
|
43
10
|
const dirnameImportPath = [dirname, basename, basename].join("/");
|
|
44
|
-
if (
|
|
11
|
+
if (resolveFile(path.resolve(path.dirname(filename), dirnameImportPath))) {
|
|
45
12
|
return dirnameImportPath;
|
|
46
13
|
}
|
|
47
14
|
}
|
|
@@ -92,3 +59,6 @@ function babel_plugin_redwood_directory_named_import_default({ types: t }) {
|
|
|
92
59
|
}
|
|
93
60
|
};
|
|
94
61
|
}
|
|
62
|
+
export {
|
|
63
|
+
babel_plugin_redwood_directory_named_import_default as default
|
|
64
|
+
};
|
|
@@ -1,39 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var babel_plugin_redwood_import_dir_exports = {};
|
|
30
|
-
__export(babel_plugin_redwood_import_dir_exports, {
|
|
31
|
-
default: () => babel_plugin_redwood_import_dir_default
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(babel_plugin_redwood_import_dir_exports);
|
|
34
|
-
var import_path = __toESM(require("path"));
|
|
35
|
-
var import_fast_glob = __toESM(require("fast-glob"));
|
|
36
|
-
var import_project_config = require("@cedarjs/project-config");
|
|
1
|
+
import path from "path";
|
|
2
|
+
import fg from "fast-glob";
|
|
3
|
+
import { importStatementPath } from "@cedarjs/project-config";
|
|
37
4
|
function babel_plugin_redwood_import_dir_default({ types: t }) {
|
|
38
5
|
return {
|
|
39
6
|
name: "babel-plugin-redwood-import-dir",
|
|
@@ -52,15 +19,15 @@ function babel_plugin_redwood_import_dir_default({ types: t }) {
|
|
|
52
19
|
)
|
|
53
20
|
])
|
|
54
21
|
);
|
|
55
|
-
const importGlob =
|
|
56
|
-
const cwd =
|
|
57
|
-
const dirFiles =
|
|
22
|
+
const importGlob = importStatementPath(p.node.source.value);
|
|
23
|
+
const cwd = path.dirname(state.file.opts.filename);
|
|
24
|
+
const dirFiles = fg.sync(importGlob, { cwd }).filter((n) => !n.includes(".test.")).filter((n) => !n.includes(".scenarios.")).filter((n) => !n.includes(".d.ts"));
|
|
58
25
|
const staticGlob = importGlob.split("*")[0];
|
|
59
26
|
const filePathToVarName = (filePath) => {
|
|
60
27
|
return filePath.replace(staticGlob, "").replace(/\.(js|ts)$/, "").replace(/[^a-zA-Z0-9]/g, "_");
|
|
61
28
|
};
|
|
62
29
|
for (const filePath of dirFiles) {
|
|
63
|
-
const { dir: fileDir, name: fileName } =
|
|
30
|
+
const { dir: fileDir, name: fileName } = path.parse(filePath);
|
|
64
31
|
const filePathWithoutExtension = fileDir + "/" + fileName;
|
|
65
32
|
const fpVarName = filePathToVarName(filePath);
|
|
66
33
|
nodes.push(
|
|
@@ -94,3 +61,6 @@ function babel_plugin_redwood_import_dir_default({ types: t }) {
|
|
|
94
61
|
}
|
|
95
62
|
};
|
|
96
63
|
}
|
|
64
|
+
export {
|
|
65
|
+
babel_plugin_redwood_import_dir_default as default
|
|
66
|
+
};
|
|
@@ -1,40 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var babel_plugin_redwood_job_path_injector_exports = {};
|
|
30
|
-
__export(babel_plugin_redwood_job_path_injector_exports, {
|
|
31
|
-
default: () => babel_plugin_redwood_job_path_injector_default
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(babel_plugin_redwood_job_path_injector_exports);
|
|
34
|
-
var import_node_path = __toESM(require("node:path"));
|
|
35
|
-
var import_project_config = require("@cedarjs/project-config");
|
|
1
|
+
import fsPath from "node:path";
|
|
2
|
+
import { getPaths } from "@cedarjs/project-config";
|
|
36
3
|
function babel_plugin_redwood_job_path_injector_default({ types }) {
|
|
37
|
-
const paths =
|
|
4
|
+
const paths = getPaths();
|
|
38
5
|
return {
|
|
39
6
|
name: "babel-plugin-redwood-job-path-injector",
|
|
40
7
|
visitor: {
|
|
@@ -89,7 +56,7 @@ function babel_plugin_redwood_job_path_injector_default({ types }) {
|
|
|
89
56
|
throw new Error("No file path was found in the state");
|
|
90
57
|
}
|
|
91
58
|
const importName = id.name;
|
|
92
|
-
const importPath =
|
|
59
|
+
const importPath = fsPath.relative(paths.api.jobs, filepath);
|
|
93
60
|
const importPathWithoutExtension = importPath.replace(/\.[^/.]+$/, "");
|
|
94
61
|
const firstArg = init.arguments[0];
|
|
95
62
|
if (!firstArg) {
|
|
@@ -116,3 +83,6 @@ function babel_plugin_redwood_job_path_injector_default({ types }) {
|
|
|
116
83
|
}
|
|
117
84
|
};
|
|
118
85
|
}
|
|
86
|
+
export {
|
|
87
|
+
babel_plugin_redwood_job_path_injector_default as default
|
|
88
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"babel-plugin-redwood-mock-cell-data.d.ts","sourceRoot":"","sources":["../../src/plugins/babel-plugin-redwood-mock-cell-data.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"babel-plugin-redwood-mock-cell-data.d.ts","sourceRoot":"","sources":["../../src/plugins/babel-plugin-redwood-mock-cell-data.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAY5C,MAAM,CAAC,OAAO,WAAW,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;IAAE,KAAK,EAAE,OAAO,KAAK,CAAA;CAAE,GAAG,SAAS,CAmKzE;AAED,eAAO,MAAM,eAAe,GAAI,GAAG,MAAM;;;;;;CA0FxC,CAAA;AAkBD,UAAU,YAAY;IACpB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,WAAW,GAAG,UAAU,GAAG,UAAU,GAAG,OAAO,CAAA;CACtD"}
|
|
@@ -1,43 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var babel_plugin_redwood_mock_cell_data_exports = {};
|
|
30
|
-
__export(babel_plugin_redwood_mock_cell_data_exports, {
|
|
31
|
-
default: () => babel_plugin_redwood_mock_cell_data_default,
|
|
32
|
-
getCellMetadata: () => getCellMetadata
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(babel_plugin_redwood_mock_cell_data_exports);
|
|
35
|
-
var import_node_fs = __toESM(require("node:fs"));
|
|
36
|
-
var import_path = __toESM(require("path"));
|
|
37
|
-
var import_parser = require("@babel/parser");
|
|
38
|
-
var import_traverse = __toESM(require("@babel/traverse"));
|
|
39
|
-
var import_fast_glob = __toESM(require("fast-glob"));
|
|
40
|
-
var import_graphql = require("graphql");
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { parse as babelParse } from "@babel/parser";
|
|
4
|
+
import babelTraverse from "@babel/traverse";
|
|
5
|
+
import fg from "fast-glob";
|
|
6
|
+
import { parse as graphqlParse, Kind } from "graphql";
|
|
7
|
+
const traverse = babelTraverse.default || babelTraverse;
|
|
41
8
|
function babel_plugin_redwood_mock_cell_data_default({ types: t }) {
|
|
42
9
|
let nodesToRemove = [];
|
|
43
10
|
let nodesToInsert = [];
|
|
@@ -101,9 +68,9 @@ function babel_plugin_redwood_mock_cell_data_default({ types: t }) {
|
|
|
101
68
|
default:
|
|
102
69
|
return;
|
|
103
70
|
}
|
|
104
|
-
const dirname =
|
|
105
|
-
const cellName =
|
|
106
|
-
const [cellPath] =
|
|
71
|
+
const dirname = path.dirname(state.file.opts.filename);
|
|
72
|
+
const cellName = path.basename(dirname);
|
|
73
|
+
const [cellPath] = fg.sync(`${cellName}.{js,jsx,ts,tsx}`, {
|
|
107
74
|
cwd: dirname,
|
|
108
75
|
absolute: true,
|
|
109
76
|
ignore: ["node_modules"]
|
|
@@ -128,7 +95,7 @@ function babel_plugin_redwood_mock_cell_data_default({ types: t }) {
|
|
|
128
95
|
t.identifier("afterQuery")
|
|
129
96
|
)
|
|
130
97
|
],
|
|
131
|
-
t.stringLiteral(`./${
|
|
98
|
+
t.stringLiteral(`./${path.basename(cellPath)}`)
|
|
132
99
|
);
|
|
133
100
|
nodesToInsert = [
|
|
134
101
|
...nodesToInsert,
|
|
@@ -157,7 +124,7 @@ const getCellMetadata = (p) => {
|
|
|
157
124
|
let hasDefaultExport = false;
|
|
158
125
|
const namedExports = [];
|
|
159
126
|
let operation;
|
|
160
|
-
(
|
|
127
|
+
traverse(ast, {
|
|
161
128
|
ExportDefaultDeclaration() {
|
|
162
129
|
hasDefaultExport = true;
|
|
163
130
|
return;
|
|
@@ -209,9 +176,9 @@ const getCellMetadata = (p) => {
|
|
|
209
176
|
);
|
|
210
177
|
let operationName = "";
|
|
211
178
|
if (operation) {
|
|
212
|
-
const document = (
|
|
179
|
+
const document = graphqlParse(operation);
|
|
213
180
|
for (const definition of document.definitions) {
|
|
214
|
-
if (definition.kind ===
|
|
181
|
+
if (definition.kind === Kind.OPERATION_DEFINITION && definition.name?.value) {
|
|
215
182
|
operationName = definition.name.value;
|
|
216
183
|
}
|
|
217
184
|
}
|
|
@@ -225,10 +192,10 @@ const getCellMetadata = (p) => {
|
|
|
225
192
|
};
|
|
226
193
|
};
|
|
227
194
|
function getCellAst(filePath) {
|
|
228
|
-
const code =
|
|
195
|
+
const code = fs.readFileSync(filePath, "utf-8");
|
|
229
196
|
const plugins = ["typescript", "jsx"].filter(Boolean);
|
|
230
197
|
try {
|
|
231
|
-
return (
|
|
198
|
+
return babelParse(code, {
|
|
232
199
|
sourceType: "module",
|
|
233
200
|
plugins
|
|
234
201
|
});
|
|
@@ -238,7 +205,7 @@ function getCellAst(filePath) {
|
|
|
238
205
|
throw new Error(e?.message);
|
|
239
206
|
}
|
|
240
207
|
}
|
|
241
|
-
|
|
242
|
-
|
|
208
|
+
export {
|
|
209
|
+
babel_plugin_redwood_mock_cell_data_default as default,
|
|
243
210
|
getCellMetadata
|
|
244
|
-
}
|
|
211
|
+
};
|
|
@@ -1,26 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var babel_plugin_redwood_remove_dev_fatal_error_page_exports = {};
|
|
20
|
-
__export(babel_plugin_redwood_remove_dev_fatal_error_page_exports, {
|
|
21
|
-
default: () => babel_plugin_redwood_remove_dev_fatal_error_page_default
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(babel_plugin_redwood_remove_dev_fatal_error_page_exports);
|
|
24
1
|
function babel_plugin_redwood_remove_dev_fatal_error_page_default({ types: t }) {
|
|
25
2
|
return {
|
|
26
3
|
name: "babel-plugin-redwood-remove-dev-fatal-error-page",
|
|
@@ -39,3 +16,6 @@ function babel_plugin_redwood_remove_dev_fatal_error_page_default({ types: t })
|
|
|
39
16
|
}
|
|
40
17
|
};
|
|
41
18
|
}
|
|
19
|
+
export {
|
|
20
|
+
babel_plugin_redwood_remove_dev_fatal_error_page_default as default
|
|
21
|
+
};
|
|
@@ -1,62 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var babel_plugin_redwood_routes_auto_loader_exports = {};
|
|
30
|
-
__export(babel_plugin_redwood_routes_auto_loader_exports, {
|
|
31
|
-
default: () => babel_plugin_redwood_routes_auto_loader_default
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(babel_plugin_redwood_routes_auto_loader_exports);
|
|
34
|
-
var import_node_fs = __toESM(require("node:fs"));
|
|
35
|
-
var import_node_path = __toESM(require("node:path"));
|
|
36
|
-
var import_project_config = require("@cedarjs/project-config");
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import {
|
|
4
|
+
ensurePosixPath,
|
|
5
|
+
getPaths,
|
|
6
|
+
importStatementPath,
|
|
7
|
+
processPagesDir,
|
|
8
|
+
resolveFile
|
|
9
|
+
} from "@cedarjs/project-config";
|
|
37
10
|
const getPathRelativeToSrc = (maybeAbsolutePath) => {
|
|
38
11
|
if (maybeAbsolutePath.startsWith("src/")) {
|
|
39
|
-
const basePath =
|
|
40
|
-
const resolved =
|
|
12
|
+
const basePath = path.join(getPaths().web.base, maybeAbsolutePath);
|
|
13
|
+
const resolved = resolveFile(basePath) || resolveFile(path.join(basePath, "index")) || resolveFile(path.join(basePath, path.basename(basePath)));
|
|
41
14
|
if (resolved) {
|
|
42
15
|
const withoutExt = resolved.replace(/\.[^/.]+$/, "");
|
|
43
|
-
return "./" +
|
|
16
|
+
return "./" + path.relative(getPaths().web.src, withoutExt);
|
|
44
17
|
}
|
|
45
18
|
return "./" + maybeAbsolutePath.slice("src/".length);
|
|
46
19
|
}
|
|
47
|
-
if (!
|
|
20
|
+
if (!path.isAbsolute(maybeAbsolutePath)) {
|
|
48
21
|
return maybeAbsolutePath;
|
|
49
22
|
}
|
|
50
|
-
return `./${
|
|
23
|
+
return `./${path.relative(getPaths().web.src, maybeAbsolutePath)}`;
|
|
51
24
|
};
|
|
52
25
|
const withRelativeImports = (page) => {
|
|
53
26
|
return {
|
|
54
27
|
...page,
|
|
55
|
-
relativeImport:
|
|
28
|
+
relativeImport: ensurePosixPath(getPathRelativeToSrc(page.importPath))
|
|
56
29
|
};
|
|
57
30
|
};
|
|
58
31
|
function babel_plugin_redwood_routes_auto_loader_default({ types: t }, { forPrerender = false }) {
|
|
59
|
-
let pages =
|
|
32
|
+
let pages = processPagesDir().map(withRelativeImports);
|
|
60
33
|
const duplicatePageImportNames = /* @__PURE__ */ new Set();
|
|
61
34
|
const sortedPageImportNames = pages.map((page) => page.importName).sort();
|
|
62
35
|
for (let i = 0; i < sortedPageImportNames.length - 1; i++) {
|
|
@@ -82,7 +55,7 @@ function babel_plugin_redwood_routes_auto_loader_default({ types: t }, { forPrer
|
|
|
82
55
|
return;
|
|
83
56
|
}
|
|
84
57
|
const userImportRelativePath = getPathRelativeToSrc(
|
|
85
|
-
|
|
58
|
+
importStatementPath(p.node.source?.value)
|
|
86
59
|
);
|
|
87
60
|
const defaultSpecifier = p.node.specifiers.find(
|
|
88
61
|
(specifiers) => t.isImportDefaultSpecifier(specifiers)
|
|
@@ -92,7 +65,7 @@ function babel_plugin_redwood_routes_auto_loader_default({ types: t }, { forPrer
|
|
|
92
65
|
}
|
|
93
66
|
if (forPrerender) {
|
|
94
67
|
const pageThatUserImported = pages.find((page) => {
|
|
95
|
-
return page.relativeImport ===
|
|
68
|
+
return page.relativeImport === ensurePosixPath(userImportRelativePath);
|
|
96
69
|
});
|
|
97
70
|
if (pageThatUserImported) {
|
|
98
71
|
pageThatUserImported.importName = defaultSpecifier.local.name;
|
|
@@ -104,21 +77,21 @@ function babel_plugin_redwood_routes_auto_loader_default({ types: t }, { forPrer
|
|
|
104
77
|
}
|
|
105
78
|
if (userImportRelativePath && defaultSpecifier) {
|
|
106
79
|
pages = pages.filter(
|
|
107
|
-
(page) => !(page.relativeImport ===
|
|
80
|
+
(page) => !(page.relativeImport === ensurePosixPath(userImportRelativePath))
|
|
108
81
|
);
|
|
109
82
|
}
|
|
110
83
|
},
|
|
111
84
|
Program: {
|
|
112
85
|
enter() {
|
|
113
|
-
pages =
|
|
114
|
-
const appPath =
|
|
86
|
+
pages = processPagesDir().map(withRelativeImports);
|
|
87
|
+
const appPath = resolveFile(path.join(getPaths().web.src, "App"));
|
|
115
88
|
if (appPath) {
|
|
116
|
-
const appSource =
|
|
89
|
+
const appSource = fs.readFileSync(appPath, "utf8");
|
|
117
90
|
const importRe = /^import\s+\w+\s+from\s+['"]([^'"]+)['"]/gm;
|
|
118
91
|
let m;
|
|
119
92
|
while ((m = importRe.exec(appSource)) !== null) {
|
|
120
|
-
const rel =
|
|
121
|
-
getPathRelativeToSrc(
|
|
93
|
+
const rel = ensurePosixPath(
|
|
94
|
+
getPathRelativeToSrc(importStatementPath(m[1]))
|
|
122
95
|
);
|
|
123
96
|
pages = pages.filter((page) => page.relativeImport !== rel);
|
|
124
97
|
}
|
|
@@ -195,3 +168,6 @@ function prerenderLoaderImpl(forPrerender, relativeImport, t) {
|
|
|
195
168
|
)
|
|
196
169
|
]);
|
|
197
170
|
}
|
|
171
|
+
export {
|
|
172
|
+
babel_plugin_redwood_routes_auto_loader_default as default
|
|
173
|
+
};
|
package/dist/web.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web.d.ts","sourceRoot":"","sources":["../src/web.ts"],"names":[],"mappings":"
|
|
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;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,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,GACjC,uBAAsB,KAA0B,uBA2GjD,CAAA;AAED,eAAO,MAAM,mBAAmB,GAC9B,4BAA2B,KAA+B,KACzD,gBAAgB,EA0ClB,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
|
@@ -1,52 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var web_exports = {};
|
|
30
|
-
__export(web_exports, {
|
|
31
|
-
getWebSideBabelConfigPath: () => getWebSideBabelConfigPath,
|
|
32
|
-
getWebSideBabelPlugins: () => getWebSideBabelPlugins,
|
|
33
|
-
getWebSideBabelPresets: () => getWebSideBabelPresets,
|
|
34
|
-
getWebSideDefaultBabelConfig: () => getWebSideDefaultBabelConfig,
|
|
35
|
-
getWebSideOverrides: () => getWebSideOverrides,
|
|
36
|
-
registerWebSideBabelHook: () => registerWebSideBabelHook
|
|
37
|
-
});
|
|
38
|
-
module.exports = __toCommonJS(web_exports);
|
|
39
|
-
var import_node_fs = __toESM(require("node:fs"));
|
|
40
|
-
var import_node_path = __toESM(require("node:path"));
|
|
41
|
-
var import_babel_plugin_module_resolver = require("babel-plugin-module-resolver");
|
|
42
|
-
var import_project_config = require("@cedarjs/project-config");
|
|
43
|
-
var import_common = require("./common.js");
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import { createRequire } from "node:module";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { resolvePath } from "babel-plugin-module-resolver";
|
|
5
|
+
import { getConfig, getPaths } from "@cedarjs/project-config";
|
|
6
|
+
import {
|
|
7
|
+
registerBabel,
|
|
8
|
+
parseTypeScriptConfigFiles,
|
|
9
|
+
getPathsFromTypeScriptConfig
|
|
10
|
+
} from "./common.js";
|
|
11
|
+
const require2 = createRequire(import.meta.url);
|
|
44
12
|
const getWebSideBabelPlugins = ({ forJest, forVite } = { forJest: false }) => {
|
|
45
|
-
const config =
|
|
13
|
+
const config = getConfig();
|
|
46
14
|
const useReactCompiler = config.experimental?.reactCompiler?.enabled && config.experimental?.reactCompiler?.lintOnly === false;
|
|
47
15
|
const useTrustedDocumentsGqlTag = config.graphql.trustedDocuments;
|
|
48
|
-
const rwjsPaths =
|
|
49
|
-
const tsConfigs =
|
|
16
|
+
const rwjsPaths = getPaths();
|
|
17
|
+
const tsConfigs = parseTypeScriptConfigFiles();
|
|
50
18
|
const plugins = [
|
|
51
19
|
// It is important that this plugin run first, as noted here: https://react.dev/learn/react-compiler
|
|
52
20
|
useReactCompiler && ["babel-plugin-react-compiler", { target: "19" }],
|
|
@@ -63,7 +31,7 @@ const getWebSideBabelPlugins = ({ forJest, forVite } = { forJest: false }) => {
|
|
|
63
31
|
// https://github.com/facebook/jest/issues/7359
|
|
64
32
|
src: forJest ? rwjsPaths.web.src : "./src",
|
|
65
33
|
// adds the paths from [ts|js]config.json to the module resolver
|
|
66
|
-
...
|
|
34
|
+
...getPathsFromTypeScriptConfig(tsConfigs.web, rwjsPaths.web.base),
|
|
67
35
|
$api: rwjsPaths.api.base
|
|
68
36
|
},
|
|
69
37
|
root: [rwjsPaths.web.base],
|
|
@@ -71,7 +39,7 @@ const getWebSideBabelPlugins = ({ forJest, forVite } = { forJest: false }) => {
|
|
|
71
39
|
loglevel: "silent",
|
|
72
40
|
// to silence the unnecessary warnings
|
|
73
41
|
resolvePath(sourcePath, currentFile, opts) {
|
|
74
|
-
const resolvedPath =
|
|
42
|
+
const resolvedPath = resolvePath(sourcePath, currentFile, opts);
|
|
75
43
|
return resolvedPath?.replace(/\.js$/, "");
|
|
76
44
|
}
|
|
77
45
|
},
|
|
@@ -81,7 +49,7 @@ const getWebSideBabelPlugins = ({ forJest, forVite } = { forJest: false }) => {
|
|
|
81
49
|
// packages/vite/src/plugins/vite-plugin-cedarjs-resolve-cedar-style-imports.ts
|
|
82
50
|
// instead of this babel plugin
|
|
83
51
|
!forVite && [
|
|
84
|
-
|
|
52
|
+
require2("./plugins/babel-plugin-redwood-directory-named-import").default,
|
|
85
53
|
void 0,
|
|
86
54
|
"rwjs-directory-named-modules"
|
|
87
55
|
],
|
|
@@ -124,7 +92,7 @@ const getWebSideBabelPlugins = ({ forJest, forVite } = { forJest: false }) => {
|
|
|
124
92
|
"rwjs-babel-graphql-tag"
|
|
125
93
|
],
|
|
126
94
|
forJest && process.env.NODE_ENV !== "development" && [
|
|
127
|
-
|
|
95
|
+
require2("./plugins/babel-plugin-redwood-remove-dev-fatal-error-page").default,
|
|
128
96
|
void 0,
|
|
129
97
|
"rwjs-remove-dev-fatal-error-page"
|
|
130
98
|
]
|
|
@@ -140,7 +108,7 @@ const getWebSideOverrides = ({ forPrerender, forVite } = { forPrerender: false }
|
|
|
140
108
|
test: /src[\/\\]Routes.(js|tsx|jsx)$/,
|
|
141
109
|
plugins: [
|
|
142
110
|
[
|
|
143
|
-
|
|
111
|
+
require2("./plugins/babel-plugin-redwood-routes-auto-loader").default,
|
|
144
112
|
// The plugin will modify the Routes file differently based on what
|
|
145
113
|
// context we're building for
|
|
146
114
|
{
|
|
@@ -160,7 +128,7 @@ const getWebSideOverrides = ({ forPrerender, forVite } = { forPrerender: false }
|
|
|
160
128
|
!forVite && process.env.NODE_ENV !== "production" && {
|
|
161
129
|
test: /.+Cell.mock.(js|ts)$/,
|
|
162
130
|
plugins: [
|
|
163
|
-
|
|
131
|
+
require2("./plugins/babel-plugin-redwood-mock-cell-data").default
|
|
164
132
|
]
|
|
165
133
|
}
|
|
166
134
|
];
|
|
@@ -174,7 +142,7 @@ const getWebSideBabelPresets = (options) => {
|
|
|
174
142
|
if (options.forPrerender || options.forJest || options.forJavaScriptLinting) {
|
|
175
143
|
let reactPresetConfig = { runtime: "automatic" };
|
|
176
144
|
if (getWebSideBabelConfigPath()) {
|
|
177
|
-
const userProjectConfig =
|
|
145
|
+
const userProjectConfig = require2(getWebSideBabelConfigPath());
|
|
178
146
|
userProjectConfig.presets?.forEach(
|
|
179
147
|
(preset) => {
|
|
180
148
|
if (!Array.isArray(preset)) {
|
|
@@ -203,8 +171,8 @@ const getWebSideBabelPresets = (options) => {
|
|
|
203
171
|
return [];
|
|
204
172
|
};
|
|
205
173
|
const getWebSideBabelConfigPath = () => {
|
|
206
|
-
const customBabelConfig =
|
|
207
|
-
if (
|
|
174
|
+
const customBabelConfig = path.join(getPaths().web.base, "babel.config.js");
|
|
175
|
+
if (fs.existsSync(customBabelConfig)) {
|
|
208
176
|
return customBabelConfig;
|
|
209
177
|
} else {
|
|
210
178
|
return void 0;
|
|
@@ -226,9 +194,9 @@ const registerWebSideBabelHook = ({
|
|
|
226
194
|
options = {}
|
|
227
195
|
} = {}) => {
|
|
228
196
|
const defaultOptions = getWebSideDefaultBabelConfig(options);
|
|
229
|
-
|
|
197
|
+
registerBabel({
|
|
230
198
|
...defaultOptions,
|
|
231
|
-
root:
|
|
199
|
+
root: getPaths().base,
|
|
232
200
|
extensions: [".js", ".ts", ".tsx", ".jsx"],
|
|
233
201
|
plugins: [...defaultOptions.plugins, ...plugins],
|
|
234
202
|
cache: false,
|
|
@@ -237,12 +205,11 @@ const registerWebSideBabelHook = ({
|
|
|
237
205
|
overrides: [...getWebSideOverrides({ forPrerender: true }), ...overrides]
|
|
238
206
|
});
|
|
239
207
|
};
|
|
240
|
-
|
|
241
|
-
0 && (module.exports = {
|
|
208
|
+
export {
|
|
242
209
|
getWebSideBabelConfigPath,
|
|
243
210
|
getWebSideBabelPlugins,
|
|
244
211
|
getWebSideBabelPresets,
|
|
245
212
|
getWebSideDefaultBabelConfig,
|
|
246
213
|
getWebSideOverrides,
|
|
247
214
|
registerWebSideBabelHook
|
|
248
|
-
}
|
|
215
|
+
};
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/babel-config",
|
|
3
|
-
"version": "6.0.0-canary.
|
|
3
|
+
"version": "6.0.0-canary.2776",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/cedarjs/cedar.git",
|
|
7
7
|
"directory": "packages/babel-config"
|
|
8
8
|
},
|
|
9
9
|
"license": "MIT",
|
|
10
|
-
"type": "
|
|
10
|
+
"type": "module",
|
|
11
11
|
"exports": {
|
|
12
12
|
".": "./dist/index.js",
|
|
13
13
|
"./dist/plugins/*": "./dist/plugins/*"
|
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
"dist"
|
|
18
18
|
],
|
|
19
19
|
"scripts": {
|
|
20
|
-
"build": "node ./build.mts
|
|
20
|
+
"build": "node ./build.mts",
|
|
21
21
|
"build:pack": "yarn pack -o cedarjs-babel-config.tgz",
|
|
22
|
-
"build:types": "tsc --build --verbose",
|
|
22
|
+
"build:types": "tsc --build --verbose ./tsconfig.build.json",
|
|
23
23
|
"build:watch": "nodemon --watch src --ext \"js,ts,tsx\" --ignore dist --exec \"yarn build\"",
|
|
24
24
|
"prepublishOnly": "NODE_ENV=production yarn build",
|
|
25
25
|
"test": "vitest run",
|
|
@@ -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.7",
|
|
38
|
-
"@cedarjs/project-config": "6.0.0-canary.
|
|
38
|
+
"@cedarjs/project-config": "6.0.0-canary.2776",
|
|
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,7 +44,7 @@
|
|
|
44
44
|
"typescript": "5.9.3"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@cedarjs/framework-tools": "6.0.0-canary.
|
|
47
|
+
"@cedarjs/framework-tools": "6.0.0-canary.2776",
|
|
48
48
|
"@jridgewell/trace-mapping": "0.3.31",
|
|
49
49
|
"@types/babel-plugin-tester": "11.0.0",
|
|
50
50
|
"@types/babel__core": "7.20.5",
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
const config = {
|
|
3
|
-
bracketSpacing: true,
|
|
4
|
-
tabWidth: 2,
|
|
5
|
-
semi: false,
|
|
6
|
-
singleQuote: true,
|
|
7
|
-
plugins: [
|
|
8
|
-
"prettier-plugin-curly",
|
|
9
|
-
// I have this prettier config here because babel-plugin-tester v11 that
|
|
10
|
-
// we're currently using uses prettier v2, and prettier-plugin-sh requires
|
|
11
|
-
// prettier v3. By putting this prettier config here, babel-plugin-tester
|
|
12
|
-
// will use this, and run its output through prettier without loading the
|
|
13
|
-
// prettier-plugin-sh plugin, which it really doesn't need anyway since
|
|
14
|
-
// we're not asking it to format shell scripts or other shell files.
|
|
15
|
-
// 'prettier-plugin-sh',
|
|
16
|
-
"prettier-plugin-packagejson"
|
|
17
|
-
],
|
|
18
|
-
overrides: [
|
|
19
|
-
{
|
|
20
|
-
files: ["tsconfig.cjs.json"],
|
|
21
|
-
options: {
|
|
22
|
-
parser: "jsonc",
|
|
23
|
-
trailingComma: "none"
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
]
|
|
27
|
-
};
|
|
28
|
-
module.exports = config;
|