Skip to content

Commit

Permalink
chore: use node: protocol when importing built-in modules (rolldown#470)
Browse files Browse the repository at this point in the history
  • Loading branch information
liuseen-l committed Mar 8, 2024
1 parent 5319aa7 commit b32ad92
Show file tree
Hide file tree
Showing 16 changed files with 21 additions and 22 deletions.
2 changes: 1 addition & 1 deletion examples/basic-vue/build.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// https://github.com/tinylibs/tinybench
import path from 'node:path'
import url from 'url'
import url from 'node:url'
import * as rolldown from '@rolldown/node'

const dirname = path.dirname(url.fileURLToPath(import.meta.url))
Expand Down
2 changes: 1 addition & 1 deletion packages/bench/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// https://github.com/tinylibs/tinybench
import { Bench } from 'tinybench'
import path from 'node:path'
import url from 'url'
import url from 'node:url'
import * as rolldown from '@rolldown/node'
import * as esbuild from 'esbuild'

Expand Down
2 changes: 1 addition & 1 deletion packages/node/src/options/input-options-adapter.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { NormalizedInputOptions } from '../rollup-types'
import { InputOptions as BindingInputOptions } from '@rolldown/node-binding'
import path from 'path'
import path from 'node:path'
import { createBuildPluginAdapter } from './create-build-plugin-adapter'
import { InputOptions, RolldownNormalizedInputOptions } from './input-options'

Expand Down
2 changes: 1 addition & 1 deletion packages/node/test/cases/external/function/config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { RollupOptions, RollupOutput } from '@rolldown/node'
import { expect } from 'vitest'
import path from 'path'
import path from 'node:path'

const config: RollupOptions = {
external: (
Expand Down
2 changes: 1 addition & 1 deletion packages/node/test/cases/input/array/config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { RollupOptions, RollupOutput } from '@rolldown/node'
import path from 'path'
import path from 'node:path'
import { expect } from 'vitest'
import { getOutputChunkNames } from '../../../util'

Expand Down
2 changes: 1 addition & 1 deletion packages/node/test/cases/input/object/config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { RollupOptions, RollupOutput } from '@rolldown/node'
import path from 'path'
import path from 'node:path'
import { expect } from 'vitest'
import { getOutputChunkNames } from '../../../util'

Expand Down
2 changes: 1 addition & 1 deletion packages/node/test/cases/input/string/config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { RollupOptions, RollupOutput } from '@rolldown/node'
import path from 'path'
import path from 'node:path'
import { expect } from 'vitest'
import { getOutputChunkNames } from '../../../util'

Expand Down
2 changes: 1 addition & 1 deletion packages/node/test/cases/plugin/generate-bundle/config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { RollupOptions, RollupOutput } from '@rolldown/node'
import { expect, vi } from 'vitest'
import path from 'path'
import path from 'node:path'
import { OutputChunk } from 'rollup'

const entry = path.join(__dirname, './main.js')
Expand Down
2 changes: 1 addition & 1 deletion packages/node/test/cases/plugin/render-chunk/config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { RollupOptions, RollupOutput } from '@rolldown/node'
import { expect, vi } from 'vitest'
import path from 'path'
import path from 'node:path'

const entry = path.join(__dirname, './main.js')

Expand Down
2 changes: 1 addition & 1 deletion packages/node/test/cases/plugin/resolve-id/config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { RollupOptions, RollupOutput } from '@rolldown/node'
import { expect, vi } from 'vitest'
import path from 'path'
import path from 'node:path'

const entry = path.join(__dirname, './main.js')

Expand Down
2 changes: 1 addition & 1 deletion packages/node/test/cases/plugin/write-bundle/config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { RollupOptions, RollupOutput } from '@rolldown/node'
import { expect, vi } from 'vitest'
import path from 'path'
import path from 'node:path'
import { OutputChunk } from 'rollup'

const entry = path.join(__dirname, './main.js')
Expand Down
1 change: 0 additions & 1 deletion packages/node/test/cases/resolve/alias/config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { RollupOptions } from '@rolldown/node'
import path from 'path'

const config: RollupOptions = {
resolve: {
Expand Down
4 changes: 2 additions & 2 deletions packages/node/test/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import {
RollupOptions,
rolldown,
} from '@rolldown/node'
import path from 'path'
import fs from 'fs'
import path from 'node:path'
import fs from 'node:fs'

runCases()

Expand Down
6 changes: 3 additions & 3 deletions scripts/build-node-binding.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

import { execa } from 'execa'
import watcher from '@parcel/watcher'
import path from 'path'
import path from 'node:path'
import crypto from 'crypto'
import fs from 'fs'
import fs from 'node:fs'
import fsp from 'fs/promises'
import debug from 'debug'
import chalk from 'chalk'
import { fileURLToPath } from 'url'
import { fileURLToPath } from 'node:url'

if (!process.env.DEBUG) {
debug.enable('rolldown')
Expand Down
4 changes: 2 additions & 2 deletions scripts/gen-esbuild-test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const Parser = require('tree-sitter')
const Go = require('tree-sitter-go')
const fs = require('fs-extra')
const path = require('path')
const path = require('node:path')
const changeCase = require('change-case')
const chalk = require('chalk')
const dedent = require('dedent')
Expand Down Expand Up @@ -261,7 +261,7 @@ function processEntryPath(node, binding) {
/**
* @param {import('tree-sitter').SyntaxNode} node
*/
function processOptions(node) {}
function processOptions(node) { }

/**
* @param {import('tree-sitter').SyntaxNode} node
Expand Down
6 changes: 3 additions & 3 deletions scripts/post-version.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const fs = require('fs')
const path = require('path')
const { execSync } = require('child_process')
const fs = require('node:fs')
const path = require('node:path')
const { execSync } = require('node:child_process')

// The `lerna version` command don't update the root package.json version,
// We use it to generate changelog, so here update it by packages version.
Expand Down

0 comments on commit b32ad92

Please sign in to comment.