Skip to content
This repository was archived by the owner on May 17, 2025. It is now read-only.

Commit 7d74a0f

Browse files
chore: update babel imports to use named exports
1 parent 74d928b commit 7d74a0f

File tree

3 files changed

+11
-22
lines changed

3 files changed

+11
-22
lines changed

src/trace/cjs.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export async function createCjsAnalysis(
2121
source: string,
2222
url: string
2323
): Promise<Analysis> {
24-
if (!babel) ({ default: babel } = await import("@babel/core"));
24+
if (!babel) babel = await import("@babel/core");
2525

2626
const requires = new Set<string>();
2727
const lazy = new Set<string>();
@@ -110,7 +110,7 @@ export async function createCjsAnalysis(
110110
size: source.length,
111111
format: "commonjs",
112112
usesCjs,
113-
integrity: getIntegrity(source)
113+
integrity: getIntegrity(source),
114114
};
115115
}
116116

src/trace/ts.ts

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,8 @@ export async function createTsAnalysis(
4141
): Promise<Analysis> {
4242
if (!babel)
4343
[
44-
{ default: babel },
45-
{
46-
default: { default: babelPresetTs },
47-
},
44+
babel,
45+
{ default: babelPresetTs },
4846
{ default: babelPluginImportAttributes },
4947
] = await Promise.all([
5048
import("@babel/core"),
@@ -54,7 +52,6 @@ export async function createTsAnalysis(
5452

5553
const imports = new Set<string>();
5654
const dynamicImports = new Set<string>();
57-
let importMeta = false;
5855

5956
// @ts-ignore
6057
globalThis.console = dummyConsole;
@@ -84,7 +81,7 @@ export async function createTsAnalysis(
8481
],
8582
plugins: [
8683
babelPluginImportAttributes,
87-
({ types: t }) => {
84+
() => {
8885
return {
8986
visitor: {
9087
ExportAllDeclaration(path) {
@@ -105,14 +102,6 @@ export async function createTsAnalysis(
105102
)
106103
);
107104
},
108-
MetaProperty(path) {
109-
if (
110-
t.isIdentifier(path.node.meta, { name: "import" }) &&
111-
t.isIdentifier(path.node.property, { name: "meta" })
112-
) {
113-
importMeta = true;
114-
}
115-
},
116105
},
117106
};
118107
},
@@ -128,7 +117,7 @@ export async function createTsAnalysis(
128117
cjsLazyDeps: null,
129118
size: source.length,
130119
format: "typescript",
131-
integrity: getIntegrity(source)
120+
integrity: getIntegrity(source),
132121
};
133122
}
134123

test/test.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"#lib/config/files/index.js": "https://ga.jspm.io/npm:@babel/core@7.24.7/lib/config/files/index-browser.js",
2828
"#lib/config/resolve-targets.js": "https://ga.jspm.io/npm:@babel/core@7.24.7/lib/config/resolve-targets-browser.js",
2929
"#lib/transform-file.js": "https://ga.jspm.io/npm:@babel/core@7.24.7/lib/transform-file-browser.js",
30-
"#node.js": "https://ga.jspm.io/npm:browserslist@4.23.1/browser.js",
30+
"#node.js": "https://ga.jspm.io/npm:browserslist@4.23.2/browser.js",
3131
"@ampproject/remapping": "https://ga.jspm.io/npm:@ampproject/remapping@2.3.0/dist/remapping.umd.js",
3232
"@babel/code-frame": "https://ga.jspm.io/npm:@babel/code-frame@7.24.7/lib/index.js",
3333
"@babel/compat-data/native-modules": "https://ga.jspm.io/npm:@babel/compat-data@7.24.7/native-modules.js",
@@ -65,18 +65,18 @@
6565
"@jridgewell/gen-mapping": "https://ga.jspm.io/npm:@jridgewell/gen-mapping@0.3.5/dist/gen-mapping.umd.js",
6666
"@jridgewell/resolve-uri": "https://ga.jspm.io/npm:@jridgewell/resolve-uri@3.1.2/dist/resolve-uri.umd.js",
6767
"@jridgewell/set-array": "https://ga.jspm.io/npm:@jridgewell/set-array@1.2.1/dist/set-array.umd.js",
68-
"@jridgewell/sourcemap-codec": "https://ga.jspm.io/npm:@jridgewell/sourcemap-codec@1.4.15/dist/sourcemap-codec.umd.js",
68+
"@jridgewell/sourcemap-codec": "https://ga.jspm.io/npm:@jridgewell/sourcemap-codec@1.5.0/dist/sourcemap-codec.umd.js",
6969
"@jridgewell/trace-mapping": "https://ga.jspm.io/npm:@jridgewell/trace-mapping@0.3.25/dist/trace-mapping.umd.js",
7070
"ansi-styles": "https://ga.jspm.io/npm:ansi-styles@3.2.1/index.js",
71-
"browserslist": "https://ga.jspm.io/npm:browserslist@4.23.1/index.js",
71+
"browserslist": "https://ga.jspm.io/npm:browserslist@4.23.2/index.js",
7272
"buffer": "https://ga.jspm.io/npm:@jspm/core@2.0.1/nodelibs/browser/buffer.js",
73-
"caniuse-lite/dist/unpacker/agents": "https://ga.jspm.io/npm:caniuse-lite@1.0.30001640/dist/unpacker/agents.js",
73+
"caniuse-lite/dist/unpacker/agents": "https://ga.jspm.io/npm:caniuse-lite@1.0.30001641/dist/unpacker/agents.js",
7474
"chalk": "https://ga.jspm.io/npm:chalk@2.4.2/index.js",
7575
"color-convert": "https://ga.jspm.io/npm:color-convert@1.9.3/index.js",
7676
"color-name": "https://ga.jspm.io/npm:color-name@1.1.3/index.js",
7777
"convert-source-map": "https://ga.jspm.io/npm:convert-source-map@2.0.0/index.js",
7878
"debug": "https://ga.jspm.io/npm:debug@4.3.5/src/browser.js",
79-
"electron-to-chromium/versions": "https://ga.jspm.io/npm:electron-to-chromium@1.4.818/versions.js",
79+
"electron-to-chromium/versions": "https://ga.jspm.io/npm:electron-to-chromium@1.4.823/versions.js",
8080
"escape-string-regexp": "https://ga.jspm.io/npm:escape-string-regexp@1.0.5/index.js",
8181
"fs": "https://ga.jspm.io/npm:@jspm/core@2.0.1/nodelibs/browser/fs.js",
8282
"gensync": "https://ga.jspm.io/npm:gensync@1.0.0-beta.2/index.js",

0 commit comments

Comments
 (0)