@poppinss/ts-exec 1.2.1 → 1.3.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.
Files changed (2) hide show
  1. package/build/src/loader.js +17 -19
  2. package/package.json +5 -5
@@ -35,10 +35,10 @@ var DEFAULT_CONFIG = {
35
35
  keepClassNames: true
36
36
  }
37
37
  };
38
- function tsConfigToSwcConfig(tsConfig2) {
39
- const tsTarget = tsConfig2.compilerOptions?.target?.toLowerCase();
38
+ function tsConfigToSwcConfig(tsConfig) {
39
+ const tsTarget = tsConfig.compilerOptions?.target?.toLowerCase();
40
40
  return {
41
- sourceMaps: tsConfig2.compilerOptions?.sourceMap ?? true,
41
+ sourceMaps: tsConfig.compilerOptions?.sourceMap ?? true,
42
42
  module: {
43
43
  /**
44
44
  * Since, we will run the SWC transformer via Nodejs loader hooks, the
@@ -48,31 +48,31 @@ function tsConfigToSwcConfig(tsConfig2) {
48
48
  },
49
49
  jsc: {
50
50
  target: tsTarget ? tsTarget === "es6" ? "esnext" : tsTarget : "esnext",
51
- baseUrl: tsConfig2.compilerOptions?.baseUrl,
51
+ baseUrl: tsConfig.compilerOptions?.baseUrl,
52
52
  externalHelpers: false,
53
53
  parser: {
54
54
  syntax: "typescript",
55
- tsx: !!tsConfig2.compilerOptions?.jsx,
55
+ tsx: !!tsConfig.compilerOptions?.jsx,
56
56
  decorators: true,
57
57
  dynamicImport: true
58
58
  },
59
59
  transform: {
60
- ...tsConfig2.compilerOptions?.emitDecoratorMetadata ? {
60
+ ...tsConfig.compilerOptions?.emitDecoratorMetadata ? {
61
61
  decoratorMetadata: true
62
62
  } : {},
63
- ...tsConfig2.compilerOptions?.experimentalDecorators ? {
63
+ ...tsConfig.compilerOptions?.experimentalDecorators ? {
64
64
  legacyDecorator: true
65
65
  } : {},
66
- ...tsConfig2.compilerOptions?.verbatimModuleSyntax ? {
66
+ ...tsConfig.compilerOptions?.verbatimModuleSyntax ? {
67
67
  verbatimModuleSyntax: true
68
68
  } : {},
69
- ...tsConfig2.compilerOptions?.useDefineForClassFields ? {
69
+ ...tsConfig.compilerOptions?.useDefineForClassFields ? {
70
70
  useDefineForClassFields: true
71
71
  } : {},
72
72
  react: {
73
73
  runtime: "automatic",
74
- ...tsConfig2.compilerOptions?.jsxImportSource ? {
75
- importSource: tsConfig2.compilerOptions?.jsxImportSource
74
+ ...tsConfig.compilerOptions?.jsxImportSource ? {
75
+ importSource: tsConfig.compilerOptions?.jsxImportSource
76
76
  } : {}
77
77
  }
78
78
  },
@@ -81,10 +81,10 @@ function tsConfigToSwcConfig(tsConfig2) {
81
81
  };
82
82
  }
83
83
  function getConfig(searchPath) {
84
- const tsConfig2 = getTsconfig(
84
+ const tsConfig = getTsconfig(
85
85
  typeof searchPath === "string" ? searchPath : fileURLToPath(searchPath)
86
86
  );
87
- if (!tsConfig2) {
87
+ if (!tsConfig) {
88
88
  debug_default("Unable to locate tsconfig file");
89
89
  return {
90
90
  tsConfig: null,
@@ -94,10 +94,10 @@ function getConfig(searchPath) {
94
94
  }
95
95
  };
96
96
  }
97
- debug_default("tsConfig %O", tsConfig2.config);
98
- const swcConfig2 = tsConfigToSwcConfig(tsConfig2.config);
97
+ debug_default("tsConfig %O", tsConfig.config);
98
+ const swcConfig2 = tsConfigToSwcConfig(tsConfig.config);
99
99
  debug_default("swcConfig %O", swcConfig2);
100
- return { tsConfig: tsConfig2.config, tsConfigPath: tsConfig2.path, swcConfig: swcConfig2 };
100
+ return { tsConfig: tsConfig.config, tsConfigPath: tsConfig.path, swcConfig: swcConfig2 };
101
101
  }
102
102
 
103
103
  // src/transform.ts
@@ -111,7 +111,6 @@ function transformSync(source, options) {
111
111
 
112
112
  // src/loader.ts
113
113
  var swcConfig;
114
- var tsConfig;
115
114
  function isLocalPath(specifier) {
116
115
  return specifier.startsWith("./") || specifier.startsWith("../") || specifier.startsWith("/") || specifier.startsWith("file:");
117
116
  }
@@ -139,14 +138,13 @@ async function initialize() {
139
138
  const searchPath = process.env.TS_EXEC_PWD ?? process.cwd();
140
139
  const config = getConfig(searchPath);
141
140
  swcConfig = config.swcConfig;
142
- tsConfig = config.tsConfig;
143
141
  }
144
142
  var resolve = async (specifier, context, nextResolve) => {
145
143
  debug_default("resolving specifier %s", specifier);
146
144
  try {
147
145
  return await nextResolve(specifier, context);
148
146
  } catch (error) {
149
- if (!tsConfig?.compilerOptions?.rewriteRelativeImportExtensions && error.code === "ERR_MODULE_NOT_FOUND" && error.url && isLocalPath(error.url)) {
147
+ if (error.code === "ERR_MODULE_NOT_FOUND" && error.url && isLocalPath(error.url)) {
150
148
  let url = error.url;
151
149
  const fileExtension = extname(url);
152
150
  if (fileExtension === ".js") {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@poppinss/ts-exec",
3
3
  "description": "TypeScript JIT compiler built for correctness and supports legacy/experimental decorators",
4
- "version": "1.2.1",
4
+ "version": "1.3.0",
5
5
  "engines": {
6
6
  "node": ">=24.0.0"
7
7
  },
@@ -40,14 +40,14 @@
40
40
  "@japa/runner": "^4.2.0",
41
41
  "@japa/snapshot": "^2.0.8",
42
42
  "@release-it/conventional-changelog": "^10.0.1",
43
- "@types/node": "^22.15.23",
43
+ "@types/node": "^22.15.30",
44
44
  "c8": "^10.1.3",
45
- "eslint": "^9.27.0",
45
+ "eslint": "^9.28.0",
46
46
  "ipaddr.js": "^2.2.0",
47
- "preact": "^10.26.7",
47
+ "preact": "^10.26.8",
48
48
  "preact-render-to-string": "^6.5.13",
49
49
  "prettier": "^3.5.3",
50
- "release-it": "^19.0.2",
50
+ "release-it": "^19.0.3",
51
51
  "tsup": "^8.5.0",
52
52
  "typescript": "^5.8.3"
53
53
  },