@cedarjs/babel-config 5.0.4-next.167 → 5.0.4

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.
Files changed (33) hide show
  1. package/dist/api.d.ts +10 -42
  2. package/dist/api.d.ts.map +1 -1
  3. package/dist/api.js +111 -84
  4. package/dist/common.d.ts +10 -2
  5. package/dist/common.d.ts.map +1 -1
  6. package/dist/common.js +75 -20
  7. package/dist/index.d.ts +3 -3
  8. package/dist/index.d.ts.map +1 -1
  9. package/dist/index.js +48 -28
  10. package/dist/plugins/babel-plugin-cedar-gqlorm-inject.d.ts +32 -0
  11. package/dist/plugins/babel-plugin-cedar-gqlorm-inject.d.ts.map +1 -0
  12. package/dist/plugins/babel-plugin-cedar-gqlorm-inject.js +154 -0
  13. package/dist/plugins/babel-plugin-cedar-graphql-options-extract.d.ts +5 -0
  14. package/dist/plugins/babel-plugin-cedar-graphql-options-extract.d.ts.map +1 -0
  15. package/dist/plugins/babel-plugin-cedar-graphql-options-extract.js +88 -0
  16. package/dist/plugins/{babel-plugin-handler-als-wrapping.d.ts → babel-plugin-redwood-context-wrapping.d.ts} +1 -1
  17. package/dist/plugins/babel-plugin-redwood-context-wrapping.d.ts.map +1 -0
  18. package/dist/plugins/{babel-plugin-handler-als-wrapping.js → babel-plugin-redwood-context-wrapping.js} +39 -19
  19. package/dist/plugins/babel-plugin-redwood-directory-named-import.js +39 -9
  20. package/dist/plugins/babel-plugin-redwood-import-dir.js +40 -10
  21. package/dist/plugins/babel-plugin-redwood-job-path-injector.js +37 -7
  22. package/dist/plugins/babel-plugin-redwood-mock-cell-data.d.ts.map +1 -1
  23. package/dist/plugins/babel-plugin-redwood-mock-cell-data.js +52 -19
  24. package/dist/plugins/babel-plugin-redwood-otel-wrapping.d.ts +5 -0
  25. package/dist/plugins/babel-plugin-redwood-otel-wrapping.d.ts.map +1 -0
  26. package/dist/plugins/babel-plugin-redwood-otel-wrapping.js +329 -0
  27. package/dist/plugins/babel-plugin-redwood-remove-dev-fatal-error-page.js +23 -3
  28. package/dist/plugins/babel-plugin-redwood-routes-auto-loader.js +51 -27
  29. package/dist/plugins/prettier.config.js +28 -0
  30. package/dist/web.d.ts.map +1 -1
  31. package/dist/web.js +71 -48
  32. package/package.json +7 -7
  33. package/dist/plugins/babel-plugin-handler-als-wrapping.d.ts.map +0 -1
