Merge branch 'main' into handle-symbol-unscopables-access

This commit is contained in:
Ilya Golovin 2024-07-09 18:12:59 +07:00 committed by GitHub
commit 6998c896db
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
18 changed files with 1135 additions and 900 deletions

View File

@ -31,4 +31,4 @@ jobs:
- name: Run prettier
run: pnpm run format
- uses: autofix-ci/action@dd55f44df8f7cdb7a6bf74c78677eb8acd40cd0a
- uses: autofix-ci/action@2891949f3779a1cafafae1523058501de3d4e944

View File

@ -36,7 +36,7 @@ jobs:
run: pnpm install
- name: Download PR number
uses: dawidd6/action-download-artifact@v3
uses: dawidd6/action-download-artifact@v6
with:
name: pr-number
run_id: ${{ github.event.workflow_run.id }}

View File

@ -1,7 +1,7 @@
{
"private": true,
"version": "3.4.31",
"packageManager": "pnpm@9.4.0",
"packageManager": "pnpm@9.5.0",
"type": "module",
"scripts": {
"dev": "node scripts/dev.js",
@ -59,44 +59,41 @@
"node": ">=18.12.0"
},
"devDependencies": {
"@babel/parser": "^7.24.7",
"@babel/types": "^7.24.7",
"@babel/parser": "catalog:",
"@babel/types": "catalog:",
"@codspeed/vitest-plugin": "^3.1.0",
"@rollup/plugin-alias": "^5.1.0",
"@rollup/plugin-commonjs": "^25.0.8",
"@rollup/plugin-commonjs": "^26.0.1",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-replace": "5.0.4",
"@swc/core": "^1.6.5",
"@swc/core": "^1.6.13",
"@types/hash-sum": "^1.0.2",
"@types/minimist": "^1.2.5",
"@types/node": "^20.14.8",
"@types/node": "^20.14.10",
"@types/semver": "^7.5.8",
"@vitest/coverage-istanbul": "^1.6.0",
"@vue/consolidate": "1.0.0",
"conventional-changelog-cli": "^4.1.0",
"enquirer": "^2.4.1",
"esbuild": "^0.21.5",
"esbuild": "^0.23.0",
"esbuild-plugin-polyfill-node": "^0.3.0",
"eslint": "^9.5.0",
"eslint-plugin-import-x": "^0.5.1",
"eslint": "^9.6.0",
"eslint-plugin-import-x": "^0.5.3",
"eslint-plugin-vitest": "^0.5.4",
"estree-walker": "^2.0.2",
"execa": "^9.3.0",
"jsdom": "^24.1.0",
"lint-staged": "^15.2.7",
"lodash": "^4.17.21",
"magic-string": "^0.30.10",
"markdown-table": "^3.0.3",
"marked": "^12.0.2",
"minimist": "^1.2.8",
"npm-run-all2": "^6.2.0",
"npm-run-all2": "^6.2.2",
"picocolors": "^1.0.1",
"prettier": "^3.3.2",
"pretty-bytes": "^6.1.1",
"pug": "^3.0.3",
"puppeteer": "~22.12.0",
"rimraf": "^5.0.7",
"puppeteer": "~22.12.1",
"rimraf": "^5.0.8",
"rollup": "^4.18.0",
"rollup-plugin-dts": "^6.1.1",
"rollup-plugin-esbuild": "^6.1.1",
@ -107,10 +104,10 @@
"terser": "^5.31.1",
"todomvc-app-css": "^2.4.3",
"tslib": "^2.6.3",
"tsx": "^4.15.7",
"tsx": "^4.16.2",
"typescript": "~5.4.5",
"typescript-eslint": "^7.13.1",
"vite": "^5.3.1",
"typescript-eslint": "^7.15.0",
"vite": "catalog:",
"vitest": "^1.6.0"
},
"pnpm": {

View File

@ -46,13 +46,13 @@
},
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-core#readme",
"dependencies": {
"@babel/parser": "^7.24.7",
"@babel/parser": "catalog:",
"@vue/shared": "workspace:*",
"entities": "^4.5.0",
"estree-walker": "^2.0.2",
"source-map-js": "^1.2.0"
"estree-walker": "catalog:",
"source-map-js": "catalog:"
},
"devDependencies": {
"@babel/types": "^7.24.7"
"@babel/types": "catalog:"
}
}

View File

