@cedarjs/babel-config 5.0.6 → 5.0.7-next.219
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 +42 -10
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +84 -111
- package/dist/common.d.ts +2 -10
- package/dist/common.d.ts.map +1 -1
- package/dist/common.js +20 -75
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +28 -48
- package/dist/plugins/{babel-plugin-redwood-context-wrapping.d.ts → babel-plugin-handler-als-wrapping.d.ts} +1 -1
- package/dist/plugins/babel-plugin-handler-als-wrapping.d.ts.map +1 -0
- package/dist/plugins/{babel-plugin-redwood-context-wrapping.js → babel-plugin-handler-als-wrapping.js} +19 -39
- 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 +48 -71
- package/package.json +7 -7
- package/dist/plugins/babel-plugin-cedar-gqlorm-inject.d.ts +0 -32
- package/dist/plugins/babel-plugin-cedar-gqlorm-inject.d.ts.map +0 -1
- package/dist/plugins/babel-plugin-cedar-gqlorm-inject.js +0 -154
- package/dist/plugins/babel-plugin-cedar-graphql-options-extract.d.ts +0 -5
- package/dist/plugins/babel-plugin-cedar-graphql-options-extract.d.ts.map +0 -1
- package/dist/plugins/babel-plugin-cedar-graphql-options-extract.js +0 -88
- package/dist/plugins/babel-plugin-redwood-context-wrapping.d.ts.map +0 -1
- package/dist/plugins/babel-plugin-redwood-otel-wrapping.d.ts +0 -5
- package/dist/plugins/babel-plugin-redwood-otel-wrapping.d.ts.map +0 -1
- package/dist/plugins/babel-plugin-redwood-otel-wrapping.js +0 -329
- package/dist/plugins/prettier.config.js +0 -28
package/dist/index.js
CHANGED
|
@@ -1,55 +1,35 @@
|
|
|
1
|
-
|
|
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 index_exports = {};
|
|
20
|
-
__export(index_exports, {
|
|
21
|
-
TARGETS_NODE: () => import_api.TARGETS_NODE,
|
|
22
|
-
getApiSideBabelConfigPath: () => import_api.getApiSideBabelConfigPath,
|
|
23
|
-
getApiSideBabelPlugins: () => import_api.getApiSideBabelPlugins,
|
|
24
|
-
getApiSideBabelPresets: () => import_api.getApiSideBabelPresets,
|
|
25
|
-
getApiSideDefaultBabelConfig: () => import_api.getApiSideDefaultBabelConfig,
|
|
26
|
-
getCommonPlugins: () => import_common.getCommonPlugins,
|
|
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 {
|
|
46
2
|
TARGETS_NODE,
|
|
47
3
|
getApiSideBabelConfigPath,
|
|
48
4
|
getApiSideBabelPlugins,
|
|
5
|
+
getApiSideBabelPluginsForVite,
|
|
49
6
|
getApiSideBabelPresets,
|
|
50
7
|
getApiSideDefaultBabelConfig,
|
|
51
|
-
|
|
52
|
-
|
|
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 {
|
|
26
|
+
TARGETS_NODE,
|
|
27
|
+
getApiSideBabelConfigPath,
|
|
28
|
+
getApiSideBabelPlugins,
|
|
29
|
+
getApiSideBabelPluginsForVite,
|
|
30
|
+
getApiSideBabelPresets,
|
|
31
|
+
getApiSideDefaultBabelConfig,
|
|
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
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
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,33 +1,10 @@
|
|
|
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_context_wrapping_exports = {};
|
|
20
|
-
__export(babel_plugin_redwood_context_wrapping_exports, {
|
|
21
|
-
default: () => babel_plugin_redwood_context_wrapping_default
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(babel_plugin_redwood_context_wrapping_exports);
|
|
24
1
|
function generateWrappedHandler(t, isAsync) {
|
|
25
2
|
const contextStoreVariableDeclaration = t.variableDeclaration("const", [
|
|
26
3
|
t.variableDeclarator(
|
|
27
|
-
t.identifier("
|
|
4
|
+
t.identifier("__cedar_contextStore"),
|
|
28
5
|
t.callExpression(
|
|
29
6
|
t.memberExpression(
|
|
30
|
-
t.callExpression(t.identifier("
|
|
7
|
+
t.callExpression(t.identifier("__cedar_getAsyncStoreInstance"), []),
|
|
31
8
|
t.identifier("getStore")
|
|
32
9
|
),
|
|
33
10
|
[]
|
|
@@ -41,13 +18,13 @@ function generateWrappedHandler(t, isAsync) {
|
|
|
41
18
|
true
|
|
42
19
|
);
|
|
43
20
|
return t.arrowFunctionExpression(
|
|
44
|
-
[t.identifier("
|
|
21
|
+
[t.identifier("__cedar_event"), t.identifier("__cedar_context")],
|
|
45
22
|
t.blockStatement([
|
|
46
23
|
contextStoreVariableDeclaration,
|
|
47
24
|
t.ifStatement(
|
|
48
25
|
t.binaryExpression(
|
|
49
26
|
"===",
|
|
50
|
-
t.identifier("
|
|
27
|
+
t.identifier("__cedar_contextStore"),
|
|
51
28
|
t.identifier("undefined")
|
|
52
29
|
),
|
|
53
30
|
t.blockStatement([
|
|
@@ -55,34 +32,34 @@ function generateWrappedHandler(t, isAsync) {
|
|
|
55
32
|
t.callExpression(
|
|
56
33
|
t.memberExpression(
|
|
57
34
|
t.callExpression(
|
|
58
|
-
t.identifier("
|
|
35
|
+
t.identifier("__cedar_getAsyncStoreInstance"),
|
|
59
36
|
[]
|
|
60
37
|
),
|
|
61
38
|
t.identifier("run")
|
|
62
39
|
),
|
|
63
40
|
[
|
|
64
41
|
t.newExpression(t.identifier("Map"), []),
|
|
65
|
-
t.identifier("
|
|
66
|
-
t.identifier("
|
|
67
|
-
t.identifier("
|
|
42
|
+
t.identifier("__cedar_handler"),
|
|
43
|
+
t.identifier("__cedar_event"),
|
|
44
|
+
t.identifier("__cedar_context")
|
|
68
45
|
]
|
|
69
46
|
)
|
|
70
47
|
)
|
|
71
48
|
])
|
|
72
49
|
),
|
|
73
50
|
t.returnStatement(
|
|
74
|
-
t.callExpression(t.identifier("
|
|
75
|
-
t.identifier("
|
|
76
|
-
t.identifier("
|
|
51
|
+
t.callExpression(t.identifier("__cedar_handler"), [
|
|
52
|
+
t.identifier("__cedar_event"),
|
|
53
|
+
t.identifier("__cedar_context")
|
|
77
54
|
])
|
|
78
55
|
)
|
|
79
56
|
]),
|
|
80
57
|
isAsync
|
|
81
58
|
);
|
|
82
59
|
}
|
|
83
|
-
function
|
|
60
|
+
function babel_plugin_handler_als_wrapping_default({ types: t }, { projectIsEsm = false } = {}) {
|
|
84
61
|
return {
|
|
85
|
-
name: "babel-plugin-
|
|
62
|
+
name: "babel-plugin-handler-als-wrapping",
|
|
86
63
|
visitor: {
|
|
87
64
|
ExportNamedDeclaration(path, _state) {
|
|
88
65
|
const declaration = path.node.declaration;
|
|
@@ -101,11 +78,11 @@ function babel_plugin_redwood_context_wrapping_default({ types: t }, { projectIs
|
|
|
101
78
|
return;
|
|
102
79
|
}
|
|
103
80
|
path.insertBefore(
|
|
104
|
-
// import { getAsyncStoreInstance as
|
|
81
|
+
// import { getAsyncStoreInstance as __cedar_getAsyncStoreInstance } from '@cedarjs/context/dist/store'
|
|
105
82
|
t.importDeclaration(
|
|
106
83
|
[
|
|
107
84
|
t.importSpecifier(
|
|
108
|
-
t.identifier("
|
|
85
|
+
t.identifier("__cedar_getAsyncStoreInstance"),
|
|
109
86
|
t.identifier("getAsyncStoreInstance")
|
|
110
87
|
)
|
|
111
88
|
],
|
|
@@ -117,7 +94,7 @@ function babel_plugin_redwood_context_wrapping_default({ types: t }, { projectIs
|
|
|
117
94
|
path.insertBefore(
|
|
118
95
|
t.variableDeclaration("const", [
|
|
119
96
|
t.variableDeclarator(
|
|
120
|
-
t.identifier("
|
|
97
|
+
t.identifier("__cedar_handler"),
|
|
121
98
|
declaration.declarations[0].init
|
|
122
99
|
)
|
|
123
100
|
])
|
|
@@ -132,3 +109,6 @@ function babel_plugin_redwood_context_wrapping_default({ types: t }, { projectIs
|
|
|
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
|
+
};
|