diff --git a/package.json b/package.json index fc00ac6c..a3ddd15a 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "defu": "^6.1.4", "esbuild": "^0.24.0", "hookable": "^5.5.3", - "jiti": "^2.2.0", + "jiti": "^2.3.1", "magic-string": "^0.30.11", "mkdist": "^1.5.9", "mlly": "^1.7.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 81e029f3..2567802e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -42,8 +42,8 @@ importers: specifier: ^5.5.3 version: 5.5.3 jiti: - specifier: ^2.2.0 - version: 2.2.0 + specifier: ^2.3.1 + version: 2.3.1 magic-string: specifier: ^0.30.11 version: 0.30.11 @@ -95,10 +95,10 @@ importers: version: 0.5.7(magicast@0.3.5) eslint: specifier: ^9.11.1 - version: 9.11.1(jiti@2.2.0) + version: 9.11.1(jiti@2.3.1) eslint-config-unjs: specifier: ^0.4.1 - version: 0.4.1(eslint@9.11.1(jiti@2.2.0))(typescript@5.6.2) + version: 0.4.1(eslint@9.11.1(jiti@2.3.1))(typescript@5.6.2) prettier: specifier: ^3.3.3 version: 3.3.3 @@ -1664,8 +1664,8 @@ packages: resolution: {integrity: sha512-2yTgeWTWzMWkHu6Jp9NKgePDaYHbntiwvYuuJLbbN9vl7DC9DvXKOB2BC3ZZ92D3cvV/aflH0osDfwpHepQ53w==} hasBin: true - jiti@2.2.0: - resolution: {integrity: sha512-XI3aImuxq2Qt9upi/5cWxVT7aP0FUmrT5jg9LAhl87tqQsJ7WRqePfI3SBktCRB6YiaHFl1R60PZ9s03nV3fSg==} + jiti@2.3.1: + resolution: {integrity: sha512-xPZ6pPzUifI8XDBBxIL4OB1w1ZKmBpmNEeKwNt2d0Spn8XisAIZhWrlOHq5seBrFGTxVx9PbrWvEMyrk4IO5bA==} hasBin: true js-tokens@4.0.0: @@ -2920,9 +2920,9 @@ snapshots: '@esbuild/win32-x64@0.24.0': optional: true - '@eslint-community/eslint-utils@4.4.0(eslint@9.11.1(jiti@2.2.0))': + '@eslint-community/eslint-utils@4.4.0(eslint@9.11.1(jiti@2.3.1))': dependencies: - eslint: 9.11.1(jiti@2.2.0) + eslint: 9.11.1(jiti@2.3.1) eslint-visitor-keys: 3.4.3 '@eslint-community/regexpp@4.11.1': {} @@ -3121,15 +3121,15 @@ snapshots: '@types/unist@2.0.11': {} - '@typescript-eslint/eslint-plugin@8.8.0(@typescript-eslint/parser@8.8.0(eslint@9.11.1(jiti@2.2.0))(typescript@5.6.2))(eslint@9.11.1(jiti@2.2.0))(typescript@5.6.2)': + '@typescript-eslint/eslint-plugin@8.8.0(@typescript-eslint/parser@8.8.0(eslint@9.11.1(jiti@2.3.1))(typescript@5.6.2))(eslint@9.11.1(jiti@2.3.1))(typescript@5.6.2)': dependencies: '@eslint-community/regexpp': 4.11.1 - '@typescript-eslint/parser': 8.8.0(eslint@9.11.1(jiti@2.2.0))(typescript@5.6.2) + '@typescript-eslint/parser': 8.8.0(eslint@9.11.1(jiti@2.3.1))(typescript@5.6.2) '@typescript-eslint/scope-manager': 8.8.0 - '@typescript-eslint/type-utils': 8.8.0(eslint@9.11.1(jiti@2.2.0))(typescript@5.6.2) - '@typescript-eslint/utils': 8.8.0(eslint@9.11.1(jiti@2.2.0))(typescript@5.6.2) + '@typescript-eslint/type-utils': 8.8.0(eslint@9.11.1(jiti@2.3.1))(typescript@5.6.2) + '@typescript-eslint/utils': 8.8.0(eslint@9.11.1(jiti@2.3.1))(typescript@5.6.2) '@typescript-eslint/visitor-keys': 8.8.0 - eslint: 9.11.1(jiti@2.2.0) + eslint: 9.11.1(jiti@2.3.1) graphemer: 1.4.0 ignore: 5.3.2 natural-compare: 1.4.0 @@ -3139,14 +3139,14 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/parser@8.8.0(eslint@9.11.1(jiti@2.2.0))(typescript@5.6.2)': + '@typescript-eslint/parser@8.8.0(eslint@9.11.1(jiti@2.3.1))(typescript@5.6.2)': dependencies: '@typescript-eslint/scope-manager': 8.8.0 '@typescript-eslint/types': 8.8.0 '@typescript-eslint/typescript-estree': 8.8.0(typescript@5.6.2) '@typescript-eslint/visitor-keys': 8.8.0 debug: 4.3.7 - eslint: 9.11.1(jiti@2.2.0) + eslint: 9.11.1(jiti@2.3.1) optionalDependencies: typescript: 5.6.2 transitivePeerDependencies: @@ -3157,10 +3157,10 @@ snapshots: '@typescript-eslint/types': 8.8.0 '@typescript-eslint/visitor-keys': 8.8.0 - '@typescript-eslint/type-utils@8.8.0(eslint@9.11.1(jiti@2.2.0))(typescript@5.6.2)': + '@typescript-eslint/type-utils@8.8.0(eslint@9.11.1(jiti@2.3.1))(typescript@5.6.2)': dependencies: '@typescript-eslint/typescript-estree': 8.8.0(typescript@5.6.2) - '@typescript-eslint/utils': 8.8.0(eslint@9.11.1(jiti@2.2.0))(typescript@5.6.2) + '@typescript-eslint/utils': 8.8.0(eslint@9.11.1(jiti@2.3.1))(typescript@5.6.2) debug: 4.3.7 ts-api-utils: 1.3.0(typescript@5.6.2) optionalDependencies: @@ -3186,13 +3186,13 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/utils@8.8.0(eslint@9.11.1(jiti@2.2.0))(typescript@5.6.2)': + '@typescript-eslint/utils@8.8.0(eslint@9.11.1(jiti@2.3.1))(typescript@5.6.2)': dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@9.11.1(jiti@2.2.0)) + '@eslint-community/eslint-utils': 4.4.0(eslint@9.11.1(jiti@2.3.1)) '@typescript-eslint/scope-manager': 8.8.0 '@typescript-eslint/types': 8.8.0 '@typescript-eslint/typescript-estree': 8.8.0(typescript@5.6.2) - eslint: 9.11.1(jiti@2.2.0) + eslint: 9.11.1(jiti@2.3.1) transitivePeerDependencies: - supports-color - typescript @@ -3695,33 +3695,33 @@ snapshots: escape-string-regexp@4.0.0: {} - eslint-config-unjs@0.4.1(eslint@9.11.1(jiti@2.2.0))(typescript@5.6.2): + eslint-config-unjs@0.4.1(eslint@9.11.1(jiti@2.3.1))(typescript@5.6.2): dependencies: '@eslint/js': 9.11.1 - eslint: 9.11.1(jiti@2.2.0) - eslint-plugin-markdown: 5.1.0(eslint@9.11.1(jiti@2.2.0)) - eslint-plugin-unicorn: 55.0.0(eslint@9.11.1(jiti@2.2.0)) + eslint: 9.11.1(jiti@2.3.1) + eslint-plugin-markdown: 5.1.0(eslint@9.11.1(jiti@2.3.1)) + eslint-plugin-unicorn: 55.0.0(eslint@9.11.1(jiti@2.3.1)) globals: 15.10.0 typescript: 5.6.2 - typescript-eslint: 8.8.0(eslint@9.11.1(jiti@2.2.0))(typescript@5.6.2) + typescript-eslint: 8.8.0(eslint@9.11.1(jiti@2.3.1))(typescript@5.6.2) transitivePeerDependencies: - supports-color - eslint-plugin-markdown@5.1.0(eslint@9.11.1(jiti@2.2.0)): + eslint-plugin-markdown@5.1.0(eslint@9.11.1(jiti@2.3.1)): dependencies: - eslint: 9.11.1(jiti@2.2.0) + eslint: 9.11.1(jiti@2.3.1) mdast-util-from-markdown: 0.8.5 transitivePeerDependencies: - supports-color - eslint-plugin-unicorn@55.0.0(eslint@9.11.1(jiti@2.2.0)): + eslint-plugin-unicorn@55.0.0(eslint@9.11.1(jiti@2.3.1)): dependencies: '@babel/helper-validator-identifier': 7.25.7 - '@eslint-community/eslint-utils': 4.4.0(eslint@9.11.1(jiti@2.2.0)) + '@eslint-community/eslint-utils': 4.4.0(eslint@9.11.1(jiti@2.3.1)) ci-info: 4.0.0 clean-regexp: 1.0.0 core-js-compat: 3.38.1 - eslint: 9.11.1(jiti@2.2.0) + eslint: 9.11.1(jiti@2.3.1) esquery: 1.6.0 globals: 15.10.0 indent-string: 4.0.0 @@ -3743,9 +3743,9 @@ snapshots: eslint-visitor-keys@4.1.0: {} - eslint@9.11.1(jiti@2.2.0): + eslint@9.11.1(jiti@2.3.1): dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@9.11.1(jiti@2.2.0)) + '@eslint-community/eslint-utils': 4.4.0(eslint@9.11.1(jiti@2.3.1)) '@eslint-community/regexpp': 4.11.1 '@eslint/config-array': 0.18.0 '@eslint/core': 0.6.0 @@ -3783,7 +3783,7 @@ snapshots: strip-ansi: 6.0.1 text-table: 0.2.0 optionalDependencies: - jiti: 2.2.0 + jiti: 2.3.1 transitivePeerDependencies: - supports-color @@ -4045,7 +4045,7 @@ snapshots: jiti@1.21.6: {} - jiti@2.2.0: {} + jiti@2.3.1: {} js-tokens@4.0.0: {} @@ -4736,11 +4736,11 @@ snapshots: type-fest@0.8.1: {} - typescript-eslint@8.8.0(eslint@9.11.1(jiti@2.2.0))(typescript@5.6.2): + typescript-eslint@8.8.0(eslint@9.11.1(jiti@2.3.1))(typescript@5.6.2): dependencies: - '@typescript-eslint/eslint-plugin': 8.8.0(@typescript-eslint/parser@8.8.0(eslint@9.11.1(jiti@2.2.0))(typescript@5.6.2))(eslint@9.11.1(jiti@2.2.0))(typescript@5.6.2) - '@typescript-eslint/parser': 8.8.0(eslint@9.11.1(jiti@2.2.0))(typescript@5.6.2) - '@typescript-eslint/utils': 8.8.0(eslint@9.11.1(jiti@2.2.0))(typescript@5.6.2) + '@typescript-eslint/eslint-plugin': 8.8.0(@typescript-eslint/parser@8.8.0(eslint@9.11.1(jiti@2.3.1))(typescript@5.6.2))(eslint@9.11.1(jiti@2.3.1))(typescript@5.6.2) + '@typescript-eslint/parser': 8.8.0(eslint@9.11.1(jiti@2.3.1))(typescript@5.6.2) + '@typescript-eslint/utils': 8.8.0(eslint@9.11.1(jiti@2.3.1))(typescript@5.6.2) optionalDependencies: typescript: 5.6.2 transitivePeerDependencies: @@ -4763,7 +4763,7 @@ snapshots: '@babel/standalone': 7.25.7 '@babel/types': 7.25.7 defu: 6.1.4 - jiti: 2.2.0 + jiti: 2.3.1 mri: 1.2.0 scule: 1.3.0 transitivePeerDependencies: diff --git a/src/build.ts b/src/build.ts index a58377c0..28eeaeb1 100644 --- a/src/build.ts +++ b/src/build.ts @@ -28,18 +28,20 @@ export async function build( rootDir = resolve(process.cwd(), rootDir || "."); // Create jiti instance for loading initial config - const jiti = createJiti(rootDir, { interopDefault: true }); + const jiti = createJiti(rootDir); let _buildConfig: BuildConfig | BuildConfig[] = - (await jiti.import("./build.config", { try: true })) || {}; + (await jiti.import("./build.config", { try: true, default: true })) || {}; _buildConfig = (_buildConfig as any).default || _buildConfig; const buildConfigs = ( Array.isArray(_buildConfig) ? _buildConfig : [_buildConfig] ).filter(Boolean); const pkg: PackageJson & Partial> = - ((await jiti.import("./package.json", { try: true })) as PackageJson) || - ({} as PackageJson); + ((await jiti.import("./package.json", { + try: true, + default: true, + })) as PackageJson) || ({} as PackageJson); // Invoke build for every build config defined in build.config.ts const cleanedDirs: string[] = [];