gasup 1.0.0 → 1.0.1

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/dist/config.js +10 -8
  2. package/package.json +2 -4
package/dist/config.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import fs from 'fs';
2
2
  import path from 'path';
3
- import tsnode from 'ts-node';
3
+ import esbuild from 'esbuild';
4
4
  const configFileName = 'gasup.config.ts';
5
5
  export const defaultConfig = {
6
6
  entryPoint: 'src/index.ts',
@@ -18,13 +18,15 @@ export async function loadConfigWithDefault() {
18
18
  async function loadConfig(configPath) {
19
19
  try {
20
20
  const configString = fs.readFileSync(configPath, 'utf-8');
21
- const compiledPath = path.join(process.cwd(), '__config_compiled.js');
22
- const compiledCode = tsnode
23
- .create()
24
- .compile(configString, 'config_dummy.ts');
25
- fs.writeFileSync(compiledPath, compiledCode);
26
- const data = await import(compiledPath);
27
- fs.unlinkSync(compiledPath);
21
+ // メモリ上でTypeScriptをJavaScriptに変換
22
+ const result = await esbuild.transform(configString, {
23
+ loader: 'ts',
24
+ format: 'esm',
25
+ });
26
+ // 動的にモジュールとして実行
27
+ const moduleCode = result.code;
28
+ const moduleUrl = `data:text/javascript;base64,${Buffer.from(moduleCode).toString('base64')}`;
29
+ const data = await import(moduleUrl);
28
30
  return data.default;
29
31
  }
30
32
  catch (err) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gasup",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -26,9 +26,7 @@
26
26
  "esbuild-gas-plugin": "^0.9.0"
27
27
  },
28
28
  "devDependencies": {
29
- "@types/node": "^22.15.30",
30
- "ts-node": "^10.9.2",
31
- "vitest": "^3.2.2"
29
+ "@types/node": "^22.15.30"
32
30
  },
33
31
  "scripts": {
34
32
  "build": "tsc",