@ -42,23 +42,23 @@
},
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-sfc#readme",
"dependencies": {
"@babel/parser": "^7.24.7",
"@babel/parser": "catalog:",
"@vue/compiler-core": "workspace:*",
"@vue/compiler-dom": "workspace:*",
"@vue/compiler-ssr": "workspace:*",
"@vue/shared": "workspace:*",
"estree-walker": "^2.0.2",
"magic-string": "^0.30.10",
"postcss": "^8.4.38",
"source-map-js": "^1.2.0"
"estree-walker": "catalog:",
"magic-string": "catalog:",
"postcss": "^8.4.39",
"source-map-js": "catalog:"
},
"devDependencies": {
"@babel/types": "^7.24.7",
"@babel/types": "catalog:",
"@vue/consolidate": "^1.0.0",
"hash-sum": "^2.0.0",
"lru-cache": "10.1.0",
"merge-source-map": "^1.1.0",
"minimatch": "^9.0.4",
"minimatch": "^9.0.5",
"postcss-modules": "^6.0.0",
"postcss-selector-parser": "^6.1.0",
"pug": "^3.0.3",

View File

@ -10,10 +10,10 @@
},
"devDependencies": {
"@vitejs/plugin-vue": "^5.0.5",
"vite": "^5.3.1"
"vite": "catalog:"
},
"dependencies": {
"@vue/repl": "^4.2.1",
"@vue/repl": "^4.3.1",
"file-saver": "^2.0.5",
"jszip": "^3.10.1",
"vue": "workspace:*"

View File

@ -12,6 +12,6 @@
},
"devDependencies": {
"@vitejs/plugin-vue": "^5.0.5",
"vite": "^5.3.1"
"vite": "^5.3.3"
}
}

View File

