Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
# Assume PRs are less than 50 commits
fetch-depth: 50
Expand Down Expand Up @@ -77,7 +77,7 @@ jobs:
name: "Build&Test: node-${{ matrix.node_version }}, ${{ matrix.os }}"
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false

Expand Down Expand Up @@ -152,7 +152,7 @@ jobs:
runs-on: ubuntu-latest
name: "Lint: node-24, ubuntu-latest"
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/copilot-setup-steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
contents: write
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/issue-close-require.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
issues: write # for actions/issues-helper to update issues
pull-requests: write # for actions/issues-helper to update PRs
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/issue-labeled.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
issues: write # for actions/issues-helper to update issues
pull-requests: write # for actions/issues-helper to update PRs
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/issue-template-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
template_type: ${{ steps.detect.outputs.template_type }}
skip: ${{ steps.detect.outputs.skip }}
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lock-closed-issues.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
if: github.repository == 'vitejs/vite'
runs-on: ubuntu-slim
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/preview-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
environment: Release
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pull-request-template-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
outputs:
agent_output: ${{ steps.agent.outputs.agent_output }}
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
permissions:
contents: write # for yyx990803/release-tag to create a release tag
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/zizmor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
permissions:
security-events: write # Required for upload-sarif (used by zizmor-action) to upload SARIF files.
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false

Expand Down
2 changes: 1 addition & 1 deletion docs/guide/static-deploy-github-pages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- name: Set up Node
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7
with:
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-legacy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"browserslist": "^4.28.6",
"browserslist-to-esbuild": "^2.1.1",
"core-js": "^3.49.0",
"magic-string": "^0.30.21",
"magic-string": "^1.0.0",
"regenerator-runtime": "^0.14.1",
"systemjs": "^6.15.1"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
"host-validation-middleware": "^0.1.4",
"http-proxy-3": "^1.23.3",
"launch-editor-middleware": "^2.14.1",
"magic-string": "^0.30.21",
"magic-string": "^1.0.0",
"mlly": "^1.8.2",
"mrmime": "^2.0.1",
"nanoid": "^5.1.16",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "@vitejs/test-native-compat-mts",
"type": "commonjs",
"private": true
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { defineConfig } from 'vite'

export default defineConfig({})
8 changes: 7 additions & 1 deletion packages/vite/src/node/nativeConfigCompat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,13 @@ export function createNativeConfigCompatPlugin(
return {
name: 'vite:native-config-compat-check',
transform: {
filter: { id: /\.[cm]?[jt]sx?$/ },
filter: {
id: {
include: /\.[cm]?[jt]sx?$/,
// exclude rolldown runtime
exclude: /^\0/,
},
},
async handler(code, id) {
const isESM =
typeof process.versions.deno === 'string' || isFilePathESM(id)
Expand Down
16 changes: 16 additions & 0 deletions packages/vite/src/node/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,13 @@ export function isFilePathESM(
return true
} else if (/\.c[jt]s$/.test(filePath)) {
return false
} else if (filePath.startsWith('\0')) {
// treat virtual modules as ESM
return true
} else if (!path.isAbsolute(filePath)) {
// should not rely on `process.cwd()` as that would depend on
// the environment and make it unreproducible
return false
} else {
// check package.json for type: "module"
try {
Expand All @@ -453,6 +460,15 @@ export function isFilePathFormatExplicit(
if (/\.[mc][jt]s$/.test(filePath)) {
return true
}
if (filePath.startsWith('\0')) {
// treat virtual modules as ESM
return true
}
if (!path.isAbsolute(filePath)) {
// should not rely on `process.cwd()` as that would depend on
// the environment and make it unreproducible
return false
}
try {
const pkg = findNearestPackageData(path.dirname(filePath), packageCache)
return pkg?.data.type === 'module' || pkg?.data.type === 'commonjs'
Expand Down
2 changes: 1 addition & 1 deletion playground/css-sourcemap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"devDependencies": {
"less": "^4.7.0",
"lightningcss": "^1.33.0",
"magic-string": "^0.30.21",
"magic-string": "^1.0.0",
"sass": "^1.101.0",
"stylus": "^0.64.0",
"sugarss": "^5.0.1"
Expand Down
2 changes: 1 addition & 1 deletion playground/js-sourcemap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@vitejs/test-dep-malicious-sourcemap": "file:dep-malicious-sourcemap",
"@vitejs/test-dep-optimized-malicious": "file:dep-optimized-malicious",
"@vitejs/test-importee-pkg": "file:importee-pkg",
"magic-string": "^0.30.21",
"magic-string": "^1.0.0",
"oxc-parser": "^0.139.0"
}
}
25 changes: 17 additions & 8 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading