@chialab/esbuild-plugin-transform
Advanced tools
Comparing version 0.9.3 to 0.9.4
@@ -143,5 +143,7 @@ import path from 'path'; | ||
build.onLoad({ filter, namespace: 'file' }, async (args) => { | ||
let transformed = false; | ||
let entry; | ||
if (args.path === input && stdin) { | ||
entry = await getEntry(build, args.path, stdin.contents); | ||
transformed = true; | ||
} else { | ||
@@ -151,6 +153,19 @@ entry = await getEntry(build, args.path); | ||
args.pluginData = entry; | ||
for (let i = 0; i < onLoad.length; i++) { | ||
await onLoad[i](args); | ||
const result = onLoad[i](args); | ||
if (result) { | ||
transformed = true; | ||
await result; | ||
} | ||
} | ||
if (!transformed) { | ||
return { | ||
contents: entry.code, | ||
loader: entry.loader, | ||
}; | ||
} | ||
const { code, loader } = await finalize(entry, { | ||
@@ -157,0 +172,0 @@ sourcemap: 'inline', |
{ | ||
"name": "@chialab/esbuild-plugin-transform", | ||
"type": "module", | ||
"version": "0.9.3", | ||
"version": "0.9.4", | ||
"description": "Pipe transformation plugin for esbuild.", | ||
@@ -42,3 +42,3 @@ "main": "lib/index.js", | ||
}, | ||
"gitHead": "e8a7a1b5c22f75c14a2df8a5121240839f7bdac3" | ||
"gitHead": "0d8d5293cb902f1f2d4e3f955a838f1b01bdb3d9" | ||
} |
11507
207