package/dist/index.js CHANGED
@@ -1,35 +1,55 @@
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 {
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 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 = {
26
46
  TARGETS_NODE,
27
47
  getApiSideBabelConfigPath,
28
48
  getApiSideBabelPlugins,
29
- getApiSideBabelPluginsForVite,
30
49
  getApiSideBabelPresets,
31
50
  getApiSideDefaultBabelConfig,
32
- getPathsFromTypeScriptConfig as getPathsFromConfig,
51
+ getCommonPlugins,
52
+ getPathsFromConfig,
33
53
  getRouteHookBabelPlugins,
34
54
  getWebSideBabelConfigPath,
35
55
  getWebSideBabelPlugins,
@@ -41,4 +61,4 @@ export {
41
61
  registerBabel,
42
62
  registerWebSideBabelHook,
43
63
  transformWithBabel
44
- };
64
+ });
@@ -0,0 +1,32 @@
1
+ import type { PluginObj, types } from '@babel/core';
2
+ /**
3
+ * Babel plugin that injects the auto-generated gqlorm backend into
4
+ * `api/src/functions/graphql.ts` at build time.
5
+ *
6
+ * When `experimental.gqlorm.enabled = true` and `.cedar/gqlorm/backend.ts`
7
+ * exists, this plugin:
8
+ *
9
+ * 1. Adds imports at the top of graphql.ts:
10
+ * import * as __gqlorm_sdl__ from '../../../.cedar/gqlorm/backend'
11
+ * import { db as __gqlorm_db__ } from 'src/lib/db'
12
+ *
13
+ * 2. Inserts a statement immediately before the `createGraphQLHandler` call:
14
+ * sdls = {
15
+ * ...sdls,
16
+ * __gqlorm__: {
17
+ * schema: __gqlorm_sdl__.schema,
18
+ * resolvers: __gqlorm_sdl__.createGqlormResolvers(__gqlorm_db__),
19
+ * },
20
+ * }
21
+ *
22
+ * The `sdls` variable is already a `let` binding at this point because
23
+ * `babel-plugin-redwood-import-dir` transforms the glob import
24
+ * `import sdls from 'src/graphql/**\/*.sdl.{js,ts}'` into `let sdls = {}`.
25
+ *
26
+ * This plugin is a no-op when gqlorm is disabled or the backend file does
27
+ * not exist.
28
+ */
29
+ export default function ({ types: t }: {
30
+ types: typeof types;
31
+ }): PluginObj;
32
+ //# sourceMappingURL=babel-plugin-cedar-gqlorm-inject.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"babel-plugin-cedar-gqlorm-inject.d.ts","sourceRoot":"","sources":["../../src/plugins/babel-plugin-cedar-gqlorm-inject.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAY,SAAS,EAAc,KAAK,EAAE,MAAM,aAAa,CAAA;AAIzE;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,CAAC,OAAO,WAAW,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;IAAE,KAAK,EAAE,OAAO,KAAK,CAAA;CAAE,GAAG,SAAS,CA8KzE"}
@@ -0,0 +1,154 @@
1
+ "use strict";
2
+ var __create = Object.create;
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_cedar_gqlorm_inject_exports = {};
30
+ __export(babel_plugin_cedar_gqlorm_inject_exports, {
31
+ default: () => babel_plugin_cedar_gqlorm_inject_default
32
+ });
33
+ module.exports = __toCommonJS(babel_plugin_cedar_gqlorm_inject_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");
37
+ function babel_plugin_cedar_gqlorm_inject_default({ types: t }) {
38
+ return {
39
+ name: "babel-plugin-cedar-gqlorm-inject",
40
+ visitor: {
41
+ Program(programPath, state) {
42
+ let config;
43
+ try {
44
+ config = (0, import_project_config.getConfig)();
45
+ } catch {
46
+ return;
47
+ }
48
+ if (!config.experimental?.gqlorm?.enabled) {
49
+ return;
50
+ }
51
+ let paths;
52
+ try {
53
+ paths = (0, import_project_config.getPaths)();
54
+ } catch {
55
+ return;
56
+ }
57
+ const backendPathWithoutExt = import_node_path.default.join(
58
+ paths.generated.base,
59
+ "gqlorm",
60
+ "backend"
61
+ );
62
+ const backendExists = import_node_fs.default.existsSync(backendPathWithoutExt + ".ts") || import_node_fs.default.existsSync(backendPathWithoutExt + ".js");
63
+ if (!backendExists) {
64
+ return;
65
+ }
66
+ const importNames = /* @__PURE__ */ new Set();
67
+ programPath.traverse({
68
+ ImportDeclaration(p) {
69
+ if (t.isStringLiteral(p.node.source, {
70
+ value: "@cedarjs/graphql-server"
71
+ })) {
72
+ for (const specifier of p.node.specifiers) {
73
+ if (t.isImportSpecifier(specifier) && t.isIdentifier(specifier.imported) && specifier.imported.name === "createGraphQLHandler") {
74
+ importNames.add(specifier.local.name);
75
+ }
76
+ }
77
+ }
78
+ }
79
+ });
80
+ if (importNames.size === 0) {
81
+ return;
82
+ }
83
+ const callExpressionPaths = [];
84
+ programPath.traverse({
85
+ CallExpression(p) {
86
+ if (t.isIdentifier(p.node.callee) && importNames.has(p.node.callee.name)) {
87
+ callExpressionPaths.push(p);
88
+ }
89
+ }
90
+ });
91
+ if (callExpressionPaths.length === 0) {
92
+ return;
93
+ }
94
+ const callExpressionPath = callExpressionPaths[0];
95
+ const statementParent = callExpressionPath.getStatementParent();
96
+ if (!statementParent) {
97
+ return;
98
+ }
99
+ const filename = state.file.opts.filename;
100
+ if (!filename) {
101
+ return;
102
+ }
103
+ const relPath = import_node_path.default.relative(import_node_path.default.dirname(filename), backendPathWithoutExt).replace(/\\/g, "/") + ".ts";
104
+ const importSdl = t.importDeclaration(
105
+ [t.importNamespaceSpecifier(t.identifier("__gqlorm_sdl__"))],
106
+ t.stringLiteral(relPath)
107
+ );
108
+ const importDb = t.importDeclaration(
109
+ [
110
+ t.importSpecifier(
111
+ t.identifier("__gqlorm_db__"),
112
+ t.identifier("db")
113
+ )
114
+ ],
115
+ t.stringLiteral("src/lib/db")
116
+ );
117
+ programPath.unshiftContainer("body", [importDb, importSdl]);
118
+ const sdlsMutation = t.expressionStatement(
119
+ t.callExpression(
120
+ t.memberExpression(t.identifier("Object"), t.identifier("assign")),
121
+ [
122
+ t.identifier("sdls"),
123
+ t.objectExpression([
124
+ t.objectProperty(
125
+ t.identifier("__gqlorm__"),
126
+ t.objectExpression([
127
+ t.objectProperty(
128
+ t.identifier("schema"),
129
+ t.memberExpression(
130
+ t.identifier("__gqlorm_sdl__"),
131
+ t.identifier("schema")
132
+ )
133
+ ),
134
+ t.objectProperty(
135
+ t.identifier("resolvers"),
136
+ t.callExpression(
137
+ t.memberExpression(
138
+ t.identifier("__gqlorm_sdl__"),
139
+ t.identifier("createGqlormResolvers")
140
+ ),
141
+ [t.identifier("__gqlorm_db__")]
142
+ )
143
+ )
144
+ ])
145
+ )
146
+ ])
147
+ ]
148
+ )
149
+ );
150
+ statementParent.insertBefore(sdlsMutation);
151
+ }
152
+ }
153
+ };
154
+ }
@@ -0,0 +1,5 @@
1
+ import type { PluginObj, types } from '@babel/core';
2
+ export default function ({ types: t }: {
3
+ types: typeof types;
4
+ }): PluginObj;
5
+ //# sourceMappingURL=babel-plugin-cedar-graphql-options-extract.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"babel-plugin-cedar-graphql-options-extract.d.ts","sourceRoot":"","sources":["../../src/plugins/babel-plugin-cedar-graphql-options-extract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAY,SAAS,EAAc,KAAK,EAAE,MAAM,aAAa,CAAA;AAkCzE,MAAM,CAAC,OAAO,WAAW,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;IAAE,KAAK,EAAE,OAAO,KAAK,CAAA;CAAE,GAAG,SAAS,CAyEzE"}
@@ -0,0 +1,88 @@
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_cedar_graphql_options_extract_exports = {};
20
+ __export(babel_plugin_cedar_graphql_options_extract_exports, {
21
+ default: () => babel_plugin_cedar_graphql_options_extract_default
22
+ });
23
+ module.exports = __toCommonJS(babel_plugin_cedar_graphql_options_extract_exports);
24
+ const exportVariableName = "__cedar_graphqlOptions";
25
+ function optionsConstNode(t, value, state) {
26
+ if (t.isIdentifier(value) || t.isObjectExpression(value) || t.isCallExpression(value) || t.isConditionalExpression(value)) {
27
+ return t.exportNamedDeclaration(
28
+ t.variableDeclaration("const", [
29
+ t.variableDeclarator(t.identifier(exportVariableName), value)
30
+ ])
31
+ );
32
+ } else {
33
+ throw new Error(
34
+ `Unable to parse graphql function options in '${state.file.opts.filename}'`
35
+ );
36
+ }
37
+ }
38
+ function babel_plugin_cedar_graphql_options_extract_default({ types: t }) {
39
+ return {
40
+ name: "babel-plugin-cedar-graphql-options-extract",
41
+ visitor: {
42
+ Program(path, state) {
43
+ const importNames = /* @__PURE__ */ new Set();
44
+ path.traverse({
45
+ ImportDeclaration(p) {
46
+ if (t.isStringLiteral(p.node.source, {
47
+ value: "@cedarjs/graphql-server"
48
+ })) {
49
+ for (const specifier of p.node.specifiers) {
50
+ if (t.isImportSpecifier(specifier) && t.isIdentifier(specifier.imported) && specifier.imported.name === "createGraphQLHandler") {
51
+ importNames.add(specifier.local.name);
52
+ }
53
+ }
54
+ }
55
+ }
56
+ });
57
+ const callExpressionPaths = [];
58
+ path.traverse({
59
+ CallExpression(p) {
60
+ if (t.isIdentifier(p.node.callee) && importNames.has(p.node.callee.name)) {
61
+ callExpressionPaths.push(p);
62
+ }
63
+ }
64
+ });
65
+ if (callExpressionPaths.length > 1) {
66
+ console.log(
67
+ `There are ${callExpressionPaths.length} calls to 'createGraphQLHandler' in '${state.file.opts.filename}'. The automatic extraction of graphql options will fallback to the first usage.`
68
+ );
69
+ return;
70
+ }
71
+ const callExpressionPath = callExpressionPaths[0];
72
+ if (!callExpressionPath) {
73
+ return;
74
+ }
75
+ const options = callExpressionPath.node.arguments[0];
76
+ const optionsConst = optionsConstNode(t, options, state);
77
+ const statementParent = callExpressionPath.getStatementParent();
78
+ if (!statementParent) {
79
+ throw new Error(
80
+ `Unable to find statement parent for graphql function in '${state.file.opts.filename}'`
81
+ );
82
+ }
83
+ statementParent.insertBefore(optionsConst);
84
+ callExpressionPath.node.arguments[0] = t.identifier(exportVariableName);
85
+ }
86
+ }
87
+ };
88
+ }
@@ -4,4 +4,4 @@ export default function ({ types: t }: {
4
4
  }, { projectIsEsm }?: {
5
5
  projectIsEsm?: boolean;
6
6
  }): PluginObj;
7
- //# sourceMappingURL=babel-plugin-handler-als-wrapping.d.ts.map
7
+ //# sourceMappingURL=babel-plugin-redwood-context-wrapping.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"babel-plugin-redwood-context-wrapping.d.ts","sourceRoot":"","sources":["../../src/plugins/babel-plugin-redwood-context-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,10 +1,33 @@
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);
1
24
  function generateWrappedHandler(t, isAsync) {
2
25
  const contextStoreVariableDeclaration = t.variableDeclaration("const", [
3
26
  t.variableDeclarator(
4
- t.identifier("__cedar_contextStore"),
27
+ t.identifier("__rw_contextStore"),
5
28
  t.callExpression(
6
29
  t.memberExpression(
7
- t.callExpression(t.identifier("__cedar_getAsyncStoreInstance"), []),
30
+ t.callExpression(t.identifier("__rw_getAsyncStoreInstance"), []),
8
31
  t.identifier("getStore")
9
32
  ),
10
33
  []
@@ -18,13 +41,13 @@ function generateWrappedHandler(t, isAsync) {
18
41
  true
19
42
  );
20
43
  return t.arrowFunctionExpression(
21
- [t.identifier("__cedar_event"), t.identifier("__cedar_context")],
44
+ [t.identifier("__rw_event"), t.identifier("__rw__context")],
22
45
  t.blockStatement([
23
46
  contextStoreVariableDeclaration,
24
47
  t.ifStatement(
25
48
  t.binaryExpression(
26
49
  "===",
27
- t.identifier("__cedar_contextStore"),
50
+ t.identifier("__rw_contextStore"),
28
51
  t.identifier("undefined")
29
52
  ),
30
53
  t.blockStatement([
@@ -32,34 +55,34 @@ function generateWrappedHandler(t, isAsync) {
32
55
  t.callExpression(
33
56
  t.memberExpression(
34
57
  t.callExpression(
35
- t.identifier("__cedar_getAsyncStoreInstance"),
58
+ t.identifier("__rw_getAsyncStoreInstance"),
36
59
  []
37
60
  ),
38
61
  t.identifier("run")
39
62
  ),
40
63
  [
41
64
  t.newExpression(t.identifier("Map"), []),
42
- t.identifier("__cedar_handler"),
43
- t.identifier("__cedar_event"),
44
- t.identifier("__cedar_context")
65
+ t.identifier("__rw_handler"),
66
+ t.identifier("__rw_event"),
67
+ t.identifier("__rw__context")
45
68
  ]
46
69
  )
47
70
  )
48
71
  ])
49
72
  ),
50
73
  t.returnStatement(
51
- t.callExpression(t.identifier("__cedar_handler"), [
52
- t.identifier("__cedar_event"),
53
- t.identifier("__cedar_context")
74
+ t.callExpression(t.identifier("__rw_handler"), [
75
+ t.identifier("__rw_event"),
76
+ t.identifier("__rw__context")
54
77
  ])
55
78
  )
56
79
  ]),
57
80
  isAsync
58
81
  );
59
82
  }
60
- function babel_plugin_handler_als_wrapping_default({ types: t }, { projectIsEsm = false } = {}) {
83
+ function babel_plugin_redwood_context_wrapping_default({ types: t }, { projectIsEsm = false } = {}) {
61
84
  return {
62
- name: "babel-plugin-handler-als-wrapping",
85
+ name: "babel-plugin-redwood-context-wrapping",
63
86
  visitor: {
64
87
  ExportNamedDeclaration(path, _state) {
65
88
  const declaration = path.node.declaration;
@@ -78,11 +101,11 @@ function babel_plugin_handler_als_wrapping_default({ types: t }, { projectIsEsm
78
101
  return;
79
102
  }
80
103
  path.insertBefore(
81
- // import { getAsyncStoreInstance as __cedar_getAsyncStoreInstance } from '@cedarjs/context/dist/store'
104
+ // import { getAsyncStoreInstance as __rw_getAsyncStoreInstance } from '@cedarjs/context/dist/store'
82
105
  t.importDeclaration(
83
106
  [
84
107
  t.importSpecifier(
85
- t.identifier("__cedar_getAsyncStoreInstance"),
108
+ t.identifier("__rw_getAsyncStoreInstance"),
86
109
  t.identifier("getAsyncStoreInstance")
87
110
  )
88
111
  ],
@@ -94,7 +117,7 @@ function babel_plugin_handler_als_wrapping_default({ types: t }, { projectIsEsm
94
117
  path.insertBefore(
95
118
  t.variableDeclaration("const", [
96
119
  t.variableDeclarator(
97
- t.identifier("__cedar_handler"),
120
+ t.identifier("__rw_handler"),
98
121
  declaration.declarations[0].init
99
122
  )
100
123
  ])
@@ -109,6 +132,3 @@ function babel_plugin_handler_als_wrapping_default({ types: t }, { projectIsEsm
109
132
  }
110
133
  };
111
134
  }
112
- export {
113
- babel_plugin_handler_als_wrapping_default as default
114
- };
@@ -1,14 +1,47 @@
1
- import path from "path";
2
- import { resolveFile } from "@cedarjs/project-config";
1
+ "use strict";
2
+ var __create = Object.create;
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");
3
36
  const getNewPath = (value, filename) => {
4
- const dirname = path.dirname(value);
5
- const basename = path.basename(value);
37
+ const dirname = import_path.default.dirname(value);
38
+ const basename = import_path.default.basename(value);
6
39
  const indexImportPath = [dirname, basename, "index"].join("/");
7
- if (resolveFile(path.resolve(path.dirname(filename), indexImportPath))) {
40
+ if ((0, import_project_config.resolveFile)(import_path.default.resolve(import_path.default.dirname(filename), indexImportPath))) {
8
41
  return indexImportPath;
9
42
  } else {
10
43
  const dirnameImportPath = [dirname, basename, basename].join("/");
11
- if (resolveFile(path.resolve(path.dirname(filename), dirnameImportPath))) {
44
+ if ((0, import_project_config.resolveFile)(import_path.default.resolve(import_path.default.dirname(filename), dirnameImportPath))) {
12
45
  return dirnameImportPath;
13
46
  }
14
47
  }
@@ -59,6 +92,3 @@ function babel_plugin_redwood_directory_named_import_default({ types: t }) {
59
92
  }
60
93
  };
61
94
  }
62
- export {
63
- babel_plugin_redwood_directory_named_import_default as default
64
- };
@@ -1,6 +1,39 @@
1
- import path from "path";
2
- import fg from "fast-glob";
3
- import { importStatementPath } from "@cedarjs/project-config";
1
+ "use strict";
2
+ var __create = Object.create;
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_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");
4
37
  function babel_plugin_redwood_import_dir_default({ types: t }) {
5
38
  return {
6
39
  name: "babel-plugin-redwood-import-dir",
@@ -19,15 +52,15 @@ function babel_plugin_redwood_import_dir_default({ types: t }) {
19
52
  )
20
53
  ])
21
54
  );
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"));
55
+ const importGlob = (0, import_project_config.importStatementPath)(p.node.source.value);
56
+ const cwd = import_path.default.dirname(state.file.opts.filename);
57
+ const dirFiles = import_fast_glob.default.sync(importGlob, { cwd }).filter((n) => !n.includes(".test.")).filter((n) => !n.includes(".scenarios.")).filter((n) => !n.includes(".d.ts"));
25
58
  const staticGlob = importGlob.split("*")[0];
26
59
  const filePathToVarName = (filePath) => {
27
60
  return filePath.replace(staticGlob, "").replace(/\.(js|ts)$/, "").replace(/[^a-zA-Z0-9]/g, "_");
28
61
  };
29
62
  for (const filePath of dirFiles) {
30
- const { dir: fileDir, name: fileName } = path.parse(filePath);
63
+ const { dir: fileDir, name: fileName } = import_path.default.parse(filePath);
31
64
  const filePathWithoutExtension = fileDir + "/" + fileName;
32
65
  const fpVarName = filePathToVarName(filePath);
33
66
  nodes.push(
@@ -61,6 +94,3 @@ function babel_plugin_redwood_import_dir_default({ types: t }) {
61
94
  }
62
95
  };
63
96
  }
64
- export {
65
- babel_plugin_redwood_import_dir_default as default
66
- };