@cedarjs/babel-config 5.0.3 → 5.0.4-next.167
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
|
@@ -1,88 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"babel-plugin-redwood-otel-wrapping.d.ts","sourceRoot":"","sources":["../../src/plugins/babel-plugin-redwood-otel-wrapping.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAY,SAAS,EAAc,KAAK,EAAE,MAAM,aAAa,CAAA;AA2VzE,MAAM,CAAC,OAAO,WAAW,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;IAAE,KAAK,EAAE,OAAO,KAAK,CAAA;CAAE,GAAG,SAAS,CAYzE"}
|
|
@@ -1,329 +0,0 @@
|
|
|
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_otel_wrapping_exports = {};
|
|
30
|
-
__export(babel_plugin_redwood_otel_wrapping_exports, {
|
|
31
|
-
default: () => babel_plugin_redwood_otel_wrapping_default
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(babel_plugin_redwood_otel_wrapping_exports);
|
|
34
|
-
var nodejsPath = __toESM(require("path"));
|
|
35
|
-
var import_project_config = require("@cedarjs/project-config");
|
|
36
|
-
function addOpenTelemetryImport(path, t) {
|
|
37
|
-
path.node.body.unshift(
|
|
38
|
-
t.importDeclaration(
|
|
39
|
-
[
|
|
40
|
-
t.importSpecifier(
|
|
41
|
-
t.identifier("RW_OTEL_WRAPPER_TRACE"),
|
|
42
|
-
t.identifier("trace")
|
|
43
|
-
)
|
|
44
|
-
],
|
|
45
|
-
t.stringLiteral("@opentelemetry/api")
|
|
46
|
-
)
|
|
47
|
-
);
|
|
48
|
-
}
|
|
49
|
-
function getRedwoodPaths(state) {
|
|
50
|
-
if (process.env.NODE_ENV === "test") {
|
|
51
|
-
return {
|
|
52
|
-
filename: "__MOCKED_FILENAME__",
|
|
53
|
-
apiFolder: "__MOCKED_API_FOLDER__"
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
const filename = state.file.opts.filename;
|
|
57
|
-
const filenameOffset = filename ? (0, import_project_config.getBaseDirFromFile)(filename).length + 9 : 0;
|
|
58
|
-
const apiFolder = filename ? filename.substring(
|
|
59
|
-
filenameOffset,
|
|
60
|
-
filename.substring(filenameOffset).indexOf(nodejsPath.sep) + filenameOffset
|
|
61
|
-
) : "?";
|
|
62
|
-
return {
|
|
63
|
-
filename,
|
|
64
|
-
apiFolder
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
function wrapExportNamedDeclaration(path, state, t) {
|
|
68
|
-
const declaration = path.node.declaration;
|
|
69
|
-
const declarationIsSupported = declaration?.type === "VariableDeclaration" && declaration.declarations[0].init?.type === "ArrowFunctionExpression";
|
|
70
|
-
if (!declarationIsSupported) {
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
const originalFunction = declaration.declarations[0].init;
|
|
74
|
-
if (!originalFunction) {
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
const originalFunctionName = declaration.declarations[0].id.type === "Identifier" ? declaration.declarations[0].id.name : "?";
|
|
78
|
-
const wrappedFunctionName = `__${originalFunctionName === "?" ? "RW_OTEL_WRAPPER_UNKNOWN_FUNCTION" : originalFunctionName}`;
|
|
79
|
-
const originalFunctionArgumentsWithoutDefaults = [];
|
|
80
|
-
for (const param of originalFunction.params) {
|
|
81
|
-
if (param.type === "Identifier") {
|
|
82
|
-
originalFunctionArgumentsWithoutDefaults.push(param);
|
|
83
|
-
continue;
|
|
84
|
-
}
|
|
85
|
-
if (param.type === "ObjectPattern") {
|
|
86
|
-
const objectProperties = param.properties.filter(
|
|
87
|
-
(p) => p.type === "ObjectProperty"
|
|
88
|
-
);
|
|
89
|
-
originalFunctionArgumentsWithoutDefaults.push(
|
|
90
|
-
t.objectExpression(
|
|
91
|
-
objectProperties.map((p) => {
|
|
92
|
-
if (p.value.type === "AssignmentPattern") {
|
|
93
|
-
return t.objectProperty(p.key, p.value.left);
|
|
94
|
-
}
|
|
95
|
-
return p;
|
|
96
|
-
})
|
|
97
|
-
)
|
|
98
|
-
);
|
|
99
|
-
continue;
|
|
100
|
-
}
|
|
101
|
-
if (param.type === "AssignmentPattern") {
|
|
102
|
-
if (param.left.type === "Identifier") {
|
|
103
|
-
originalFunctionArgumentsWithoutDefaults.push(param.left);
|
|
104
|
-
} else if (param.left.type === "ObjectPattern") {
|
|
105
|
-
const objectProperties = param.left.properties.filter(
|
|
106
|
-
(p) => p.type === "ObjectProperty"
|
|
107
|
-
);
|
|
108
|
-
originalFunctionArgumentsWithoutDefaults.push(
|
|
109
|
-
t.objectExpression(
|
|
110
|
-
objectProperties.map((p) => {
|
|
111
|
-
if (p.value.type === "AssignmentPattern") {
|
|
112
|
-
return t.objectProperty(p.key, p.value.left);
|
|
113
|
-
}
|
|
114
|
-
return p;
|
|
115
|
-
})
|
|
116
|
-
)
|
|
117
|
-
);
|
|
118
|
-
} else {
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
if (param.type === "ArrayPattern" || param.type === "RestElement") {
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
const { filename, apiFolder } = getRedwoodPaths(state);
|
|
127
|
-
const activeSpanBlock = t.callExpression(
|
|
128
|
-
t.memberExpression(
|
|
129
|
-
t.identifier("RW_OTEL_WRAPPER_TRACER"),
|
|
130
|
-
t.identifier("startActiveSpan")
|
|
131
|
-
),
|
|
132
|
-
[
|
|
133
|
-
t.stringLiteral(`redwoodjs:api:${apiFolder}:${originalFunctionName}`),
|
|
134
|
-
t.arrowFunctionExpression(
|
|
135
|
-
[t.identifier("span")],
|
|
136
|
-
t.blockStatement([
|
|
137
|
-
t.expressionStatement(
|
|
138
|
-
t.callExpression(
|
|
139
|
-
t.memberExpression(
|
|
140
|
-
t.identifier("span"),
|
|
141
|
-
t.identifier("setAttribute")
|
|
142
|
-
),
|
|
143
|
-
[
|
|
144
|
-
t.stringLiteral("code.function"),
|
|
145
|
-
t.stringLiteral(originalFunctionName)
|
|
146
|
-
]
|
|
147
|
-
)
|
|
148
|
-
),
|
|
149
|
-
t.expressionStatement(
|
|
150
|
-
t.callExpression(
|
|
151
|
-
t.memberExpression(
|
|
152
|
-
t.identifier("span"),
|
|
153
|
-
t.identifier("setAttribute")
|
|
154
|
-
),
|
|
155
|
-
[
|
|
156
|
-
t.stringLiteral("code.filepath"),
|
|
157
|
-
t.stringLiteral(filename || "?")
|
|
158
|
-
]
|
|
159
|
-
)
|
|
160
|
-
),
|
|
161
|
-
t.tryStatement(
|
|
162
|
-
t.blockStatement([
|
|
163
|
-
t.variableDeclaration("const", [
|
|
164
|
-
t.variableDeclarator(
|
|
165
|
-
t.identifier("RW_OTEL_WRAPPER_INNER_RESULT"),
|
|
166
|
-
originalFunction.async ? t.awaitExpression(
|
|
167
|
-
t.callExpression(
|
|
168
|
-
t.identifier(wrappedFunctionName),
|
|
169
|
-
originalFunctionArgumentsWithoutDefaults
|
|
170
|
-
)
|
|
171
|
-
) : t.callExpression(
|
|
172
|
-
t.identifier(wrappedFunctionName),
|
|
173
|
-
originalFunctionArgumentsWithoutDefaults
|
|
174
|
-
)
|
|
175
|
-
)
|
|
176
|
-
]),
|
|
177
|
-
t.expressionStatement(
|
|
178
|
-
t.callExpression(
|
|
179
|
-
t.memberExpression(t.identifier("span"), t.identifier("end")),
|
|
180
|
-
[]
|
|
181
|
-
)
|
|
182
|
-
),
|
|
183
|
-
t.returnStatement(t.identifier("RW_OTEL_WRAPPER_INNER_RESULT"))
|
|
184
|
-
]),
|
|
185
|
-
t.catchClause(
|
|
186
|
-
t.identifier("error"),
|
|
187
|
-
t.blockStatement([
|
|
188
|
-
t.expressionStatement(
|
|
189
|
-
t.callExpression(
|
|
190
|
-
t.memberExpression(
|
|
191
|
-
t.identifier("span"),
|
|
192
|
-
t.identifier("recordException")
|
|
193
|
-
),
|
|
194
|
-
[t.identifier("error")]
|
|
195
|
-
)
|
|
196
|
-
),
|
|
197
|
-
t.expressionStatement(
|
|
198
|
-
t.callExpression(
|
|
199
|
-
t.memberExpression(
|
|
200
|
-
t.identifier("span"),
|
|
201
|
-
t.identifier("setStatus")
|
|
202
|
-
),
|
|
203
|
-
[
|
|
204
|
-
t.objectExpression([
|
|
205
|
-
t.objectProperty(
|
|
206
|
-
t.identifier("code"),
|
|
207
|
-
t.numericLiteral(2)
|
|
208
|
-
),
|
|
209
|
-
t.objectProperty(
|
|
210
|
-
t.identifier("message"),
|
|
211
|
-
t.logicalExpression(
|
|
212
|
-
"??",
|
|
213
|
-
t.optionalMemberExpression(
|
|
214
|
-
t.optionalCallExpression(
|
|
215
|
-
t.optionalMemberExpression(
|
|
216
|
-
t.optionalMemberExpression(
|
|
217
|
-
t.identifier("error"),
|
|
218
|
-
t.identifier("message"),
|
|
219
|
-
false,
|
|
220
|
-
true
|
|
221
|
-
),
|
|
222
|
-
t.identifier("split"),
|
|
223
|
-
false,
|
|
224
|
-
true
|
|
225
|
-
),
|
|
226
|
-
[t.stringLiteral("\n")],
|
|
227
|
-
false
|
|
228
|
-
),
|
|
229
|
-
t.numericLiteral(0),
|
|
230
|
-
true,
|
|
231
|
-
false
|
|
232
|
-
),
|
|
233
|
-
t.optionalMemberExpression(
|
|
234
|
-
t.optionalCallExpression(
|
|
235
|
-
t.optionalMemberExpression(
|
|
236
|
-
t.optionalCallExpression(
|
|
237
|
-
t.optionalMemberExpression(
|
|
238
|
-
t.identifier("error"),
|
|
239
|
-
t.identifier("toString"),
|
|
240
|
-
false,
|
|
241
|
-
true
|
|
242
|
-
),
|
|
243
|
-
[],
|
|
244
|
-
false
|
|
245
|
-
),
|
|
246
|
-
t.identifier("split"),
|
|
247
|
-
false,
|
|
248
|
-
true
|
|
249
|
-
),
|
|
250
|
-
[t.stringLiteral("\n")],
|
|
251
|
-
false
|
|
252
|
-
),
|
|
253
|
-
t.numericLiteral(0),
|
|
254
|
-
true,
|
|
255
|
-
false
|
|
256
|
-
)
|
|
257
|
-
)
|
|
258
|
-
)
|
|
259
|
-
])
|
|
260
|
-
]
|
|
261
|
-
)
|
|
262
|
-
),
|
|
263
|
-
t.expressionStatement(
|
|
264
|
-
t.callExpression(
|
|
265
|
-
t.memberExpression(
|
|
266
|
-
t.identifier("span"),
|
|
267
|
-
t.identifier("end")
|
|
268
|
-
),
|
|
269
|
-
[]
|
|
270
|
-
)
|
|
271
|
-
),
|
|
272
|
-
t.throwStatement(t.identifier("error"))
|
|
273
|
-
])
|
|
274
|
-
)
|
|
275
|
-
)
|
|
276
|
-
]),
|
|
277
|
-
originalFunction.async
|
|
278
|
-
)
|
|
279
|
-
]
|
|
280
|
-
);
|
|
281
|
-
const wrapper = t.arrowFunctionExpression(
|
|
282
|
-
originalFunction.params,
|
|
283
|
-
t.blockStatement(
|
|
284
|
-
[
|
|
285
|
-
t.variableDeclaration("const", [
|
|
286
|
-
t.variableDeclarator(
|
|
287
|
-
t.identifier(wrappedFunctionName),
|
|
288
|
-
originalFunction
|
|
289
|
-
)
|
|
290
|
-
]),
|
|
291
|
-
t.variableDeclaration("const", [
|
|
292
|
-
t.variableDeclarator(
|
|
293
|
-
t.identifier("RW_OTEL_WRAPPER_TRACER"),
|
|
294
|
-
t.callExpression(
|
|
295
|
-
t.memberExpression(
|
|
296
|
-
t.identifier("RW_OTEL_WRAPPER_TRACE"),
|
|
297
|
-
t.identifier("getTracer")
|
|
298
|
-
),
|
|
299
|
-
[t.stringLiteral("redwoodjs")]
|
|
300
|
-
)
|
|
301
|
-
)
|
|
302
|
-
]),
|
|
303
|
-
t.variableDeclaration("const", [
|
|
304
|
-
t.variableDeclarator(
|
|
305
|
-
t.identifier("RW_OTEL_WRAPPER_RESULT"),
|
|
306
|
-
originalFunction.async ? t.awaitExpression(activeSpanBlock) : activeSpanBlock
|
|
307
|
-
)
|
|
308
|
-
]),
|
|
309
|
-
t.returnStatement(t.identifier("RW_OTEL_WRAPPER_RESULT"))
|
|
310
|
-
],
|
|
311
|
-
originalFunction.body.type === "BlockStatement" ? originalFunction.body.directives : void 0
|
|
312
|
-
),
|
|
313
|
-
originalFunction.async
|
|
314
|
-
);
|
|
315
|
-
declaration.declarations[0].init = wrapper;
|
|
316
|
-
}
|
|
317
|
-
function babel_plugin_redwood_otel_wrapping_default({ types: t }) {
|
|
318
|
-
return {
|
|
319
|
-
name: "babel-plugin-redwood-otel-wrapping",
|
|
320
|
-
visitor: {
|
|
321
|
-
Program(path) {
|
|
322
|
-
addOpenTelemetryImport(path, t);
|
|
323
|
-
},
|
|
324
|
-
ExportNamedDeclaration(path, state) {
|
|
325
|
-
wrapExportNamedDeclaration(path, state, t);
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
};
|
|
329
|
-
}
|
|
@@ -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;
|