@ -2,9 +2,11 @@ import fs from 'node:fs'
import path from 'node:path'
import { type Plugin, defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { execaSync } from 'execa'
import { spawnSync } from 'node:child_process'
const commit = execaSync('git', ['rev-parse', '--short=7', 'HEAD']).stdout
const commit = spawnSync('git', ['rev-parse', '--short=7', 'HEAD'])
.stdout.toString()
.trim()
export default defineConfig({
plugins: [

View File

@ -52,9 +52,9 @@
},
"homepage": "https://github.com/vuejs/core/tree/main/packages/vue-compat#readme",
"dependencies": {
"@babel/parser": "^7.24.7",
"estree-walker": "^2.0.2",
"source-map-js": "^1.2.0"
"@babel/parser": "catalog:",
"estree-walker": "catalog:",
"source-map-js": "catalog:"
},
"peerDependencies": {
"vue": "workspace:*"

View File

@ -14,7 +14,7 @@
- Contains hard-coded prod/dev branches, and the prod build is pre-minified. Use the `*.prod.js` files for production.
- **`vue(.runtime).esm-browser(.prod).js`**:
- For usage via native ES modules imports (in browser via `<script type="module">`.
- For usage via native ES modules imports (in browser via `<script type="module">`).
- Shares the same runtime compilation, dependency inlining and hard-coded prod/dev behavior with the global build.
### With a Bundler

File diff suppressed because it is too large Load Diff

View File

@ -1,2 +1,10 @@
packages:
- 'packages/*'
catalog:
'@babel/parser': ^7.24.7
'@babel/types': ^7.2.47
'estree-walker': ^2.0.2
'magic-string': ^0.30.10
'source-map-js': ^1.2.0
'vite': ^5.3.3

View File

@ -17,31 +17,67 @@ nr build core --formats cjs
*/
import fs from 'node:fs/promises'
import { existsSync } from 'node:fs'
import { parseArgs } from 'node:util'
import { existsSync, readFileSync } from 'node:fs'
import path from 'node:path'
import minimist from 'minimist'
import { brotliCompressSync, gzipSync } from 'node:zlib'
import pico from 'picocolors'
import { execa, execaSync } from 'execa'
import { cpus } from 'node:os'
import { createRequire } from 'node:module'
import { targets as allTargets, fuzzyMatchTarget } from './utils.js'
import { targets as allTargets, exec, fuzzyMatchTarget } from './utils.js'
import { scanEnums } from './inline-enums.js'
import prettyBytes from 'pretty-bytes'
import { spawnSync } from 'node:child_process'
const require = createRequire(import.meta.url)
const args = minimist(process.argv.slice(2))
const targets = args._
const formats = args.formats || args.f
const devOnly = args.devOnly || args.d
const prodOnly = !devOnly && (args.prodOnly || args.p)
const buildTypes = args.withTypes || args.t
const sourceMap = args.sourcemap || args.s
const isRelease = args.release
/** @type {boolean | undefined} */
const buildAllMatching = args.all || args.a
const writeSize = args.size
const commit = execaSync('git', ['rev-parse', '--short=7', 'HEAD']).stdout
const commit = spawnSync('git', ['rev-parse', '--short=7', 'HEAD'])
.stdout.toString()
.trim()
const { values, positionals: targets } = parseArgs({
allowPositionals: true,
options: {
formats: {
type: 'string',
short: 'f',
},
devOnly: {
type: 'boolean',
short: 'd',
},
prodOnly: {
type: 'boolean',
short: 'p',
},
withTypes: {
type: 'boolean',
short: 't',
},
sourceMap: {
type: 'boolean',
short: 's',
},
release: {
type: 'boolean',
},
all: {
type: 'boolean',
short: 'a',
},
size: {
type: 'boolean',
},
},
})
const {
formats,
all: buildAllMatching,
devOnly,
prodOnly,
withTypes: buildTypes,
sourceMap,
release: isRelease,
size: writeSize,
} = values
const sizeDir = path.resolve('temp/size')
@ -57,7 +93,7 @@ async function run() {
await buildAll(resolvedTargets)
await checkAllSizes(resolvedTargets)
if (buildTypes) {
await execa(
await exec(
'pnpm',
[
'run',
@ -114,6 +150,7 @@ async function runParallel(maxConcurrency, source, iteratorFn) {
}
return Promise.all(ret)
}
/**
* Builds the target.
* @param {string} target - The target to build.
@ -121,7 +158,7 @@ async function runParallel(maxConcurrency, source, iteratorFn) {
*/
async function build(target) {
const pkgDir = path.resolve(`packages/${target}`)
const pkg = require(`${pkgDir}/package.json`)
const pkg = JSON.parse(readFileSync(`${pkgDir}/package.json`, 'utf-8'))
// if this is a full build (no specific targets), ignore private packages
if ((isRelease || !targets.length) && pkg.private) {
@ -136,7 +173,8 @@ async function build(target) {
const env =
(pkg.buildOptions && pkg.buildOptions.env) ||
(devOnly ? 'development' : 'production')
await execa(
await exec(
'rollup',
[
'-c',

View File

@ -8,16 +8,38 @@ import esbuild from 'esbuild'
import { dirname, relative, resolve } from 'node:path'
import { fileURLToPath } from 'node:url'
import { createRequire } from 'node:module'
import minimist from 'minimist'
import { parseArgs } from 'node:util'
import { polyfillNode } from 'esbuild-plugin-polyfill-node'
const require = createRequire(import.meta.url)
const __dirname = dirname(fileURLToPath(import.meta.url))
const args = minimist(process.argv.slice(2))
const targets = args._.length ? args._ : ['vue']
const format = args.f || 'global'
const prod = args.p || false
const inlineDeps = args.i || args.inline
const {
values: { format: rawFormat, prod, inline: inlineDeps },
positionals,
} = parseArgs({
allowPositionals: true,
options: {
format: {
type: 'string',
short: 'f',
default: 'global',
},
prod: {
type: 'boolean',
short: 'p',
default: false,
},
inline: {
type: 'boolean',
short: 'i',
default: false,
},
},
})
const format = rawFormat || 'global'
const targets = positionals.length ? positionals : ['vue']
// resolve output
const outputFormat = format.startsWith('global')

View File

@ -21,7 +21,7 @@ import {
} from 'node:fs'
import * as path from 'node:path'
import { parse } from '@babel/parser'
import { execaSync } from 'execa'
import { spawnSync } from 'node:child_process'
import MagicString from 'magic-string'
/**
@ -49,8 +49,16 @@ export function scanEnums() {
const defines = Object.create(null)
// 1. grep for files with exported enum
const { stdout } = execaSync('git', ['grep', `export enum`])
const files = [...new Set(stdout.split('\n').map(line => line.split(':')[0]))]
const { stdout } = spawnSync('git', ['grep', `export enum`])
const files = [
...new Set(
stdout
.toString()
.trim()
.split('\n')
.map(line => line.split(':')[0]),
),
]
// 2. parse matched files to collect enum info
for (const relativeFile of files) {

View File

@ -1,13 +1,13 @@
// @ts-check
import minimist from 'minimist'
import fs from 'node:fs'
import path from 'node:path'
import pico from 'picocolors'
import semver from 'semver'
import enquirer from 'enquirer'
import { execa } from 'execa'
import { createRequire } from 'node:module'
import { fileURLToPath } from 'node:url'
import { exec } from './utils.js'
import { parseArgs } from 'node:util'
/**
* @typedef {{
@ -23,12 +23,34 @@ let versionUpdated = false
const { prompt } = enquirer
const currentVersion = createRequire(import.meta.url)('../package.json').version
const __dirname = path.dirname(fileURLToPath(import.meta.url))
const args = minimist(process.argv.slice(2), {
alias: {
skipBuild: 'skip-build',
skipTests: 'skip-tests',
skipGit: 'skip-git',
skipPrompts: 'skip-prompts',
const { values: args, positionals } = parseArgs({
allowPositionals: true,
options: {
preid: {
type: 'string',
},
dry: {
type: 'boolean',
},
tag: {
type: 'string',
},
canary: {
type: 'boolean',
},
skipBuild: {
type: 'boolean',
},
skipTests: {
type: 'boolean',
},
skipGit: {
type: 'boolean',
},
skipPrompts: {
type: 'boolean',
},
},
})
@ -94,16 +116,16 @@ const versionIncrements = [
]
const inc = (/** @type {import('semver').ReleaseType} */ i) =>
semver.inc(currentVersion, i, preId)
semver.inc(currentVersion, i, typeof preId === 'string' ? preId : undefined)
const run = async (
/** @type {string} */ bin,
/** @type {ReadonlyArray<string>} */ args,
/** @type {import('execa').Options} */ opts = {},
) => execa(bin, args, { stdio: 'inherit', ...opts })
/** @type {import('node:child_process').SpawnOptions} */ opts = {},
) => exec(bin, args, { stdio: 'inherit', ...opts })
const dryRun = async (
/** @type {string} */ bin,
/** @type {ReadonlyArray<string>} */ args,
/** @type {import('execa').Options} */ opts = {},
/** @type {import('node:child_process').SpawnOptions} */ opts = {},
) => console.log(pico.blue(`[dryrun] ${bin} ${args.join(' ')}`), opts)
const runIfNotDry = isDryRun ? dryRun : run
const getPkgRoot = (/** @type {string} */ pkg) =>
@ -117,7 +139,7 @@ async function main() {
console.log(`${pico.green(``)} commit is up-to-date with remote.\n`)
}
let targetVersion = args._[0]
let targetVersion = positionals[0]
if (isCanary) {
// The canary version string format is `3.yyyyMMdd.0` (or `3.yyyyMMdd.0-minor.0` for minor)
@ -392,11 +414,11 @@ async function isInSyncWithRemote() {
}
async function getSha() {
return (await execa('git', ['rev-parse', 'HEAD'])).stdout
return (await exec('git', ['rev-parse', 'HEAD'])).stdout
}
async function getBranch() {
return (await execa('git', ['rev-parse', '--abbrev-ref', 'HEAD'])).stdout
return (await exec('git', ['rev-parse', '--abbrev-ref', 'HEAD'])).stdout
}
/**

View File

@ -2,6 +2,7 @@
import fs from 'node:fs'
import pico from 'picocolors'
import { createRequire } from 'node:module'
import { spawn } from 'node:child_process'
const require = createRequire(import.meta.url)
@ -51,3 +52,50 @@ export function fuzzyMatchTarget(partialTargets, includeAllMatching) {
process.exit(1)
}
}
/**
* @param {string} command
* @param {ReadonlyArray<string>} args
* @param {object} [options]
*/
export async function exec(command, args, options) {
return new Promise((resolve, reject) => {
const process = spawn(command, args, {
stdio: [
'ignore', // stdin
'pipe', // stdout
'pipe', // stderr
],
...options,
})
/**
* @type {Buffer[]}
*/
const stderrChunks = []
/**
* @type {Buffer[]}
*/
const stdoutChunks = []
process.stderr?.on('data', chunk => {
stderrChunks.push(chunk)
})
process.stdout?.on('data', chunk => {
stdoutChunks.push(chunk)
})
process.on('error', error => {
reject(error)
})
process.on('exit', code => {
const ok = code === 0
const stderr = Buffer.concat(stderrChunks).toString().trim()
const stdout = Buffer.concat(stdoutChunks).toString().trim()
const result = { ok, code, stderr, stdout }
resolve(result)
})
})
}

View File

@ -1,8 +1,8 @@
// @ts-check
import fs from 'node:fs'
import { execa } from 'execa'
import { exec } from './utils.js'
execa('pnpm', ['build', 'vue', '-f', 'global-runtime']).then(() => {
exec('pnpm', ['build', 'vue', '-f', 'global-runtime']).then(() => {
const errors = []
const devBuild = fs.readFileSync(