From 57fddde40f6f975e7e7c730f7c5b2d82ef33e37f Mon Sep 17 00:00:00 2001 From: Arya Emami Date: Wed, 2 Oct 2024 03:00:22 -0500 Subject: [PATCH] Update `jiti` usage to use `jiti.import()` (#374) * Bump `jiti` to version 2.1.0 * Use `jiti.import` - We use `jiti.import` so we can load TS files that contain top-level `await` syntax. --- packages/size-limit/get-config.js | 7 +- packages/size-limit/package.json | 2 +- pnpm-lock.yaml | 126 +++++++++++++++--------------- 3 files changed, 69 insertions(+), 66 deletions(-) diff --git a/packages/size-limit/get-config.js b/packages/size-limit/get-config.js index f955ff37..54834531 100644 --- a/packages/size-limit/get-config.js +++ b/packages/size-limit/get-config.js @@ -88,9 +88,12 @@ const dynamicImport = async filePath => const tsLoader = async filePath => { let jiti = (await import('jiti')).createJiti(fileURLToPath(import.meta.url), { - interopDefault: true + interopDefault: false }) - return jiti(filePath) + + let config = await jiti.import(filePath) + + return config?.default ?? config } export default async function getConfig(plugins, process, args, pkg) { diff --git a/packages/size-limit/package.json b/packages/size-limit/package.json index f6c74195..9ecff0c3 100644 --- a/packages/size-limit/package.json +++ b/packages/size-limit/package.json @@ -26,7 +26,7 @@ "dependencies": { "bytes-iec": "^3.1.1", "chokidar": "^4.0.1", - "jiti": "^2.0.0", + "jiti": "^2.1.0", "lilconfig": "^3.1.2", "nanospinner": "^1.1.0", "picocolors": "^1.1.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 927e56ca..68e71740 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -10,7 +10,7 @@ importers: devDependencies: '@logux/eslint-config': specifier: ^53.4.0 - version: 53.4.0(@typescript-eslint/parser@8.8.0(eslint@9.11.1(jiti@2.0.0))(typescript@5.6.2))(eslint@9.11.1(jiti@2.0.0))(typescript@5.6.2) + version: 53.4.0(@typescript-eslint/parser@8.8.0(eslint@9.11.1(jiti@2.1.0))(typescript@5.6.2))(eslint@9.11.1(jiti@2.1.0))(typescript@5.6.2) '@size-limit/esbuild': specifier: workspace:^ version: link:packages/esbuild @@ -52,7 +52,7 @@ importers: version: 7.0.3 eslint: specifier: ^9.11.1 - version: 9.11.1(jiti@2.0.0) + version: 9.11.1(jiti@2.1.0) print-snapshots: specifier: ^0.4.2 version: 0.4.2 @@ -164,8 +164,8 @@ importers: specifier: ^4.0.1 version: 4.0.1 jiti: - specifier: ^2.0.0 - version: 2.0.0 + specifier: ^2.1.0 + version: 2.1.0 lilconfig: specifier: ^3.1.2 version: 3.1.2 @@ -2107,8 +2107,8 @@ packages: resolution: {integrity: sha512-eIz2msL/EzL9UFTFFx7jBTkeZfku0yUAyZZZmJ93H2TYEiroIx2PQjEXcwYtYl8zXCxb+PAmA2hLIt/6ZEkPHw==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - jiti@2.0.0: - resolution: {integrity: sha512-CJ7e7Abb779OTRv3lomfp7Mns/Sy1+U4pcAx5VbjxCZD5ZM/VJaXPpPjNKjtSvWQy/H86E49REXR34dl1JEz9w==} + jiti@2.1.0: + resolution: {integrity: sha512-Nftp80J8poC3u+93ZxpjstsgfQ5d0o5qyD6yStv32sgnWr74xRxBppEwsUoA/GIdrJpgGRkC1930YkLcAsFdSw==} hasBin: true jora@1.0.0-beta.8: @@ -3347,9 +3347,9 @@ snapshots: '@esbuild/win32-x64@0.24.0': optional: true - '@eslint-community/eslint-utils@4.4.0(eslint@9.11.1(jiti@2.0.0))': + '@eslint-community/eslint-utils@4.4.0(eslint@9.11.1(jiti@2.1.0))': dependencies: - eslint: 9.11.1(jiti@2.0.0) + eslint: 9.11.1(jiti@2.1.0) eslint-visitor-keys: 3.4.3 '@eslint-community/regexpp@4.11.1': {} @@ -3436,17 +3436,17 @@ snapshots: '@jridgewell/resolve-uri': 3.1.2 '@jridgewell/sourcemap-codec': 1.5.0 - '@logux/eslint-config@53.4.0(@typescript-eslint/parser@8.8.0(eslint@9.11.1(jiti@2.0.0))(typescript@5.6.2))(eslint@9.11.1(jiti@2.0.0))(typescript@5.6.2)': + '@logux/eslint-config@53.4.0(@typescript-eslint/parser@8.8.0(eslint@9.11.1(jiti@2.1.0))(typescript@5.6.2))(eslint@9.11.1(jiti@2.1.0))(typescript@5.6.2)': dependencies: '@eslint/eslintrc': 3.1.0 - eslint: 9.11.1(jiti@2.0.0) - eslint-config-standard: 17.1.0(eslint-plugin-import@2.30.0(@typescript-eslint/parser@8.8.0(eslint@9.11.1(jiti@2.0.0))(typescript@5.6.2))(eslint@9.11.1(jiti@2.0.0)))(eslint-plugin-n@17.10.3(eslint@9.11.1(jiti@2.0.0)))(eslint-plugin-promise@7.1.0(eslint@9.11.1(jiti@2.0.0)))(eslint@9.11.1(jiti@2.0.0)) - eslint-plugin-import: 2.30.0(@typescript-eslint/parser@8.8.0(eslint@9.11.1(jiti@2.0.0))(typescript@5.6.2))(eslint@9.11.1(jiti@2.0.0)) - eslint-plugin-n: 17.10.3(eslint@9.11.1(jiti@2.0.0)) - eslint-plugin-perfectionist: 3.7.0(eslint@9.11.1(jiti@2.0.0))(typescript@5.6.2) + eslint: 9.11.1(jiti@2.1.0) + eslint-config-standard: 17.1.0(eslint-plugin-import@2.30.0(@typescript-eslint/parser@8.8.0(eslint@9.11.1(jiti@2.1.0))(typescript@5.6.2))(eslint@9.11.1(jiti@2.1.0)))(eslint-plugin-n@17.10.3(eslint@9.11.1(jiti@2.1.0)))(eslint-plugin-promise@7.1.0(eslint@9.11.1(jiti@2.1.0)))(eslint@9.11.1(jiti@2.1.0)) + eslint-plugin-import: 2.30.0(@typescript-eslint/parser@8.8.0(eslint@9.11.1(jiti@2.1.0))(typescript@5.6.2))(eslint@9.11.1(jiti@2.1.0)) + eslint-plugin-n: 17.10.3(eslint@9.11.1(jiti@2.1.0)) + eslint-plugin-perfectionist: 3.7.0(eslint@9.11.1(jiti@2.1.0))(typescript@5.6.2) eslint-plugin-prefer-let: 4.0.0 - eslint-plugin-promise: 7.1.0(eslint@9.11.1(jiti@2.0.0)) - typescript-eslint: 8.8.0(eslint@9.11.1(jiti@2.0.0))(typescript@5.6.2) + eslint-plugin-promise: 7.1.0(eslint@9.11.1(jiti@2.1.0)) + typescript-eslint: 8.8.0(eslint@9.11.1(jiti@2.1.0))(typescript@5.6.2) transitivePeerDependencies: - '@typescript-eslint/parser' - astro-eslint-parser @@ -3738,15 +3738,15 @@ snapshots: '@types/node': 22.7.4 optional: true - '@typescript-eslint/eslint-plugin@8.8.0(@typescript-eslint/parser@8.8.0(eslint@9.11.1(jiti@2.0.0))(typescript@5.6.2))(eslint@9.11.1(jiti@2.0.0))(typescript@5.6.2)': + '@typescript-eslint/eslint-plugin@8.8.0(@typescript-eslint/parser@8.8.0(eslint@9.11.1(jiti@2.1.0))(typescript@5.6.2))(eslint@9.11.1(jiti@2.1.0))(typescript@5.6.2)': dependencies: '@eslint-community/regexpp': 4.11.1 - '@typescript-eslint/parser': 8.8.0(eslint@9.11.1(jiti@2.0.0))(typescript@5.6.2) + '@typescript-eslint/parser': 8.8.0(eslint@9.11.1(jiti@2.1.0))(typescript@5.6.2) '@typescript-eslint/scope-manager': 8.8.0 - '@typescript-eslint/type-utils': 8.8.0(eslint@9.11.1(jiti@2.0.0))(typescript@5.6.2) - '@typescript-eslint/utils': 8.8.0(eslint@9.11.1(jiti@2.0.0))(typescript@5.6.2) + '@typescript-eslint/type-utils': 8.8.0(eslint@9.11.1(jiti@2.1.0))(typescript@5.6.2) + '@typescript-eslint/utils': 8.8.0(eslint@9.11.1(jiti@2.1.0))(typescript@5.6.2) '@typescript-eslint/visitor-keys': 8.8.0 - eslint: 9.11.1(jiti@2.0.0) + eslint: 9.11.1(jiti@2.1.0) graphemer: 1.4.0 ignore: 5.3.2 natural-compare: 1.4.0 @@ -3756,14 +3756,14 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/parser@8.8.0(eslint@9.11.1(jiti@2.0.0))(typescript@5.6.2)': + '@typescript-eslint/parser@8.8.0(eslint@9.11.1(jiti@2.1.0))(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.0.0) + eslint: 9.11.1(jiti@2.1.0) optionalDependencies: typescript: 5.6.2 transitivePeerDependencies: @@ -3774,10 +3774,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.0.0))(typescript@5.6.2)': + '@typescript-eslint/type-utils@8.8.0(eslint@9.11.1(jiti@2.1.0))(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.0.0))(typescript@5.6.2) + '@typescript-eslint/utils': 8.8.0(eslint@9.11.1(jiti@2.1.0))(typescript@5.6.2) debug: 4.3.7 ts-api-utils: 1.3.0(typescript@5.6.2) optionalDependencies: @@ -3803,13 +3803,13 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/utils@8.8.0(eslint@9.11.1(jiti@2.0.0))(typescript@5.6.2)': + '@typescript-eslint/utils@8.8.0(eslint@9.11.1(jiti@2.1.0))(typescript@5.6.2)': dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@9.11.1(jiti@2.0.0)) + '@eslint-community/eslint-utils': 4.4.0(eslint@9.11.1(jiti@2.1.0)) '@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.0.0) + eslint: 9.11.1(jiti@2.1.0) transitivePeerDependencies: - supports-color - typescript @@ -4605,17 +4605,17 @@ snapshots: optionalDependencies: source-map: 0.6.1 - eslint-compat-utils@0.5.1(eslint@9.11.1(jiti@2.0.0)): + eslint-compat-utils@0.5.1(eslint@9.11.1(jiti@2.1.0)): dependencies: - eslint: 9.11.1(jiti@2.0.0) + eslint: 9.11.1(jiti@2.1.0) semver: 7.6.3 - eslint-config-standard@17.1.0(eslint-plugin-import@2.30.0(@typescript-eslint/parser@8.8.0(eslint@9.11.1(jiti@2.0.0))(typescript@5.6.2))(eslint@9.11.1(jiti@2.0.0)))(eslint-plugin-n@17.10.3(eslint@9.11.1(jiti@2.0.0)))(eslint-plugin-promise@7.1.0(eslint@9.11.1(jiti@2.0.0)))(eslint@9.11.1(jiti@2.0.0)): + eslint-config-standard@17.1.0(eslint-plugin-import@2.30.0(@typescript-eslint/parser@8.8.0(eslint@9.11.1(jiti@2.1.0))(typescript@5.6.2))(eslint@9.11.1(jiti@2.1.0)))(eslint-plugin-n@17.10.3(eslint@9.11.1(jiti@2.1.0)))(eslint-plugin-promise@7.1.0(eslint@9.11.1(jiti@2.1.0)))(eslint@9.11.1(jiti@2.1.0)): dependencies: - eslint: 9.11.1(jiti@2.0.0) - eslint-plugin-import: 2.30.0(@typescript-eslint/parser@8.8.0(eslint@9.11.1(jiti@2.0.0))(typescript@5.6.2))(eslint@9.11.1(jiti@2.0.0)) - eslint-plugin-n: 17.10.3(eslint@9.11.1(jiti@2.0.0)) - eslint-plugin-promise: 7.1.0(eslint@9.11.1(jiti@2.0.0)) + eslint: 9.11.1(jiti@2.1.0) + eslint-plugin-import: 2.30.0(@typescript-eslint/parser@8.8.0(eslint@9.11.1(jiti@2.1.0))(typescript@5.6.2))(eslint@9.11.1(jiti@2.1.0)) + eslint-plugin-n: 17.10.3(eslint@9.11.1(jiti@2.1.0)) + eslint-plugin-promise: 7.1.0(eslint@9.11.1(jiti@2.1.0)) eslint-import-resolver-node@0.3.9: dependencies: @@ -4625,24 +4625,24 @@ snapshots: transitivePeerDependencies: - supports-color - eslint-module-utils@2.12.0(@typescript-eslint/parser@8.8.0(eslint@9.11.1(jiti@2.0.0))(typescript@5.6.2))(eslint-import-resolver-node@0.3.9)(eslint@9.11.1(jiti@2.0.0)): + eslint-module-utils@2.12.0(@typescript-eslint/parser@8.8.0(eslint@9.11.1(jiti@2.1.0))(typescript@5.6.2))(eslint-import-resolver-node@0.3.9)(eslint@9.11.1(jiti@2.1.0)): dependencies: debug: 3.2.7 optionalDependencies: - '@typescript-eslint/parser': 8.8.0(eslint@9.11.1(jiti@2.0.0))(typescript@5.6.2) - eslint: 9.11.1(jiti@2.0.0) + '@typescript-eslint/parser': 8.8.0(eslint@9.11.1(jiti@2.1.0))(typescript@5.6.2) + eslint: 9.11.1(jiti@2.1.0) eslint-import-resolver-node: 0.3.9 transitivePeerDependencies: - supports-color - eslint-plugin-es-x@7.8.0(eslint@9.11.1(jiti@2.0.0)): + eslint-plugin-es-x@7.8.0(eslint@9.11.1(jiti@2.1.0)): dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@9.11.1(jiti@2.0.0)) + '@eslint-community/eslint-utils': 4.4.0(eslint@9.11.1(jiti@2.1.0)) '@eslint-community/regexpp': 4.11.1 - eslint: 9.11.1(jiti@2.0.0) - eslint-compat-utils: 0.5.1(eslint@9.11.1(jiti@2.0.0)) + eslint: 9.11.1(jiti@2.1.0) + eslint-compat-utils: 0.5.1(eslint@9.11.1(jiti@2.1.0)) - eslint-plugin-import@2.30.0(@typescript-eslint/parser@8.8.0(eslint@9.11.1(jiti@2.0.0))(typescript@5.6.2))(eslint@9.11.1(jiti@2.0.0)): + eslint-plugin-import@2.30.0(@typescript-eslint/parser@8.8.0(eslint@9.11.1(jiti@2.1.0))(typescript@5.6.2))(eslint@9.11.1(jiti@2.1.0)): dependencies: '@rtsao/scc': 1.1.0 array-includes: 3.1.8 @@ -4651,9 +4651,9 @@ snapshots: array.prototype.flatmap: 1.3.2 debug: 3.2.7 doctrine: 2.1.0 - eslint: 9.11.1(jiti@2.0.0) + eslint: 9.11.1(jiti@2.1.0) eslint-import-resolver-node: 0.3.9 - eslint-module-utils: 2.12.0(@typescript-eslint/parser@8.8.0(eslint@9.11.1(jiti@2.0.0))(typescript@5.6.2))(eslint-import-resolver-node@0.3.9)(eslint@9.11.1(jiti@2.0.0)) + eslint-module-utils: 2.12.0(@typescript-eslint/parser@8.8.0(eslint@9.11.1(jiti@2.1.0))(typescript@5.6.2))(eslint-import-resolver-node@0.3.9)(eslint@9.11.1(jiti@2.1.0)) hasown: 2.0.2 is-core-module: 2.15.1 is-glob: 4.0.3 @@ -4664,29 +4664,29 @@ snapshots: semver: 6.3.1 tsconfig-paths: 3.15.0 optionalDependencies: - '@typescript-eslint/parser': 8.8.0(eslint@9.11.1(jiti@2.0.0))(typescript@5.6.2) + '@typescript-eslint/parser': 8.8.0(eslint@9.11.1(jiti@2.1.0))(typescript@5.6.2) transitivePeerDependencies: - eslint-import-resolver-typescript - eslint-import-resolver-webpack - supports-color - eslint-plugin-n@17.10.3(eslint@9.11.1(jiti@2.0.0)): + eslint-plugin-n@17.10.3(eslint@9.11.1(jiti@2.1.0)): dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@9.11.1(jiti@2.0.0)) + '@eslint-community/eslint-utils': 4.4.0(eslint@9.11.1(jiti@2.1.0)) enhanced-resolve: 5.17.1 - eslint: 9.11.1(jiti@2.0.0) - eslint-plugin-es-x: 7.8.0(eslint@9.11.1(jiti@2.0.0)) + eslint: 9.11.1(jiti@2.1.0) + eslint-plugin-es-x: 7.8.0(eslint@9.11.1(jiti@2.1.0)) get-tsconfig: 4.8.1 globals: 15.9.0 ignore: 5.3.2 minimatch: 9.0.5 semver: 7.6.3 - eslint-plugin-perfectionist@3.7.0(eslint@9.11.1(jiti@2.0.0))(typescript@5.6.2): + eslint-plugin-perfectionist@3.7.0(eslint@9.11.1(jiti@2.1.0))(typescript@5.6.2): dependencies: '@typescript-eslint/types': 8.8.0 - '@typescript-eslint/utils': 8.8.0(eslint@9.11.1(jiti@2.0.0))(typescript@5.6.2) - eslint: 9.11.1(jiti@2.0.0) + '@typescript-eslint/utils': 8.8.0(eslint@9.11.1(jiti@2.1.0))(typescript@5.6.2) + eslint: 9.11.1(jiti@2.1.0) minimatch: 9.0.5 natural-compare-lite: 1.4.0 transitivePeerDependencies: @@ -4697,9 +4697,9 @@ snapshots: dependencies: requireindex: 1.2.0 - eslint-plugin-promise@7.1.0(eslint@9.11.1(jiti@2.0.0)): + eslint-plugin-promise@7.1.0(eslint@9.11.1(jiti@2.1.0)): dependencies: - eslint: 9.11.1(jiti@2.0.0) + eslint: 9.11.1(jiti@2.1.0) eslint-scope@5.1.1: dependencies: @@ -4715,9 +4715,9 @@ snapshots: eslint-visitor-keys@4.1.0: {} - eslint@9.11.1(jiti@2.0.0): + eslint@9.11.1(jiti@2.1.0): dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@9.11.1(jiti@2.0.0)) + '@eslint-community/eslint-utils': 4.4.0(eslint@9.11.1(jiti@2.1.0)) '@eslint-community/regexpp': 4.11.1 '@eslint/config-array': 0.18.0 '@eslint/core': 0.6.0 @@ -4755,7 +4755,7 @@ snapshots: strip-ansi: 6.0.1 text-table: 0.2.0 optionalDependencies: - jiti: 2.0.0 + jiti: 2.1.0 transitivePeerDependencies: - supports-color @@ -5186,7 +5186,7 @@ snapshots: merge-stream: 2.0.0 supports-color: 8.1.1 - jiti@2.0.0: {} + jiti@2.1.0: {} jora@1.0.0-beta.8: dependencies: @@ -6081,11 +6081,11 @@ snapshots: is-typed-array: 1.1.13 possible-typed-array-names: 1.0.0 - typescript-eslint@8.8.0(eslint@9.11.1(jiti@2.0.0))(typescript@5.6.2): + typescript-eslint@8.8.0(eslint@9.11.1(jiti@2.1.0))(typescript@5.6.2): dependencies: - '@typescript-eslint/eslint-plugin': 8.8.0(@typescript-eslint/parser@8.8.0(eslint@9.11.1(jiti@2.0.0))(typescript@5.6.2))(eslint@9.11.1(jiti@2.0.0))(typescript@5.6.2) - '@typescript-eslint/parser': 8.8.0(eslint@9.11.1(jiti@2.0.0))(typescript@5.6.2) - '@typescript-eslint/utils': 8.8.0(eslint@9.11.1(jiti@2.0.0))(typescript@5.6.2) + '@typescript-eslint/eslint-plugin': 8.8.0(@typescript-eslint/parser@8.8.0(eslint@9.11.1(jiti@2.1.0))(typescript@5.6.2))(eslint@9.11.1(jiti@2.1.0))(typescript@5.6.2) + '@typescript-eslint/parser': 8.8.0(eslint@9.11.1(jiti@2.1.0))(typescript@5.6.2) + '@typescript-eslint/utils': 8.8.0(eslint@9.11.1(jiti@2.1.0))(typescript@5.6.2) optionalDependencies: typescript: 5.6.2 transitivePeerDependencies: