parent
0535454958
commit
a655ad4701
File diff suppressed because it is too large
Load Diff
|
@ -21,7 +21,7 @@
|
|||
"access": "public"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@parcel/watcher": "2.0.0-alpha.10",
|
||||
"@parcel/watcher": "2.0.3",
|
||||
"@types/debounce": "1.2.0",
|
||||
"@types/node": "14.14.34",
|
||||
"@types/vscode": "1.52.0",
|
||||
|
|
|
@ -35,7 +35,7 @@ import normalizePath from 'normalize-path'
|
|||
import * as path from 'path'
|
||||
import * as os from 'os'
|
||||
import * as fs from 'fs'
|
||||
import chokidar, { FSWatcher } from 'chokidar'
|
||||
import type * as chokidar from 'chokidar'
|
||||
import findUp from 'find-up'
|
||||
import minimatch from 'minimatch'
|
||||
import resolveFrom, { setPnpApi } from './util/resolveFrom'
|
||||
|
@ -247,7 +247,7 @@ async function createProjectService(
|
|||
const documentSettingsCache: Map<string, Settings> = new Map()
|
||||
let registrations: Promise<BulkUnregistration>
|
||||
|
||||
let chokidarWatcher: FSWatcher
|
||||
let chokidarWatcher: chokidar.FSWatcher
|
||||
let ignore = [
|
||||
'**/.git/objects/**',
|
||||
'**/.git/subtree-cache/**',
|
||||
|
@ -339,7 +339,8 @@ async function createProjectService(
|
|||
},
|
||||
})
|
||||
} else {
|
||||
chokidarWatcher = chokidar.watch([`**/${CONFIG_FILE_GLOB}`, '**/package.json'], {
|
||||
let watch: typeof chokidar.watch = require('chokidar').watch
|
||||
chokidarWatcher = watch([`**/${CONFIG_FILE_GLOB}`, '**/package.json'], {
|
||||
cwd: folder,
|
||||
ignorePermissionErrors: true,
|
||||
ignoreInitial: true,
|
||||
|
|
|
@ -12,6 +12,10 @@ const armv = process.env.ARM_VERSION || (arch === 'arm64' ? '8' : vars.arm_versi
|
|||
const uv = (process.versions.uv || '').split('.')[0]
|
||||
|
||||
const prebuilds = {
|
||||
'darwin-arm64': {
|
||||
'node.napi.glibc.node': () =>
|
||||
require('@parcel/watcher/prebuilds/darwin-arm64/node.napi.glibc.node'),
|
||||
},
|
||||
'darwin-x64': {
|
||||
'node.napi.glibc.node': () =>
|
||||
require('@parcel/watcher/prebuilds/darwin-x64/node.napi.glibc.node'),
|
||||
|
@ -68,9 +72,13 @@ exports.unsubscribe = (dir, fn, opts) => {
|
|||
}
|
||||
|
||||
function resolve() {
|
||||
// Find matching "prebuilds/<platform>-<arch>" directory
|
||||
var tuples = Object.keys(prebuilds).map(parseTuple)
|
||||
var tuple = tuples.filter(matchTuple(platform, arch)).sort(compareTuples)[0]
|
||||
if (!tuple) return
|
||||
|
||||
// Find most specific flavor first
|
||||
var list = prebuilds[platform + '-' + arch]
|
||||
if (!list) return
|
||||
var list = prebuilds[tuple.name]
|
||||
var builds = Object.keys(list)
|
||||
var parsed = builds.map(parseTags)
|
||||
var candidates = parsed.filter(matchTags(runtime, abi))
|
||||
|
@ -82,6 +90,34 @@ function resolve() {
|
|||
}
|
||||
}
|
||||
|
||||
function parseTuple(name) {
|
||||
// Example: darwin-x64+arm64
|
||||
var arr = name.split('-')
|
||||
if (arr.length !== 2) return
|
||||
|
||||
var platform = arr[0]
|
||||
var architectures = arr[1].split('+')
|
||||
|
||||
if (!platform) return
|
||||
if (!architectures.length) return
|
||||
if (!architectures.every(Boolean)) return
|
||||
|
||||
return { name, platform, architectures }
|
||||
}
|
||||
|
||||
function matchTuple(platform, arch) {
|
||||
return function (tuple) {
|
||||
if (tuple == null) return false
|
||||
if (tuple.platform !== platform) return false
|
||||
return tuple.architectures.includes(arch)
|
||||
}
|
||||
}
|
||||
|
||||
function compareTuples(a, b) {
|
||||
// Prefer single-arch prebuilds over multi-arch
|
||||
return a.architectures.length - b.architectures.length
|
||||
}
|
||||
|
||||
function parseTags(file) {
|
||||
var arr = file.split('.')
|
||||
var extension = arr.pop()
|
||||
|
|
Loading…
Reference in New Issue