Skip to content

Commit

Permalink
use import.meta.resolve
Browse files Browse the repository at this point in the history
requires node v20.6+
  • Loading branch information
nobkd committed Feb 6, 2025
1 parent fa3a241 commit 742f41f
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ jobs:

# Testing `node+jest`
- uses: actions/setup-node@v4
with:
node-version: '>= 20.6'
if: ${{ matrix.tool == 'node+jest' }}

- name: Install and test with Node
Expand Down
Binary file modified bun.lockb
Binary file not shown.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
],
"engines": {
"bun": ">=1",
"node": ">=18"
"node": ">=20.6"
},
"scripts": {
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js --runInBand"
Expand Down
3 changes: 1 addition & 2 deletions packages/nuekit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,14 @@
},
"engines": {
"bun": ">= 1",
"node": ">= 18"
"node": ">= 20.6"
},
"scripts": {
"test": "node --experimental-vm-modules ../../node_modules/jest/bin/jest.js --runInBand"
},
"dependencies": {
"diff-dom": "^5.1.4",
"es-main": "^1.3.0",
"import-meta-resolve": "^4.1.0",
"js-yaml": "^4.1.0",
"lightningcss": "^1.27.0",
"nue-glow": "*",
Expand Down
3 changes: 1 addition & 2 deletions packages/nuekit/src/builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import { promises as fs } from 'node:fs'
import { join } from 'node:path'

import { resolve } from 'import-meta-resolve'
import { Features, bundleAsync } from 'lightningcss'

// don't reuse saved builder when in test mode
Expand All @@ -14,7 +13,7 @@ export async function getBuilder(is_esbuild) {
if (!isTest && jsBuilder) return jsBuilder

try {
return jsBuilder = is_esbuild ? await import(resolve('esbuild', `file://${process.cwd()}/`)) : Bun
return jsBuilder = is_esbuild ? await import(import.meta.resolve('esbuild')) : Bun
} catch {
throw 'Bundler not found. Please use Bun or install esbuild'
}
Expand Down
3 changes: 1 addition & 2 deletions packages/nuekit/src/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { promises as fs, existsSync } from 'node:fs'
import { dirname, join } from 'node:path'
import { fileURLToPath } from 'node:url'

import { resolve } from 'import-meta-resolve'
import { compileFile as nueCompile } from 'nuejs-core'

import { buildJS } from './builder.js'
Expand Down Expand Up @@ -91,6 +90,6 @@ async function initDir({ dist, is_dev, esbuild, cwd, srcdir, outdir }) {

function resolvePath(npm_path) {
const [npm_name, ...parts] = npm_path.split('/')
const module_path = dirname(fileURLToPath(resolve(npm_name, import.meta.url)))
const module_path = dirname(fileURLToPath(import.meta.resolve(npm_name)))
return join(module_path, ...parts)
}

0 comments on commit 742f41f

Please sign in to comment.