@hirarijs/loader-tsx 1.0.0 → 1.0.2

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/index.cjs CHANGED
@@ -28,6 +28,11 @@ var import_esbuild = require("esbuild");
28
28
  var import_loader = require("@hirarijs/loader");
29
29
  var extensions = [".tsx", ".jsx"];
30
30
  function runTransform(code, filename, ctx) {
31
+ const opts = ctx.loaderConfig.pluginOptions?.["@hirarijs/loader-tsx"] || {};
32
+ const ignoreNm = opts.ignoreNodeModules !== false && opts.allowNodeModules !== true;
33
+ if (ignoreNm && filename.includes("node_modules")) {
34
+ return { code, continue: true };
35
+ }
31
36
  const ext = (0, import_path.extname)(filename);
32
37
  const loader = ext === ".jsx" ? "jsx" : "tsx";
33
38
  const banner = ctx.format === "cjs" ? `const ${import_loader.IMPORT_META_URL_VARIABLE} = require('url').pathToFileURL(__filename).href;` : void 0;
@@ -45,7 +50,8 @@ function runTransform(code, filename, ctx) {
45
50
  return {
46
51
  code: result.code,
47
52
  map: result.map,
48
- format: ctx.format
53
+ format: ctx.format,
54
+ continue: opts.continue === true
49
55
  };
50
56
  }
51
57
  var plugin = {
package/dist/index.js CHANGED
@@ -6,6 +6,11 @@ import {
6
6
  } from "@hirarijs/loader";
7
7
  var extensions = [".tsx", ".jsx"];
8
8
  function runTransform(code, filename, ctx) {
9
+ const opts = ctx.loaderConfig.pluginOptions?.["@hirarijs/loader-tsx"] || {};
10
+ const ignoreNm = opts.ignoreNodeModules !== false && opts.allowNodeModules !== true;
11
+ if (ignoreNm && filename.includes("node_modules")) {
12
+ return { code, continue: true };
13
+ }
9
14
  const ext = extname(filename);
10
15
  const loader = ext === ".jsx" ? "jsx" : "tsx";
11
16
  const banner = ctx.format === "cjs" ? `const ${IMPORT_META_URL_VARIABLE} = require('url').pathToFileURL(__filename).href;` : void 0;
@@ -23,7 +28,8 @@ function runTransform(code, filename, ctx) {
23
28
  return {
24
29
  code: result.code,
25
30
  map: result.map,
26
- format: ctx.format
31
+ format: ctx.format,
32
+ continue: opts.continue === true
27
33
  };
28
34
  }
29
35
  var plugin = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hirarijs/loader-tsx",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "TSX/JSX loader plugin for HirariJS loader",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",