@sentry/bundler-plugins 11.12.0 → 11.14.0
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/build/cjs/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/assertClassBrand.js +6 -0
- package/build/cjs/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/checkPrivateRedeclaration.js +5 -0
- package/build/cjs/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/classPrivateFieldGet2.js +6 -0
- package/build/cjs/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/classPrivateFieldInitSpec.js +6 -0
- package/build/cjs/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/classPrivateFieldSet2.js +6 -0
- package/build/cjs/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/classPrivateMethodInitSpec.js +6 -0
- package/build/cjs/_virtual/_rolldown/runtime.js +22 -0
- package/build/cjs/babel-plugin/component-annotation.js +14 -32
- package/build/cjs/babel-plugin/component-annotation.js.map +1 -1
- package/build/cjs/babel-plugin/constants.js +140 -122
- package/build/cjs/babel-plugin/constants.js.map +1 -1
- package/build/cjs/babel-plugin/experimental.js +204 -307
- package/build/cjs/babel-plugin/experimental.js.map +1 -1
- package/build/cjs/babel-plugin/index.js +315 -437
- package/build/cjs/babel-plugin/index.js.map +1 -1
- package/build/cjs/bun/index.js +81 -117
- package/build/cjs/bun/index.js.map +1 -1
- package/build/cjs/core/build-plugin-manager.js +626 -702
- package/build/cjs/core/build-plugin-manager.js.map +1 -1
- package/build/cjs/core/cli.js +134 -129
- package/build/cjs/core/cli.js.map +1 -1
- package/build/cjs/core/component-annotate-hooks.js +16 -27
- package/build/cjs/core/component-annotate-hooks.js.map +1 -1
- package/build/cjs/core/component-annotation-oxc-ast.js +10 -21
- package/build/cjs/core/component-annotation-oxc-ast.js.map +1 -1
- package/build/cjs/core/component-annotation-oxc-fragments.js +45 -74
- package/build/cjs/core/component-annotation-oxc-fragments.js.map +1 -1
- package/build/cjs/core/component-annotation-oxc-jsx.js +116 -156
- package/build/cjs/core/component-annotation-oxc-jsx.js.map +1 -1
- package/build/cjs/core/component-annotation-oxc-walk.js +62 -123
- package/build/cjs/core/component-annotation-oxc-walk.js.map +1 -1
- package/build/cjs/core/component-annotation-oxc.js +68 -103
- package/build/cjs/core/component-annotation-oxc.js.map +1 -1
- package/build/cjs/core/debug-id-upload.js +223 -234
- package/build/cjs/core/debug-id-upload.js.map +1 -1
- package/build/cjs/core/get-code-injection-position.js +59 -74
- package/build/cjs/core/get-code-injection-position.js.map +1 -1
- package/build/cjs/core/glob.js +9 -7
- package/build/cjs/core/glob.js.map +1 -1
- package/build/cjs/core/index.js +77 -61
- package/build/cjs/core/index.js.map +1 -1
- package/build/cjs/core/logger.js +17 -26
- package/build/cjs/core/logger.js.map +1 -1
- package/build/cjs/core/options-mapping.js +95 -117
- package/build/cjs/core/options-mapping.js.map +1 -1
- package/build/cjs/core/sentry/telemetry.js +90 -105
- package/build/cjs/core/sentry/telemetry.js.map +1 -1
- package/build/cjs/core/sentry/transports.js +92 -99
- package/build/cjs/core/sentry/transports.js.map +1 -1
- package/build/cjs/core/sourcemap-settings.js +98 -61
- package/build/cjs/core/sourcemap-settings.js.map +1 -1
- package/build/cjs/core/upload-filter.js +41 -46
- package/build/cjs/core/upload-filter.js.map +1 -1
- package/build/cjs/core/utils.js +228 -221
- package/build/cjs/core/utils.js.map +1 -1
- package/build/cjs/core/version.js +4 -5
- package/build/cjs/core/version.js.map +1 -1
- package/build/cjs/esbuild/index.js +183 -213
- package/build/cjs/esbuild/index.js.map +1 -1
- package/build/cjs/loader-utils/index.js +5 -10
- package/build/cjs/rollup/debug-id-injection.js +22 -38
- package/build/cjs/rollup/debug-id-injection.js.map +1 -1
- package/build/cjs/rollup/debug-id-stamping.js +14 -24
- package/build/cjs/rollup/debug-id-stamping.js.map +1 -1
- package/build/cjs/rollup/index.js +192 -246
- package/build/cjs/rollup/index.js.map +1 -1
- package/build/cjs/rollup/source-map-handling.js +151 -175
- package/build/cjs/rollup/source-map-handling.js.map +1 -1
- package/build/cjs/vite/index.js +19 -21
- package/build/cjs/vite/index.js.map +1 -1
- package/build/cjs/vite/source-map-hooks.js +112 -89
- package/build/cjs/vite/source-map-hooks.js.map +1 -1
- package/build/cjs/webpack/component-annotation-transform.js +20 -26
- package/build/cjs/webpack/component-annotation-transform.js.map +1 -1
- package/build/cjs/webpack/index.js +271 -340
- package/build/cjs/webpack/index.js.map +1 -1
- package/build/esm/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/assertClassBrand.js +6 -0
- package/build/esm/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/checkPrivateRedeclaration.js +5 -0
- package/build/esm/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/classPrivateFieldGet2.js +6 -0
- package/build/esm/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/classPrivateFieldInitSpec.js +6 -0
- package/build/esm/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/classPrivateFieldSet2.js +6 -0
- package/build/esm/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/classPrivateMethodInitSpec.js +6 -0
- package/build/esm/_virtual/_rolldown/runtime.js +2 -0
- package/build/esm/babel-plugin/component-annotation.js +13 -29
- package/build/esm/babel-plugin/component-annotation.js.map +1 -1
- package/build/esm/babel-plugin/constants.js +140 -120
- package/build/esm/babel-plugin/constants.js.map +1 -1
- package/build/esm/babel-plugin/experimental.js +204 -305
- package/build/esm/babel-plugin/experimental.js.map +1 -1
- package/build/esm/babel-plugin/index.js +311 -434
- package/build/esm/babel-plugin/index.js.map +1 -1
- package/build/esm/bun/index.js +76 -101
- package/build/esm/bun/index.js.map +1 -1
- package/build/esm/core/build-plugin-manager.js +621 -683
- package/build/esm/core/build-plugin-manager.js.map +1 -1
- package/build/esm/core/cli.js +134 -127
- package/build/esm/core/cli.js.map +1 -1
- package/build/esm/core/component-annotate-hooks.js +16 -25
- package/build/esm/core/component-annotate-hooks.js.map +1 -1
- package/build/esm/core/component-annotation-oxc-ast.js +9 -19
- package/build/esm/core/component-annotation-oxc-ast.js.map +1 -1
- package/build/esm/core/component-annotation-oxc-fragments.js +44 -72
- package/build/esm/core/component-annotation-oxc-fragments.js.map +1 -1
- package/build/esm/core/component-annotation-oxc-jsx.js +115 -154
- package/build/esm/core/component-annotation-oxc-jsx.js.map +1 -1
- package/build/esm/core/component-annotation-oxc-walk.js +61 -121
- package/build/esm/core/component-annotation-oxc-walk.js.map +1 -1
- package/build/esm/core/component-annotation-oxc.js +65 -96
- package/build/esm/core/component-annotation-oxc.js.map +1 -1
- package/build/esm/core/debug-id-upload.js +218 -213
- package/build/esm/core/debug-id-upload.js.map +1 -1
- package/build/esm/core/get-code-injection-position.js +59 -72
- package/build/esm/core/get-code-injection-position.js.map +1 -1
- package/build/esm/core/glob.js +9 -5
- package/build/esm/core/glob.js.map +1 -1
- package/build/esm/core/index.js +62 -47
- package/build/esm/core/index.js.map +1 -1
- package/build/esm/core/logger.js +17 -24
- package/build/esm/core/logger.js.map +1 -1
- package/build/esm/core/options-mapping.js +95 -115
- package/build/esm/core/options-mapping.js.map +1 -1
- package/build/esm/core/sentry/telemetry.js +89 -102
- package/build/esm/core/sentry/telemetry.js.map +1 -1
- package/build/esm/core/sentry/transports.js +90 -83
- package/build/esm/core/sentry/transports.js.map +1 -1
- package/build/esm/core/sourcemap-settings.js +96 -59
- package/build/esm/core/sourcemap-settings.js.map +1 -1
- package/build/esm/core/upload-filter.js +39 -30
- package/build/esm/core/upload-filter.js.map +1 -1
- package/build/esm/core/utils.js +221 -211
- package/build/esm/core/utils.js.map +1 -1
- package/build/esm/core/version.js +4 -3
- package/build/esm/core/version.js.map +1 -1
- package/build/esm/esbuild/index.js +179 -197
- package/build/esm/esbuild/index.js.map +1 -1
- package/build/esm/loader-utils/index.js +4 -3
- package/build/esm/package.json +1 -1
- package/build/esm/rollup/debug-id-injection.js +22 -36
- package/build/esm/rollup/debug-id-injection.js.map +1 -1
- package/build/esm/rollup/debug-id-stamping.js +14 -22
- package/build/esm/rollup/debug-id-stamping.js.map +1 -1
- package/build/esm/rollup/index.js +189 -226
- package/build/esm/rollup/index.js.map +1 -1
- package/build/esm/rollup/source-map-handling.js +149 -159
- package/build/esm/rollup/source-map-handling.js.map +1 -1
- package/build/esm/vite/index.js +19 -18
- package/build/esm/vite/index.js.map +1 -1
- package/build/esm/vite/source-map-hooks.js +109 -72
- package/build/esm/vite/source-map-hooks.js.map +1 -1
- package/build/esm/webpack/component-annotation-transform.js +17 -24
- package/build/esm/webpack/component-annotation-transform.js.map +1 -1
- package/build/esm/webpack/index.js +268 -322
- package/build/esm/webpack/index.js.map +1 -1
- package/build/types/core/build-plugin-manager.d.ts +16 -5
- package/build/types/core/build-plugin-manager.d.ts.map +1 -1
- package/build/types/core/cli.d.ts +6 -1
- package/build/types/core/cli.d.ts.map +1 -1
- package/build/types/core/debug-id-upload.d.ts +7 -4
- package/build/types/core/debug-id-upload.d.ts.map +1 -1
- package/build/types/core/index.d.ts +3 -3
- package/build/types/core/index.d.ts.map +1 -1
- package/build/types/core/options-mapping.d.ts +4 -3
- package/build/types/core/options-mapping.d.ts.map +1 -1
- package/build/types/core/sentry/telemetry.d.ts.map +1 -1
- package/build/types/core/sourcemap-settings.d.ts +10 -1
- package/build/types/core/sourcemap-settings.d.ts.map +1 -1
- package/build/types/core/types.d.ts +25 -1
- package/build/types/core/types.d.ts.map +1 -1
- package/build/types/core/utils.d.ts +4 -0
- package/build/types/core/utils.d.ts.map +1 -1
- package/build/types/core/version.d.ts +1 -1
- package/build/types/esbuild/index.d.ts +2 -2
- package/build/types/esbuild/index.d.ts.map +1 -1
- package/build/types/rollup/index.d.ts +2 -2
- package/build/types/rollup/index.d.ts.map +1 -1
- package/build/types/rollup/source-map-handling.d.ts.map +1 -1
- package/build/types/vite/index.d.ts +3 -3
- package/build/types/vite/index.d.ts.map +1 -1
- package/build/types/vite/source-map-hooks.d.ts.map +1 -1
- package/build/types/webpack/index.d.ts +7 -3
- package/build/types/webpack/index.d.ts.map +1 -1
- package/package.json +8 -15
- package/build/cjs/loader-utils/index.js.map +0 -1
- package/build/esm/loader-utils/index.js.map +0 -1
|
@@ -1,85 +1,72 @@
|
|
|
1
|
+
// src/core/get-code-injection-position.ts
|
|
1
2
|
function isLineTerminator(character) {
|
|
2
|
-
|
|
3
|
+
return character === "\n" || character === "\r" || character === "\u2028" || character === "\u2029";
|
|
3
4
|
}
|
|
4
5
|
function skipTrivia(code, start) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
6
|
+
let position = start;
|
|
7
|
+
let hasLineBreak = false;
|
|
8
|
+
while (position < code.length) {
|
|
9
|
+
const character = code[position];
|
|
10
|
+
if (/\s/.test(character || "")) {
|
|
11
|
+
hasLineBreak || (hasLineBreak = isLineTerminator(character));
|
|
12
|
+
position++;
|
|
13
|
+
} else if (code.startsWith("//", position) || position === 0 && code.startsWith("#!", position)) {
|
|
14
|
+
let lineEnd = position + 2;
|
|
15
|
+
while (lineEnd < code.length && !isLineTerminator(code[lineEnd])) lineEnd++;
|
|
16
|
+
if (lineEnd === code.length) return {
|
|
17
|
+
end: code.length,
|
|
18
|
+
hasLineBreak
|
|
19
|
+
};
|
|
20
|
+
position = lineEnd + 1;
|
|
21
|
+
hasLineBreak = true;
|
|
22
|
+
} else if (code.startsWith("/*", position)) {
|
|
23
|
+
const commentEnd = code.indexOf("*/", position + 2);
|
|
24
|
+
if (commentEnd === -1) return {
|
|
25
|
+
end: code.length,
|
|
26
|
+
hasLineBreak
|
|
27
|
+
};
|
|
28
|
+
const comment = code.slice(position, commentEnd + 2);
|
|
29
|
+
hasLineBreak || (hasLineBreak = /[\n\r\u2028\u2029]/.test(comment));
|
|
30
|
+
position = commentEnd + 2;
|
|
31
|
+
} else break;
|
|
32
|
+
}
|
|
33
|
+
return {
|
|
34
|
+
end: position,
|
|
35
|
+
hasLineBreak
|
|
36
|
+
};
|
|
35
37
|
}
|
|
36
38
|
function findStringLiteralEnd(code, start) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
} else if (character === quote) {
|
|
46
|
-
return position + 1;
|
|
47
|
-
} else if (isLineTerminator(character)) {
|
|
48
|
-
return void 0;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
return void 0;
|
|
39
|
+
const quote = code[start];
|
|
40
|
+
if (quote !== "\"" && quote !== "'") return;
|
|
41
|
+
for (let position = start + 1; position < code.length; position++) {
|
|
42
|
+
const character = code[position];
|
|
43
|
+
if (character === "\\") position += code[position + 1] === "\r" && code[position + 2] === "\n" ? 2 : 1;
|
|
44
|
+
else if (character === quote) return position + 1;
|
|
45
|
+
else if (isLineTerminator(character)) return;
|
|
46
|
+
}
|
|
52
47
|
}
|
|
53
48
|
function startsWithBinaryOperatorKeyword(remainder, keyword) {
|
|
54
|
-
|
|
49
|
+
return remainder.startsWith(keyword) && !/^[$_\\\u200C\u200D\p{ID_Continue}]/u.test(remainder.slice(keyword.length));
|
|
55
50
|
}
|
|
56
51
|
function canContinueStringExpression(code, position) {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
return /^!={1,2}/.test(remainder) || /^[([.`+\-*/%<>=&|^?,:]/.test(remainder) || ["in", "instanceof"].some((keyword) => startsWithBinaryOperatorKeyword(remainder, keyword));
|
|
52
|
+
const remainder = code.slice(position, position + 10 + 1);
|
|
53
|
+
if (/^(?:\+\+|--|!(?!=))/.test(remainder)) return false;
|
|
54
|
+
return /^!={1,2}/.test(remainder) || /^[([.`+\-*/%<>=&|^?,:]/.test(remainder) || ["in", "instanceof"].some((keyword) => startsWithBinaryOperatorKeyword(remainder, keyword));
|
|
62
55
|
}
|
|
63
56
|
function getCodeInjectionPosition(code) {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
} else {
|
|
77
|
-
break;
|
|
78
|
-
}
|
|
79
|
-
prologueEnd = position;
|
|
80
|
-
}
|
|
81
|
-
return prologueEnd;
|
|
57
|
+
let position = skipTrivia(code, 0).end;
|
|
58
|
+
let prologueEnd = position;
|
|
59
|
+
while (position < code.length) {
|
|
60
|
+
const stringEnd = findStringLiteralEnd(code, position);
|
|
61
|
+
if (stringEnd === void 0) break;
|
|
62
|
+
const trailingTrivia = skipTrivia(code, stringEnd);
|
|
63
|
+
if (code[trailingTrivia.end] === ";") position = skipTrivia(code, trailingTrivia.end + 1).end;
|
|
64
|
+
else if (trailingTrivia.end === code.length || trailingTrivia.hasLineBreak && !canContinueStringExpression(code, trailingTrivia.end)) position = trailingTrivia.end;
|
|
65
|
+
else break;
|
|
66
|
+
prologueEnd = position;
|
|
67
|
+
}
|
|
68
|
+
return prologueEnd;
|
|
82
69
|
}
|
|
83
|
-
|
|
84
70
|
export { getCodeInjectionPosition };
|
|
85
|
-
|
|
71
|
+
|
|
72
|
+
//# sourceMappingURL=get-code-injection-position.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-code-injection-position.js","sources":["../../../src/core/get-code-injection-position.ts"],"sourcesContent":["function isLineTerminator(character: string | undefined): boolean {\n return character === '\\n' || character === '\\r' || character === '\\u2028' || character === '\\u2029';\n}\n\nfunction skipTrivia(code: string, start: number): { end: number; hasLineBreak: boolean } {\n let position = start;\n let hasLineBreak = false;\n\n while (position < code.length) {\n const character = code[position];\n\n if (/\\s/.test(character || '')) {\n hasLineBreak ||= isLineTerminator(character);\n position++;\n } else if (code.startsWith('//', position) || (position === 0 && code.startsWith('#!', position))) {\n let lineEnd = position + 2;\n while (lineEnd < code.length && !isLineTerminator(code[lineEnd])) {\n lineEnd++;\n }\n if (lineEnd === code.length) {\n return { end: code.length, hasLineBreak };\n }\n position = lineEnd + 1;\n hasLineBreak = true;\n } else if (code.startsWith('/*', position)) {\n const commentEnd = code.indexOf('*/', position + 2);\n if (commentEnd === -1) {\n return { end: code.length, hasLineBreak };\n }\n const comment = code.slice(position, commentEnd + 2);\n hasLineBreak ||= /[\\n\\r\\u2028\\u2029]/.test(comment);\n position = commentEnd + 2;\n } else {\n break;\n }\n }\n\n return { end: position, hasLineBreak };\n}\n\nfunction findStringLiteralEnd(code: string, start: number): number | undefined {\n const quote = code[start];\n if (quote !== '\"' && quote !== \"'\") {\n return undefined;\n }\n\n for (let position = start + 1; position < code.length; position++) {\n const character = code[position];\n if (character === '\\\\') {\n position += code[position + 1] === '\\r' && code[position + 2] === '\\n' ? 2 : 1;\n } else if (character === quote) {\n return position + 1;\n } else if (isLineTerminator(character)) {\n return undefined;\n }\n }\n\n return undefined;\n}\n\nfunction startsWithBinaryOperatorKeyword(remainder: string, keyword: string): boolean {\n return remainder.startsWith(keyword) && !/^[$_\\\\\\u200C\\u200D\\p{ID_Continue}]/u.test(remainder.slice(keyword.length));\n}\n\nfunction canContinueStringExpression(code: string, position: number): boolean {\n const remainder = code.slice(position, position + 'instanceof'.length + 1);\n if (/^(?:\\+\\+|--|!(?!=))/.test(remainder)) {\n return false;\n }\n\n return (\n /^!={1,2}/.test(remainder) ||\n /^[([.`+\\-*/%<>=&|^?,:]/.test(remainder) ||\n ['in', 'instanceof'].some(keyword => startsWithBinaryOperatorKeyword(remainder, keyword))\n );\n}\n\nexport function getCodeInjectionPosition(code: string): number {\n let position = skipTrivia(code, 0).end;\n let prologueEnd = position;\n\n while (position < code.length) {\n const stringEnd = findStringLiteralEnd(code, position);\n if (stringEnd === undefined) {\n break;\n }\n\n const trailingTrivia = skipTrivia(code, stringEnd);\n if (code[trailingTrivia.end] === ';') {\n position = skipTrivia(code, trailingTrivia.end + 1).end;\n } else if (\n trailingTrivia.end === code.length ||\n (trailingTrivia.hasLineBreak && !canContinueStringExpression(code, trailingTrivia.end))\n ) {\n position = trailingTrivia.end;\n } else {\n break;\n }\n\n prologueEnd = position;\n }\n\n return prologueEnd;\n}\n"],"
|
|
1
|
+
{"version":3,"file":"get-code-injection-position.js","names":[],"sources":["../../../src/core/get-code-injection-position.ts"],"sourcesContent":["function isLineTerminator(character: string | undefined): boolean {\n return character === '\\n' || character === '\\r' || character === '\\u2028' || character === '\\u2029';\n}\n\nfunction skipTrivia(code: string, start: number): { end: number; hasLineBreak: boolean } {\n let position = start;\n let hasLineBreak = false;\n\n while (position < code.length) {\n const character = code[position];\n\n if (/\\s/.test(character || '')) {\n hasLineBreak ||= isLineTerminator(character);\n position++;\n } else if (code.startsWith('//', position) || (position === 0 && code.startsWith('#!', position))) {\n let lineEnd = position + 2;\n while (lineEnd < code.length && !isLineTerminator(code[lineEnd])) {\n lineEnd++;\n }\n if (lineEnd === code.length) {\n return { end: code.length, hasLineBreak };\n }\n position = lineEnd + 1;\n hasLineBreak = true;\n } else if (code.startsWith('/*', position)) {\n const commentEnd = code.indexOf('*/', position + 2);\n if (commentEnd === -1) {\n return { end: code.length, hasLineBreak };\n }\n const comment = code.slice(position, commentEnd + 2);\n hasLineBreak ||= /[\\n\\r\\u2028\\u2029]/.test(comment);\n position = commentEnd + 2;\n } else {\n break;\n }\n }\n\n return { end: position, hasLineBreak };\n}\n\nfunction findStringLiteralEnd(code: string, start: number): number | undefined {\n const quote = code[start];\n if (quote !== '\"' && quote !== \"'\") {\n return undefined;\n }\n\n for (let position = start + 1; position < code.length; position++) {\n const character = code[position];\n if (character === '\\\\') {\n position += code[position + 1] === '\\r' && code[position + 2] === '\\n' ? 2 : 1;\n } else if (character === quote) {\n return position + 1;\n } else if (isLineTerminator(character)) {\n return undefined;\n }\n }\n\n return undefined;\n}\n\nfunction startsWithBinaryOperatorKeyword(remainder: string, keyword: string): boolean {\n return remainder.startsWith(keyword) && !/^[$_\\\\\\u200C\\u200D\\p{ID_Continue}]/u.test(remainder.slice(keyword.length));\n}\n\nfunction canContinueStringExpression(code: string, position: number): boolean {\n const remainder = code.slice(position, position + 'instanceof'.length + 1);\n if (/^(?:\\+\\+|--|!(?!=))/.test(remainder)) {\n return false;\n }\n\n return (\n /^!={1,2}/.test(remainder) ||\n /^[([.`+\\-*/%<>=&|^?,:]/.test(remainder) ||\n ['in', 'instanceof'].some(keyword => startsWithBinaryOperatorKeyword(remainder, keyword))\n );\n}\n\nexport function getCodeInjectionPosition(code: string): number {\n let position = skipTrivia(code, 0).end;\n let prologueEnd = position;\n\n while (position < code.length) {\n const stringEnd = findStringLiteralEnd(code, position);\n if (stringEnd === undefined) {\n break;\n }\n\n const trailingTrivia = skipTrivia(code, stringEnd);\n if (code[trailingTrivia.end] === ';') {\n position = skipTrivia(code, trailingTrivia.end + 1).end;\n } else if (\n trailingTrivia.end === code.length ||\n (trailingTrivia.hasLineBreak && !canContinueStringExpression(code, trailingTrivia.end))\n ) {\n position = trailingTrivia.end;\n } else {\n break;\n }\n\n prologueEnd = position;\n }\n\n return prologueEnd;\n}\n"],"mappings":";AAAA,SAAS,iBAAiB,WAAwC;CAChE,OAAO,cAAc,QAAQ,cAAc,QAAQ,cAAc,YAAY,cAAc;AAC7F;AAEA,SAAS,WAAW,MAAc,OAAuD;CACvF,IAAI,WAAW;CACf,IAAI,eAAe;CAEnB,OAAO,WAAW,KAAK,QAAQ;EAC7B,MAAM,YAAY,KAAK;EAEvB,IAAI,KAAK,KAAK,aAAa,EAAE,GAAG;GAC9B,iBAAA,eAAiB,iBAAiB,SAAS;GAC3C;EACF,OAAO,IAAI,KAAK,WAAW,MAAM,QAAQ,KAAM,aAAa,KAAK,KAAK,WAAW,MAAM,QAAQ,GAAI;GACjG,IAAI,UAAU,WAAW;GACzB,OAAO,UAAU,KAAK,UAAU,CAAC,iBAAiB,KAAK,QAAQ,GAC7D;GAEF,IAAI,YAAY,KAAK,QACnB,OAAO;IAAE,KAAK,KAAK;IAAQ;GAAa;GAE1C,WAAW,UAAU;GACrB,eAAe;EACjB,OAAO,IAAI,KAAK,WAAW,MAAM,QAAQ,GAAG;GAC1C,MAAM,aAAa,KAAK,QAAQ,MAAM,WAAW,CAAC;GAClD,IAAI,eAAe,IACjB,OAAO;IAAE,KAAK,KAAK;IAAQ;GAAa;GAE1C,MAAM,UAAU,KAAK,MAAM,UAAU,aAAa,CAAC;GACnD,iBAAA,eAAiB,qBAAqB,KAAK,OAAO;GAClD,WAAW,aAAa;EAC1B,OACE;CAEJ;CAEA,OAAO;EAAE,KAAK;EAAU;CAAa;AACvC;AAEA,SAAS,qBAAqB,MAAc,OAAmC;CAC7E,MAAM,QAAQ,KAAK;CACnB,IAAI,UAAU,QAAO,UAAU,KAC7B;CAGF,KAAK,IAAI,WAAW,QAAQ,GAAG,WAAW,KAAK,QAAQ,YAAY;EACjE,MAAM,YAAY,KAAK;EACvB,IAAI,cAAc,MAChB,YAAY,KAAK,WAAW,OAAO,QAAQ,KAAK,WAAW,OAAO,OAAO,IAAI;OACxE,IAAI,cAAc,OACvB,OAAO,WAAW;OACb,IAAI,iBAAiB,SAAS,GACnC;CAEJ;AAGF;AAEA,SAAS,gCAAgC,WAAmB,SAA0B;CACpF,OAAO,UAAU,WAAW,OAAO,KAAK,CAAC,sCAAsC,KAAK,UAAU,MAAM,QAAQ,MAAM,CAAC;AACrH;AAEA,SAAS,4BAA4B,MAAc,UAA2B;CAC5E,MAAM,YAAY,KAAK,MAAM,UAAU,WAAW,KAAsB,CAAC;CACzE,IAAI,sBAAsB,KAAK,SAAS,GACtC,OAAO;CAGT,OACE,WAAW,KAAK,SAAS,KACzB,yBAAyB,KAAK,SAAS,KACvC,CAAC,MAAM,YAAY,CAAC,CAAC,MAAK,YAAW,gCAAgC,WAAW,OAAO,CAAC;AAE5F;AAEA,SAAgB,yBAAyB,MAAsB;CAC7D,IAAI,WAAW,WAAW,MAAM,CAAC,CAAC,CAAC;CACnC,IAAI,cAAc;CAElB,OAAO,WAAW,KAAK,QAAQ;EAC7B,MAAM,YAAY,qBAAqB,MAAM,QAAQ;EACrD,IAAI,cAAc,KAAA,GAChB;EAGF,MAAM,iBAAiB,WAAW,MAAM,SAAS;EACjD,IAAI,KAAK,eAAe,SAAS,KAC/B,WAAW,WAAW,MAAM,eAAe,MAAM,CAAC,CAAC,CAAC;OAC/C,IACL,eAAe,QAAQ,KAAK,UAC3B,eAAe,gBAAgB,CAAC,4BAA4B,MAAM,eAAe,GAAG,GAErF,WAAW,eAAe;OAE1B;EAGF,cAAc;CAChB;CAEA,OAAO;AACT"}
|
package/build/esm/core/glob.js
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import { glob } from
|
|
2
|
-
|
|
1
|
+
import { glob } from "glob";
|
|
2
|
+
// src/core/glob.ts
|
|
3
3
|
function globFiles(patterns, options) {
|
|
4
|
-
|
|
4
|
+
return glob(patterns, {
|
|
5
|
+
absolute: true,
|
|
6
|
+
nodir: true,
|
|
7
|
+
...options
|
|
8
|
+
});
|
|
5
9
|
}
|
|
6
|
-
|
|
7
10
|
export { globFiles };
|
|
8
|
-
|
|
11
|
+
|
|
12
|
+
//# sourceMappingURL=glob.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glob.js","sources":["../../../src/core/glob.ts"],"sourcesContent":["import { glob } from 'glob';\n\nexport function globFiles(\n patterns: string | string[],\n options?: { root?: string; ignore?: string | string[] },\n): Promise<string[]> {\n return glob(patterns, { absolute: true, nodir: true, ...options });\n}\n"],"
|
|
1
|
+
{"version":3,"file":"glob.js","names":[],"sources":["../../../src/core/glob.ts"],"sourcesContent":["import { glob } from 'glob';\n\nexport function globFiles(\n patterns: string | string[],\n options?: { root?: string; ignore?: string | string[] },\n): Promise<string[]> {\n return glob(patterns, { absolute: true, nodir: true, ...options });\n}\n"],"mappings":";;AAEA,SAAgB,UACd,UACA,SACmB;CACnB,OAAO,KAAK,UAAU;EAAE,UAAU;EAAM,OAAO;EAAM,GAAG;CAAQ,CAAC;AACnE"}
|
package/build/esm/core/index.js
CHANGED
|
@@ -1,59 +1,74 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import "../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { CodeInjection, containsOnlyImports, generateModuleMetadataInjectorCode, generateReleaseInjectorCode, replaceBooleanFlagsInCode, stringToUUID, stripQueryAndHashFromPath } from "./utils.js";
|
|
3
|
+
import { globFiles } from "./glob.js";
|
|
4
|
+
import { getCodeInjectionPosition } from "./get-code-injection-position.js";
|
|
5
|
+
import { createComponentNameAnnotateHooks } from "./component-annotate-hooks.js";
|
|
6
|
+
import { createSentryBuildPluginManager } from "./build-plugin-manager.js";
|
|
7
|
+
import { addDebugIdToEmittedArtifacts, createDebugIdUploadFunction, stampDebugId } from "./debug-id-upload.js";
|
|
8
|
+
import { decideSourceMapHandling, getDeleteSourcemapsAfterUpload, getSdkEnabledSourceMaps } from "./sourcemap-settings.js";
|
|
9
|
+
// src/core/index.ts
|
|
10
|
+
/**
|
|
11
|
+
* Checks if a file is a JavaScript file based on its extension.
|
|
12
|
+
* Handles query strings and hashes in the filename.
|
|
13
|
+
*/
|
|
10
14
|
function isJsFile(fileName) {
|
|
11
|
-
|
|
12
|
-
|
|
15
|
+
const cleanFileName = stripQueryAndHashFromPath(fileName);
|
|
16
|
+
return [
|
|
17
|
+
".js",
|
|
18
|
+
".mjs",
|
|
19
|
+
".cjs"
|
|
20
|
+
].some((ext) => cleanFileName.endsWith(ext));
|
|
13
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* Checks if a chunk should be skipped for code injection
|
|
24
|
+
*
|
|
25
|
+
* This is necessary to handle Vite's MPA (multi-page application) mode where
|
|
26
|
+
* HTML entry points create "facade" chunks that should not contain injected code.
|
|
27
|
+
* See: https://github.com/getsentry/sentry-javascript-bundler-plugins/issues/829
|
|
28
|
+
*
|
|
29
|
+
* However, in SPA mode, the main bundle also has an HTML facade but contains
|
|
30
|
+
* substantial application code. We should NOT skip injection for these bundles.
|
|
31
|
+
*
|
|
32
|
+
* @param code - The chunk's code content
|
|
33
|
+
* @param facadeModuleId - The facade module ID (if any) - HTML files create facade chunks
|
|
34
|
+
* @returns true if the chunk should be skipped
|
|
35
|
+
*/
|
|
14
36
|
function shouldSkipCodeInjection(code, facadeModuleId) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
if (facadeModuleId && stripQueryAndHashFromPath(facadeModuleId).endsWith(".html")) {
|
|
19
|
-
return containsOnlyImports(code);
|
|
20
|
-
}
|
|
21
|
-
return false;
|
|
37
|
+
if (code.trim().length === 0) return true;
|
|
38
|
+
if (facadeModuleId && stripQueryAndHashFromPath(facadeModuleId).endsWith(".html")) return containsOnlyImports(code);
|
|
39
|
+
return false;
|
|
22
40
|
}
|
|
23
41
|
const initialChunksCache = /* @__PURE__ */ new WeakMap();
|
|
24
42
|
function getInitialChunks(chunks) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
queue.push(importedChunk);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
initialChunksCache.set(chunks, initial);
|
|
44
|
-
return initial;
|
|
43
|
+
const cached = initialChunksCache.get(chunks);
|
|
44
|
+
if (cached) return cached;
|
|
45
|
+
const initial = /* @__PURE__ */ new Set();
|
|
46
|
+
const queue = Object.values(chunks).filter((chunk) => chunk.isEntry);
|
|
47
|
+
for (let chunk = queue.shift(); chunk; chunk = queue.shift()) {
|
|
48
|
+
if (initial.has(chunk.fileName)) continue;
|
|
49
|
+
initial.add(chunk.fileName);
|
|
50
|
+
for (const imported of chunk.imports ?? []) {
|
|
51
|
+
const importedChunk = chunks[imported];
|
|
52
|
+
if (importedChunk) queue.push(importedChunk);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
initialChunksCache.set(chunks, initial);
|
|
56
|
+
return initial;
|
|
45
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* Whether a chunk loads at startup: it is an entry chunk, or an entry chunk
|
|
60
|
+
* reaches it through static imports. Chunks that only dynamic imports reach
|
|
61
|
+
* load later, after startup code already ran.
|
|
62
|
+
*
|
|
63
|
+
* Without the chunk graph every chunk counts as initial.
|
|
64
|
+
*/
|
|
46
65
|
function isInitialChunk(chunk, chunks) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
return getInitialChunks(chunks).has(chunk.fileName);
|
|
66
|
+
if (chunk.isEntry || !chunks) return true;
|
|
67
|
+
return getInitialChunks(chunks).has(chunk.fileName);
|
|
51
68
|
}
|
|
52
69
|
function getDebugIdSnippet(debugId) {
|
|
53
|
-
|
|
54
|
-
`var n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="${debugId}",e._sentryDebugIdIdentifier="sentry-dbid-${debugId}");`
|
|
55
|
-
);
|
|
70
|
+
return new CodeInjection(`var n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="${debugId}",e._sentryDebugIdIdentifier="sentry-dbid-${debugId}");`);
|
|
56
71
|
}
|
|
72
|
+
export { CodeInjection, addDebugIdToEmittedArtifacts, createComponentNameAnnotateHooks, createDebugIdUploadFunction, createSentryBuildPluginManager, decideSourceMapHandling, generateModuleMetadataInjectorCode, generateReleaseInjectorCode, getCodeInjectionPosition, getDebugIdSnippet, getDeleteSourcemapsAfterUpload, getSdkEnabledSourceMaps, globFiles, isInitialChunk, isJsFile, replaceBooleanFlagsInCode, shouldSkipCodeInjection, stampDebugId, stringToUUID };
|
|
57
73
|
|
|
58
|
-
|
|
59
|
-
//# sourceMappingURL=index.js.map
|
|
74
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/core/index.ts"],"sourcesContent":["import { CodeInjection, containsOnlyImports, stripQueryAndHashFromPath } from './utils';\n\n/**\n * Checks if a file is a JavaScript file based on its extension.\n * Handles query strings and hashes in the filename.\n */\nexport function isJsFile(fileName: string): boolean {\n const cleanFileName = stripQueryAndHashFromPath(fileName);\n return ['.js', '.mjs', '.cjs'].some(ext => cleanFileName.endsWith(ext));\n}\n\n/**\n * Checks if a chunk should be skipped for code injection\n *\n * This is necessary to handle Vite's MPA (multi-page application) mode where\n * HTML entry points create \"facade\" chunks that should not contain injected code.\n * See: https://github.com/getsentry/sentry-javascript-bundler-plugins/issues/829\n *\n * However, in SPA mode, the main bundle also has an HTML facade but contains\n * substantial application code. We should NOT skip injection for these bundles.\n *\n * @param code - The chunk's code content\n * @param facadeModuleId - The facade module ID (if any) - HTML files create facade chunks\n * @returns true if the chunk should be skipped\n */\nexport function shouldSkipCodeInjection(code: string, facadeModuleId: string | null | undefined): boolean {\n // Skip empty chunks - these are placeholder chunks that should be optimized away\n if (code.trim().length === 0) {\n return true;\n }\n\n // For HTML facade chunks, only skip if they contain only import statements\n if (facadeModuleId && stripQueryAndHashFromPath(facadeModuleId).endsWith('.html')) {\n return containsOnlyImports(code);\n }\n\n return false;\n}\n\nexport interface ChunkGraphNode {\n fileName: string;\n isEntry?: boolean;\n imports?: string[];\n}\n\nconst initialChunksCache = new WeakMap<Record<string, ChunkGraphNode>, Set<string>>();\n\nfunction getInitialChunks(chunks: Record<string, ChunkGraphNode>): Set<string> {\n const cached = initialChunksCache.get(chunks);\n if (cached) {\n return cached;\n }\n\n const initial = new Set<string>();\n const queue = Object.values(chunks).filter(chunk => chunk.isEntry);\n\n for (let chunk = queue.shift(); chunk; chunk = queue.shift()) {\n if (initial.has(chunk.fileName)) {\n continue;\n }\n initial.add(chunk.fileName);\n for (const imported of chunk.imports ?? []) {\n const importedChunk = chunks[imported];\n if (importedChunk) {\n queue.push(importedChunk);\n }\n }\n }\n\n initialChunksCache.set(chunks, initial);\n return initial;\n}\n\n/**\n * Whether a chunk loads at startup: it is an entry chunk, or an entry chunk\n * reaches it through static imports. Chunks that only dynamic imports reach\n * load later, after startup code already ran.\n *\n * Without the chunk graph every chunk counts as initial.\n */\nexport function isInitialChunk(\n chunk: Pick<ChunkGraphNode, 'fileName' | 'isEntry'>,\n chunks: Record<string, ChunkGraphNode> | undefined,\n): boolean {\n if (chunk.isEntry || !chunks) {\n return true;\n }\n\n return getInitialChunks(chunks).has(chunk.fileName);\n}\n\nexport { globFiles } from './glob';\nexport { getCodeInjectionPosition } from './get-code-injection-position';\n\nexport { createComponentNameAnnotateHooks } from './component-annotate-hooks';\n\nexport function getDebugIdSnippet(debugId: string): CodeInjection {\n return new CodeInjection(\n `var n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]=\"${debugId}\",e._sentryDebugIdIdentifier=\"sentry-dbid-${debugId}\");`,\n );\n}\n\nexport type { Logger } from './logger';\nexport type { Options, SentrySDKBuildFlags } from './types';\nexport {\n CodeInjection,\n replaceBooleanFlagsInCode,\n stringToUUID,\n generateReleaseInjectorCode,\n generateModuleMetadataInjectorCode,\n} from './utils';\nexport { createSentryBuildPluginManager } from './build-plugin-manager';\nexport type { SentryBuildPluginManager, UploadStaging } from './build-plugin-manager';\nexport { createDebugIdUploadFunction, addDebugIdToEmittedArtifacts, stampDebugId } from './debug-id-upload';\nexport { decideSourceMapHandling } from './sourcemap-settings';\nexport type { SourceMapDecision, SourceMapKind } from './sourcemap-settings';\nexport type { UploadFilter } from './upload-filter';\n"],"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/core/index.ts"],"sourcesContent":["import { CodeInjection, containsOnlyImports, stripQueryAndHashFromPath } from './utils';\n\n/**\n * Checks if a file is a JavaScript file based on its extension.\n * Handles query strings and hashes in the filename.\n */\nexport function isJsFile(fileName: string): boolean {\n const cleanFileName = stripQueryAndHashFromPath(fileName);\n return ['.js', '.mjs', '.cjs'].some(ext => cleanFileName.endsWith(ext));\n}\n\n/**\n * Checks if a chunk should be skipped for code injection\n *\n * This is necessary to handle Vite's MPA (multi-page application) mode where\n * HTML entry points create \"facade\" chunks that should not contain injected code.\n * See: https://github.com/getsentry/sentry-javascript-bundler-plugins/issues/829\n *\n * However, in SPA mode, the main bundle also has an HTML facade but contains\n * substantial application code. We should NOT skip injection for these bundles.\n *\n * @param code - The chunk's code content\n * @param facadeModuleId - The facade module ID (if any) - HTML files create facade chunks\n * @returns true if the chunk should be skipped\n */\nexport function shouldSkipCodeInjection(code: string, facadeModuleId: string | null | undefined): boolean {\n // Skip empty chunks - these are placeholder chunks that should be optimized away\n if (code.trim().length === 0) {\n return true;\n }\n\n // For HTML facade chunks, only skip if they contain only import statements\n if (facadeModuleId && stripQueryAndHashFromPath(facadeModuleId).endsWith('.html')) {\n return containsOnlyImports(code);\n }\n\n return false;\n}\n\nexport interface ChunkGraphNode {\n fileName: string;\n isEntry?: boolean;\n imports?: string[];\n}\n\nconst initialChunksCache = new WeakMap<Record<string, ChunkGraphNode>, Set<string>>();\n\nfunction getInitialChunks(chunks: Record<string, ChunkGraphNode>): Set<string> {\n const cached = initialChunksCache.get(chunks);\n if (cached) {\n return cached;\n }\n\n const initial = new Set<string>();\n const queue = Object.values(chunks).filter(chunk => chunk.isEntry);\n\n for (let chunk = queue.shift(); chunk; chunk = queue.shift()) {\n if (initial.has(chunk.fileName)) {\n continue;\n }\n initial.add(chunk.fileName);\n for (const imported of chunk.imports ?? []) {\n const importedChunk = chunks[imported];\n if (importedChunk) {\n queue.push(importedChunk);\n }\n }\n }\n\n initialChunksCache.set(chunks, initial);\n return initial;\n}\n\n/**\n * Whether a chunk loads at startup: it is an entry chunk, or an entry chunk\n * reaches it through static imports. Chunks that only dynamic imports reach\n * load later, after startup code already ran.\n *\n * Without the chunk graph every chunk counts as initial.\n */\nexport function isInitialChunk(\n chunk: Pick<ChunkGraphNode, 'fileName' | 'isEntry'>,\n chunks: Record<string, ChunkGraphNode> | undefined,\n): boolean {\n if (chunk.isEntry || !chunks) {\n return true;\n }\n\n return getInitialChunks(chunks).has(chunk.fileName);\n}\n\nexport { globFiles } from './glob';\nexport { getCodeInjectionPosition } from './get-code-injection-position';\n\nexport { createComponentNameAnnotateHooks } from './component-annotate-hooks';\n\nexport function getDebugIdSnippet(debugId: string): CodeInjection {\n return new CodeInjection(\n `var n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]=\"${debugId}\",e._sentryDebugIdIdentifier=\"sentry-dbid-${debugId}\");`,\n );\n}\n\nexport type { Logger } from './logger';\nexport type { InternalOptions, Options, SentrySDKBuildFlags } from './types';\nexport {\n CodeInjection,\n replaceBooleanFlagsInCode,\n stringToUUID,\n generateReleaseInjectorCode,\n generateModuleMetadataInjectorCode,\n} from './utils';\nexport { createSentryBuildPluginManager } from './build-plugin-manager';\nexport type { SentryBuildPluginManager, UploadResult, UploadStaging } from './build-plugin-manager';\nexport { createDebugIdUploadFunction, addDebugIdToEmittedArtifacts, stampDebugId } from './debug-id-upload';\nexport { decideSourceMapHandling, getDeleteSourcemapsAfterUpload, getSdkEnabledSourceMaps } from './sourcemap-settings';\nexport type { SourceMapDecision, SourceMapKind } from './sourcemap-settings';\nexport type { UploadFilter } from './upload-filter';\n"],"mappings":";;;;;;;;;;;;;AAMA,SAAgB,SAAS,UAA2B;CAClD,MAAM,gBAAgB,0BAA0B,QAAQ;CACxD,OAAO;EAAC;EAAO;EAAQ;CAAM,CAAC,CAAC,MAAK,QAAO,cAAc,SAAS,GAAG,CAAC;AACxE;;;;;;;;;;;;;;;AAgBA,SAAgB,wBAAwB,MAAc,gBAAoD;CAExG,IAAI,KAAK,KAAK,CAAC,CAAC,WAAW,GACzB,OAAO;CAIT,IAAI,kBAAkB,0BAA0B,cAAc,CAAC,CAAC,SAAS,OAAO,GAC9E,OAAO,oBAAoB,IAAI;CAGjC,OAAO;AACT;AAQA,MAAM,qCAAqB,IAAI,QAAqD;AAEpF,SAAS,iBAAiB,QAAqD;CAC7E,MAAM,SAAS,mBAAmB,IAAI,MAAM;CAC5C,IAAI,QACF,OAAO;CAGT,MAAM,0BAAU,IAAI,IAAY;CAChC,MAAM,QAAQ,OAAO,OAAO,MAAM,CAAC,CAAC,QAAO,UAAS,MAAM,OAAO;CAEjE,KAAK,IAAI,QAAQ,MAAM,MAAM,GAAG,OAAO,QAAQ,MAAM,MAAM,GAAG;EAC5D,IAAI,QAAQ,IAAI,MAAM,QAAQ,GAC5B;EAEF,QAAQ,IAAI,MAAM,QAAQ;EAC1B,KAAK,MAAM,YAAY,MAAM,WAAW,CAAC,GAAG;GAC1C,MAAM,gBAAgB,OAAO;GAC7B,IAAI,eACF,MAAM,KAAK,aAAa;EAE5B;CACF;CAEA,mBAAmB,IAAI,QAAQ,OAAO;CACtC,OAAO;AACT;;;;;;;;AASA,SAAgB,eACd,OACA,QACS;CACT,IAAI,MAAM,WAAW,CAAC,QACpB,OAAO;CAGT,OAAO,iBAAiB,MAAM,CAAC,CAAC,IAAI,MAAM,QAAQ;AACpD;AAOA,SAAgB,kBAAkB,SAAgC;CAChE,OAAO,IAAI,cACT,+FAA+F,QAAQ,4CAA4C,QAAQ,IAC7J;AACF"}
|
package/build/esm/core/logger.js
CHANGED
|
@@ -1,27 +1,20 @@
|
|
|
1
|
+
// src/core/logger.ts
|
|
1
2
|
function createLogger(options) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
debug(message, ...params) {
|
|
19
|
-
if (!options.silent && options.debug) {
|
|
20
|
-
console.debug(`${options.prefix} Debug: ${message}`, ...params);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
};
|
|
3
|
+
return {
|
|
4
|
+
info(message, ...params) {
|
|
5
|
+
if (!options.silent) console.info(`${options.prefix} Info: ${message}`, ...params);
|
|
6
|
+
},
|
|
7
|
+
warn(message, ...params) {
|
|
8
|
+
if (!options.silent) console.warn(`${options.prefix} Warning: ${message}`, ...params);
|
|
9
|
+
},
|
|
10
|
+
error(message, ...params) {
|
|
11
|
+
if (!options.silent) console.error(`${options.prefix} Error: ${message}`, ...params);
|
|
12
|
+
},
|
|
13
|
+
debug(message, ...params) {
|
|
14
|
+
if (!options.silent && options.debug) console.debug(`${options.prefix} Debug: ${message}`, ...params);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
24
17
|
}
|
|
25
|
-
|
|
26
18
|
export { createLogger };
|
|
27
|
-
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=logger.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sources":["../../../src/core/logger.ts"],"sourcesContent":["interface LoggerOptions {\n silent: boolean;\n debug: boolean;\n prefix: string;\n}\n\nexport type Logger = {\n info(message: string, ...params: unknown[]): void;\n warn(message: string, ...params: unknown[]): void;\n error(message: string, ...params: unknown[]): void;\n debug(message: string, ...params: unknown[]): void;\n};\n\n// Logging everything to stderr not to interfere with stdout\nexport function createLogger(options: LoggerOptions): Logger {\n return {\n info(message: string, ...params: unknown[]) {\n if (!options.silent) {\n // eslint-disable-next-line no-console\n console.info(`${options.prefix} Info: ${message}`, ...params);\n }\n },\n warn(message: string, ...params: unknown[]) {\n if (!options.silent) {\n // eslint-disable-next-line no-console\n console.warn(`${options.prefix} Warning: ${message}`, ...params);\n }\n },\n error(message: string, ...params: unknown[]) {\n if (!options.silent) {\n // eslint-disable-next-line no-console\n console.error(`${options.prefix} Error: ${message}`, ...params);\n }\n },\n debug(message: string, ...params: unknown[]) {\n if (!options.silent && options.debug) {\n // eslint-disable-next-line no-console\n console.debug(`${options.prefix} Debug: ${message}`, ...params);\n }\n },\n };\n}\n"],"
|
|
1
|
+
{"version":3,"file":"logger.js","names":[],"sources":["../../../src/core/logger.ts"],"sourcesContent":["interface LoggerOptions {\n silent: boolean;\n debug: boolean;\n prefix: string;\n}\n\nexport type Logger = {\n info(message: string, ...params: unknown[]): void;\n warn(message: string, ...params: unknown[]): void;\n error(message: string, ...params: unknown[]): void;\n debug(message: string, ...params: unknown[]): void;\n};\n\n// Logging everything to stderr not to interfere with stdout\nexport function createLogger(options: LoggerOptions): Logger {\n return {\n info(message: string, ...params: unknown[]) {\n if (!options.silent) {\n // eslint-disable-next-line no-console\n console.info(`${options.prefix} Info: ${message}`, ...params);\n }\n },\n warn(message: string, ...params: unknown[]) {\n if (!options.silent) {\n // eslint-disable-next-line no-console\n console.warn(`${options.prefix} Warning: ${message}`, ...params);\n }\n },\n error(message: string, ...params: unknown[]) {\n if (!options.silent) {\n // eslint-disable-next-line no-console\n console.error(`${options.prefix} Error: ${message}`, ...params);\n }\n },\n debug(message: string, ...params: unknown[]) {\n if (!options.silent && options.debug) {\n // eslint-disable-next-line no-console\n console.debug(`${options.prefix} Debug: ${message}`, ...params);\n }\n },\n };\n}\n"],"mappings":";AAcA,SAAgB,aAAa,SAAgC;CAC3D,OAAO;EACL,KAAK,SAAiB,GAAG,QAAmB;GAC1C,IAAI,CAAC,QAAQ,QAEX,QAAQ,KAAK,GAAG,QAAQ,OAAO,SAAS,WAAW,GAAG,MAAM;EAEhE;EACA,KAAK,SAAiB,GAAG,QAAmB;GAC1C,IAAI,CAAC,QAAQ,QAEX,QAAQ,KAAK,GAAG,QAAQ,OAAO,YAAY,WAAW,GAAG,MAAM;EAEnE;EACA,MAAM,SAAiB,GAAG,QAAmB;GAC3C,IAAI,CAAC,QAAQ,QAEX,QAAQ,MAAM,GAAG,QAAQ,OAAO,UAAU,WAAW,GAAG,MAAM;EAElE;EACA,MAAM,SAAiB,GAAG,QAAmB;GAC3C,IAAI,CAAC,QAAQ,UAAU,QAAQ,OAE7B,QAAQ,MAAM,GAAG,QAAQ,OAAO,UAAU,WAAW,GAAG,MAAM;EAElE;CACF;AACF"}
|