ts-arc 1.2.6 → 1.2.7
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/loader.js +11 -8
- package/package.json +1 -1
package/dist/loader.js
CHANGED
|
@@ -381,16 +381,19 @@ async function load(urlStr, context, nextLoad) {
|
|
|
381
381
|
});
|
|
382
382
|
}
|
|
383
383
|
function loadSync(urlStr, context, nextLoadSync) {
|
|
384
|
-
|
|
384
|
+
{
|
|
385
385
|
const u = new URL(urlStr);
|
|
386
|
-
const
|
|
386
|
+
const isCopycat = u.searchParams.get("copycat") === "1";
|
|
387
387
|
const asPath = u.searchParams.get("as");
|
|
388
|
-
const
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
388
|
+
const filePath = url.fileURLToPath(u.origin + u.pathname);
|
|
389
|
+
const code = fs.readFileSync(filePath, "utf8");
|
|
390
|
+
if (isCopycat) {
|
|
391
|
+
return {
|
|
392
|
+
format: "module",
|
|
393
|
+
source: code,
|
|
394
|
+
shortCircuit: true
|
|
395
|
+
};
|
|
396
|
+
}
|
|
394
397
|
}
|
|
395
398
|
if (urlStr.endsWith(".ts") || urlStr.endsWith(".tsx")) {
|
|
396
399
|
const esbuildLoader = urlStr.endsWith(".tsx") ? "tsx" : "ts";
|