Commit 061f93c9 by weiyudumei

feat: 添加@rspack相关包到本地packages

parent 6ea2de6f
MIT License
Copyright (c) 2022-present Bytedance, Inc. and its affiliates.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://assets.rspack.dev/rspack/rspack-banner-plain-dark.png">
<img alt="Rspack Banner" src="https://assets.rspack.dev/rspack/rspack-banner-plain-light.png">
</picture>
# @rspack/binding
Private node binding crate for rspack.
> Rspack's internal package, don't use it directly in your project, This package does *NOT* follow [semantic versioning](https://semver.org/).
## Documentation
See [https://rspack.dev](https://rspack.dev) for details.
## License
Rspack is [MIT licensed](https://github.com/web-infra-dev/rspack/blob/main/LICENSE).
const { existsSync, readFileSync } = require('fs')
const { join } = require('path')
const { platform, arch } = process
let nativeBinding = null
let localFileExisted = false
let loadError = null
function isMusl() {
// For Node 10
if (!process.report || typeof process.report.getReport !== 'function') {
try {
const lddPath = require('child_process').execSync('which ldd').toString().trim();
return readFileSync(lddPath, 'utf8').includes('musl')
} catch (e) {
return true
}
} else {
const { glibcVersionRuntime } = process.report.getReport().header
return !glibcVersionRuntime
}
}
switch (platform) {
case 'android':
switch (arch) {
case 'arm64':
localFileExisted = existsSync(join(__dirname, 'rspack.android-arm64.node'))
try {
if (localFileExisted) {
nativeBinding = require('./rspack.android-arm64.node')
} else {
nativeBinding = require('@rspack/binding-android-arm64')
}
} catch (e) {
loadError = e
}
break
case 'arm':
localFileExisted = existsSync(join(__dirname, 'rspack.android-arm-eabi.node'))
try {
if (localFileExisted) {
nativeBinding = require('./rspack.android-arm-eabi.node')
} else {
nativeBinding = require('@rspack/binding-android-arm-eabi')
}
} catch (e) {
loadError = e
}
break
default:
throw new Error(`Unsupported architecture on Android ${arch}`)
}
break
case 'win32':
switch (arch) {
case 'x64':
localFileExisted = existsSync(join(__dirname, 'rspack.win32-x64-msvc.node'))
try {
if (localFileExisted) {
nativeBinding = require('./rspack.win32-x64-msvc.node')
} else {
nativeBinding = require('@rspack/binding-win32-x64-msvc')
}
} catch (e) {
loadError = e
}
break
case 'ia32':
localFileExisted = existsSync(join(__dirname, 'rspack.win32-ia32-msvc.node'))
try {
if (localFileExisted) {
nativeBinding = require('./rspack.win32-ia32-msvc.node')
} else {
nativeBinding = require('@rspack/binding-win32-ia32-msvc')
}
} catch (e) {
loadError = e
}
break
case 'arm64':
localFileExisted = existsSync(join(__dirname, 'rspack.win32-arm64-msvc.node'))
try {
if (localFileExisted) {
nativeBinding = require('./rspack.win32-arm64-msvc.node')
} else {
nativeBinding = require('@rspack/binding-win32-arm64-msvc')
}
} catch (e) {
loadError = e
}
break
default:
throw new Error(`Unsupported architecture on Windows: ${arch}`)
}
break
case 'darwin':
switch (arch) {
case 'x64':
localFileExisted = existsSync(join(__dirname, 'rspack.darwin-x64.node'))
try {
if (localFileExisted) {
nativeBinding = require('./rspack.darwin-x64.node')
} else {
nativeBinding = require('@rspack/binding-darwin-x64')
}
} catch (e) {
loadError = e
}
break
case 'arm64':
localFileExisted = existsSync(join(__dirname, 'rspack.darwin-arm64.node'))
try {
if (localFileExisted) {
nativeBinding = require('./rspack.darwin-arm64.node')
} else {
nativeBinding = require('@rspack/binding-darwin-arm64')
}
} catch (e) {
loadError = e
}
break
default:
throw new Error(`Unsupported architecture on macOS: ${arch}`)
}
break
case 'freebsd':
if (arch !== 'x64') {
throw new Error(`Unsupported architecture on FreeBSD: ${arch}`)
}
localFileExisted = existsSync(join(__dirname, 'rspack.freebsd-x64.node'))
try {
if (localFileExisted) {
nativeBinding = require('./rspack.freebsd-x64.node')
} else {
nativeBinding = require('@rspack/binding-freebsd-x64')
}
} catch (e) {
loadError = e
}
break
case 'linux':
switch (arch) {
case 'x64':
if (isMusl()) {
localFileExisted = existsSync(join(__dirname, 'rspack.linux-x64-musl.node'))
try {
if (localFileExisted) {
nativeBinding = require('./rspack.linux-x64-musl.node')
} else {
nativeBinding = require('@rspack/binding-linux-x64-musl')
}
} catch (e) {
loadError = e
}
} else {
localFileExisted = existsSync(join(__dirname, 'rspack.linux-x64-gnu.node'))
try {
if (localFileExisted) {
nativeBinding = require('./rspack.linux-x64-gnu.node')
} else {
nativeBinding = require('@rspack/binding-linux-x64-gnu')
}
} catch (e) {
loadError = e
}
}
break
case 'arm64':
if (isMusl()) {
localFileExisted = existsSync(join(__dirname, 'rspack.linux-arm64-musl.node'))
try {
if (localFileExisted) {
nativeBinding = require('./rspack.linux-arm64-musl.node')
} else {
nativeBinding = require('@rspack/binding-linux-arm64-musl')
}
} catch (e) {
loadError = e
}
} else {
localFileExisted = existsSync(join(__dirname, 'rspack.linux-arm64-gnu.node'))
try {
if (localFileExisted) {
nativeBinding = require('./rspack.linux-arm64-gnu.node')
} else {
nativeBinding = require('@rspack/binding-linux-arm64-gnu')
}
} catch (e) {
loadError = e
}
}
break
case 'arm':
localFileExisted = existsSync(join(__dirname, 'rspack.linux-arm-gnueabihf.node'))
try {
if (localFileExisted) {
nativeBinding = require('./rspack.linux-arm-gnueabihf.node')
} else {
nativeBinding = require('@rspack/binding-linux-arm-gnueabihf')
}
} catch (e) {
loadError = e
}
break
default:
throw new Error(`Unsupported architecture on Linux: ${arch}`)
}
break
default:
throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`)
}
if (!nativeBinding) {
if (loadError) {
throw loadError
}
throw new Error(`Failed to load native binding`)
}
module.exports.default = module.exports = nativeBinding
{
"name": "@rspack/binding",
"version": "1.0.0-beta.1",
"license": "MIT",
"description": "Node binding for rspack",
"main": "binding.js",
"types": "binding.d.ts",
"publishConfig": {
"access": "public",
"provenance": true
},
"files": [
"binding.js",
"binding.d.ts"
],
"homepage": "https://rspack.dev",
"bugs": "https://github.com/web-infra-dev/rspack/issues",
"repository": "web-infra-dev/rspack",
"devDependencies": {
"@napi-rs/cli": "3.0.0-alpha.45",
"typescript": "5.0.2"
},
"napi": {
"binaryName": "rspack"
},
"optionalDependencies": {
"@rspack/binding-darwin-arm64": "1.0.0-beta.1",
"@rspack/binding-win32-arm64-msvc": "1.0.0-beta.1",
"@rspack/binding-linux-arm64-gnu": "1.0.0-beta.1",
"@rspack/binding-linux-arm64-musl": "1.0.0-beta.1",
"@rspack/binding-win32-ia32-msvc": "1.0.0-beta.1",
"@rspack/binding-linux-x64-gnu": "1.0.0-beta.1",
"@rspack/binding-linux-x64-musl": "1.0.0-beta.1",
"@rspack/binding-win32-x64-msvc": "1.0.0-beta.1",
"@rspack/binding-darwin-x64": "1.0.0-beta.1"
},
"scripts": {
"build:debug": "node scripts/build.js",
"watch:debug": "node scripts/build.js --watch",
"build:debug:x64": "cross-env RUST_TARGET=x86_64-apple-darwin node scripts/build.js",
"build:debug:linux": "cross-env RUST_TARGET=x86_64-unknown-linux-gnu node scripts/build.js",
"build:release:all": "run-p build:release:arm64 build:release:x64 build:release:linux && pnpm move-binding",
"build:release": "node scripts/build.js --release",
"watch:release": "node scripts/build.js --release --watch",
"build:release:arm64": "cross-env RUST_TARGET=aarch64-apple-darwin node scripts/build.js --release",
"build:release:x64": "cross-env RUST_TARGET=x86_64-apple-darwin node scripts/build.js --release",
"build:release:linux": "cross-env RUST_TARGET=x86_64-unknown-linux-gnu node scripts/build.js --release",
"build:release:musl": "cross-env RUST_TARGET=aarch64-unknown-linux-musl node scripts/build.js --release",
"build:release:win": "cross-env RUST_TARGET=x86_64-pc-windows-msvc node scripts/build.js --release",
"build:release-prod:all": "run-p build:release-prod:arm64 build:release-prod:x64 build:release-prod:linux && pnpm move-binding",
"build:release-prod": "node scripts/build.js --release-prod",
"watch:release-prod": "node scripts/build.js --release-prod --watch",
"build:release-prod:arm64": "cross-env RUST_TARGET=aarch64-apple-darwin node scripts/build.js --release-prod",
"build:release-prod:x64": "cross-env RUST_TARGET=x86_64-apple-darwin node scripts/build.js --release-prod",
"build:release-prod:linux": "cross-env RUST_TARGET=x86_64-unknown-linux-gnu node scripts/build.js --release-prod",
"build:release-prod:win": "cross-env RUST_TARGET=x86_64-pc-windows-msvc node scripts/build.js --release-prod",
"build:release-debug": "node scripts/build.js --release-debug",
"move-binding": "node scripts/move-binding",
"test": "tsc -p tsconfig.type-test.json"
}
}
\ No newline at end of file
MIT License
Copyright (c) 2022-present Bytedance, Inc. and its affiliates.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://assets.rspack.dev/rspack/rspack-banner-plain-dark.png">
<img alt="Rspack Banner" src="https://assets.rspack.dev/rspack/rspack-banner-plain-light.png">
</picture>
# @rspack/core
The fast Rust-based web bundler with webpack-compatible API.
## Documentation
See <https://rspack.dev> for details.
## License
Rspack is [MIT licensed](https://github.com/web-infra-dev/rspack/blob/main/LICENSE).
The MIT License (MIT)
Copyright 2014 Andrey Sitnik <andrey@sitnik.ru> and other contributors
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
{"name":"browserslist","author":"Andrey Sitnik <andrey@sitnik.ru>","version":"4.23.0","funding":[{"type":"opencollective","url":"https://opencollective.com/browserslist"},{"type":"tidelift","url":"https://tidelift.com/funding/github/npm/browserslist"},{"type":"github","url":"https://github.com/sponsors/ai"}],"license":"MIT","types":"index.d.ts","type":"commonjs"}
Copyright JS Foundation and other contributors
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
{"name":"enhanced-resolve","author":"Tobias Koppers @sokra","version":"5.12.0","license":"MIT","types":"index.d.ts","type":"commonjs"}
/// <reference types="node" />
export * from 'fs';
/**
* Use this method to patch the global fs module (or any other fs-like module).
* NOTE: This should only ever be done at the top-level application layer, in order to delay on
* EMFILE errors from any fs-using dependencies. You should **not** do this in a library, because
* it can cause unexpected delays in other parts of the program.
* @param fsModule The reference to the fs module or an fs-like module.
*/
declare function gracefulify<T>(fsModule: T): T;
export { gracefulify };
The ISC License
Copyright (c) 2011-2022 Isaac Z. Schlueter, Ben Noordhuis, and Contributors
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
{"name":"graceful-fs","version":"4.2.10","license":"ISC","types":"index.d.ts","type":"commonjs"}
/******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = ({
/***/ 218:
/***/ ((module) => {
const INDENT = Symbol.for('indent')
const NEWLINE = Symbol.for('newline')
const DEFAULT_NEWLINE = '\n'
const DEFAULT_INDENT = ' '
const BOM = /^\uFEFF/
// only respect indentation if we got a line break, otherwise squash it
// things other than objects and arrays aren't indented, so ignore those
// Important: in both of these regexps, the $1 capture group is the newline
// or undefined, and the $2 capture group is the indent, or undefined.
const FORMAT = /^\s*[{[]((?:\r?\n)+)([\s\t]*)/
const EMPTY = /^(?:\{\}|\[\])((?:\r?\n)+)?$/
// Node 20 puts single quotes around the token and a comma after it
const UNEXPECTED_TOKEN = /^Unexpected token '?(.)'?(,)? /i
const hexify = (char) => {
const h = char.charCodeAt(0).toString(16).toUpperCase()
return `0x${h.length % 2 ? '0' : ''}${h}`
}
// Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
// because the buffer-to-string conversion in `fs.readFileSync()`
// translates it to FEFF, the UTF-16 BOM.
const stripBOM = (txt) => String(txt).replace(BOM, '')
const makeParsedError = (msg, parsing, position = 0) => ({
message: `${msg} while parsing ${parsing}`,
position,
})
const parseError = (e, txt, context = 20) => {
let msg = e.message
if (!txt) {
return makeParsedError(msg, 'empty string')
}
const badTokenMatch = msg.match(UNEXPECTED_TOKEN)
const badIndexMatch = msg.match(/ position\s+(\d+)/i)
if (badTokenMatch) {
msg = msg.replace(
UNEXPECTED_TOKEN,
`Unexpected token ${JSON.stringify(badTokenMatch[1])} (${hexify(badTokenMatch[1])})$2 `
)
}
let errIdx
if (badIndexMatch) {
errIdx = +badIndexMatch[1]
} else if (msg.match(/^Unexpected end of JSON.*/i)) {
errIdx = txt.length - 1
}
if (errIdx == null) {
return makeParsedError(msg, `'${txt.slice(0, context * 2)}'`)
}
const start = errIdx <= context ? 0 : errIdx - context
const end = errIdx + context >= txt.length ? txt.length : errIdx + context
const slice = `${start ? '...' : ''}${txt.slice(start, end)}${end === txt.length ? '' : '...'}`
return makeParsedError(
msg,
`${txt === slice ? '' : 'near '}${JSON.stringify(slice)}`,
errIdx
)
}
class JSONParseError extends SyntaxError {
constructor (er, txt, context, caller) {
const metadata = parseError(er, txt, context)
super(metadata.message)
Object.assign(this, metadata)
this.code = 'EJSONPARSE'
this.systemError = er
Error.captureStackTrace(this, caller || this.constructor)
}
get name () {
return this.constructor.name
}
set name (n) {}
get [Symbol.toStringTag] () {
return this.constructor.name
}
}
const parseJson = (txt, reviver) => {
const result = JSON.parse(txt, reviver)
if (result && typeof result === 'object') {
// get the indentation so that we can save it back nicely
// if the file starts with {" then we have an indent of '', ie, none
// otherwise, pick the indentation of the next line after the first \n If the
// pattern doesn't match, then it means no indentation. JSON.stringify ignores
// symbols, so this is reasonably safe. if the string is '{}' or '[]', then
// use the default 2-space indent.
const match = txt.match(EMPTY) || txt.match(FORMAT) || [null, '', '']
result[NEWLINE] = match[1] ?? DEFAULT_NEWLINE
result[INDENT] = match[2] ?? DEFAULT_INDENT
}
return result
}
const parseJsonError = (raw, reviver, context) => {
const txt = stripBOM(raw)
try {
return parseJson(txt, reviver)
} catch (e) {
if (typeof raw !== 'string' && !Buffer.isBuffer(raw)) {
const msg = Array.isArray(raw) && raw.length === 0 ? 'an empty array' : String(raw)
throw Object.assign(
new TypeError(`Cannot parse ${msg}`),
{ code: 'EJSONPARSE', systemError: e }
)
}
throw new JSONParseError(e, txt, context, parseJsonError)
}
}
module.exports = parseJsonError
parseJsonError.JSONParseError = JSONParseError
parseJsonError.noExceptions = (raw, reviver) => {
try {
return parseJson(stripBOM(raw), reviver)
} catch {
// no exceptions
}
}
/***/ })
/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __nccwpck_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ var threw = true;
/******/ try {
/******/ __webpack_modules__[moduleId](module, module.exports, __nccwpck_require__);
/******/ threw = false;
/******/ } finally {
/******/ if(threw) delete __webpack_module_cache__[moduleId];
/******/ }
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
/******/ /* webpack/runtime/compat */
/******/
/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";
/******/
/************************************************************************/
/******/
/******/ // startup
/******/ // Load entry module and return exports
/******/ // This entry module is referenced by other modules so it can't be inlined
/******/ var __webpack_exports__ = __nccwpck_require__(218);
/******/ module.exports = __webpack_exports__;
/******/
/******/ })()
;
\ No newline at end of file
{"name":"json-parse-even-better-errors","author":"GitHub Inc.","version":"3.0.1","license":"MIT","types":"index.d.ts","type":"commonjs"}
This source diff could not be displayed because it is too large. You can view the blob instead.
MIT License
Copyright (c) 2014-2018 Suguru Motegi
Based on Async.js, Copyright Caolan McMahon
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
{"name":"neo-async","version":"2.6.2","license":"MIT","types":"index.d.ts","type":"commonjs"}
/// <reference types="node" />
import { EventEmitter } from 'events';
import fs from 'graceful-fs';
declare class DirectoryWatcher extends EventEmitter {
options: Watchpack.WatcherOptions;
directories: {
[path: string]: Watcher | true;
};
files: {
[path: string]: [number, number];
};
initialScan: boolean;
initialScanRemoved: string[];
nestedWatching: boolean;
path: string;
refs: number;
watcher: fs.FSWatcher;
watchers: {
[path: string]: Watcher[];
};
constructor(directoryPath: string, options: Watchpack.WatcherOptions);
setFileTime(filePath: string, mtime: number, initial: boolean, type?: string | boolean): void;
setDirectory(directoryPath: string, exist: boolean, initial: boolean): void;
createNestedWatcher(directoryPath: string): void;
setNestedWatching(flag: boolean): void;
watch(filePath: string, startTime: number): Watcher;
onFileAdded(filePath: string, stat: fs.Stats): void;
onDirectoryAdded(directoryPath: string): void;
onChange(filePath: string, stat: fs.Stats): void;
onFileUnlinked(filePath: string): void;
onDirectoryUnlinked(directoryPath: string): void;
onWatcherError(): void;
doInitialScan(): void;
getTimes(): {
[path: string]: number;
};
close(): void;
}
declare class Watcher extends EventEmitter {
data: number;
directoryWatcher: DirectoryWatcher;
path: string;
startTime: number;
constructor(directoryWatcher: DirectoryWatcher, filePath: string, startTime: number);
checkStartTime(mtime: number, initial: boolean): boolean;
close(): void;
}
interface Entry {
/** A point in time at which is it safe to say all changes happened before that */
safeTime: number;
/** Only for file entries: the last modified timestamp of the file */
timestamp: number;
}
declare class Watchpack extends EventEmitter {
aggregatedChanges: Set<string>;
aggregatedRemovals: Set<string>;
aggregateTimeout: NodeJS.Timer;
dirWatchers: Watcher[];
fileWatchers: Watcher[];
/** Last modified times for files by path */
mtimes: {
[path: string]: number;
};
options: Watchpack.WatchOptions;
paused: boolean;
watcherOptions: Watchpack.WatcherOptions;
constructor(options: Watchpack.WatchOptions);
/**
* Starts watching these files and directories
* Calling this again will override the files and directories
*/
watch(options: {
/**
* Can be files or directories
* For files: content and existence changes are tracked
* For directories: only existence and timestamp changes are tracked
*/
files?: Iterable<string>;
/**
* Can only be directories
* Directory content (and content of children, ...) and existence changes are tracked.
* For files: content and existence changes are tracked
* Assumed to exist, when directory is not found without further information a remove event is emitted
*/
directories?: Iterable<string>;
/**
* Can be files or directories
* Only existence changes are tracked
* Assued to not exist, no remove event is emitted when not found initially
*/
missing?: Iterable<string>;
startTime?: number;
}): void;
on(
eventName: "change",
listener: (
/** The changed file or directory */
filePath: string,
/** The last modified time of the changed file */
modifiedTime: number,
/** Textual information how this change was detected */
explanation: string,
) => void,
): this;
on(
eventName: "remove",
listener: (
/** The removed file or directory */
filePath: string,
/** Textual information how this change was detected */
explanation: string,
) => void,
): this;
on(
eventName: "aggregated",
listener: (
/** Set of all changed files */
changes: Set<string>,
/** Set of all removed files */
removals: Set<string>,
) => void,
): this;
/**
* Stops emitting events, but keeps watchers open
* The next "watch" call can reuse the watchers
* The watcher will keep aggregating events which can be received with `getAggregated()`
*/
pause(): void;
/**
* Stops emitting events and closes all watchers
*/
close(): void;
/**
* Returns the current aggregated info and removes that from the watcher
* The next aggregated event won't include that info and will only emitted when futher changes happen
* Can be used when paused
*/
getAggregated(): {
changes: Set<string>;
removals: Set<string>;
};
/**
* Collects time info objects for all known files and directories
* This includes info from files not directly watched
*/
collectTimeInfoEntries(fileInfoEntries: Map<string, Entry>, directoryInfoEntries: Map<string, Entry>): void;
/**
* Returns a `Map` with all known time info objects for files and directories
* Similar to `collectTimeInfoEntries()` but returns a single map with all entries
*/
getTimeInfoEntries(): Map<string, Entry>;
/**
* Returns an object with all known change times for files
* This include timestamps from files not directly watched
* Key: absolute path, value: timestamp as number
* @deprecated
*/
getTimes(): {
[path: string]: number;
};
_fileWatcher(file: string, watcher: Watcher): Watcher;
_dirWatcher(item: string, watcher: Watcher): Watcher;
_onChange(item: string, mtime: number, file?: string): void;
_onTimeout(): void;
}
declare namespace Watchpack {
interface WatcherOptions {
ignored?: string[] | string | RegExp | ((path: string) => boolean) | undefined;
poll?: boolean | number | undefined;
followSymlinks?: boolean;
}
interface WatchOptions extends WatcherOptions {
aggregateTimeout?: number | undefined;
}
}
export { Watchpack as default };
Copyright JS Foundation and other contributors
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
{"name":"watchpack","author":"Tobias Koppers @sokra","version":"2.4.1","license":"MIT","types":"index.d.ts","type":"commonjs"}
declare class Hash {
constructor();
/**
* Update hash {@link https://nodejs.org/api/crypto.html#crypto_hash_update_data_inputencoding}
*/
update(data: string | Buffer, inputEncoding?: string): Hash;
/**
* Calculates the digest {@link https://nodejs.org/api/crypto.html#crypto_hash_digest_encoding}
*/
digest(encoding?: string): string | Buffer;
}
export type MapOptions = { columns?: boolean; module?: boolean };
export type RawSourceMap = {
version: number;
sources: string[];
names: string[];
sourceRoot?: string;
sourcesContent?: string[];
mappings: string;
file: string;
};
export abstract class Source {
size(): number;
map(options?: MapOptions): RawSourceMap | null;
sourceAndMap(options?: MapOptions): {
source: string | Buffer;
map: Object;
};
updateHash(hash: Hash): void;
source(): string | Buffer;
buffer(): Buffer;
}
export class RawSource extends Source {
constructor(source: string | Buffer, convertToString?: boolean);
isBuffer(): boolean;
}
export class OriginalSource extends Source {
constructor(source: string | Buffer, name: string);
getName(): string;
}
export class ReplaceSource extends Source {
constructor(source: Source, name?: string);
replace(start: number, end: number, newValue: string, name?: string): void;
insert(pos: number, newValue: string, name?: string): void;
getName(): string;
original(): string;
getReplacements(): {
start: number;
end: number;
content: string;
insertIndex: number;
name: string;
}[];
}
export class SourceMapSource extends Source {
constructor(
source: string | Buffer,
name: string,
sourceMap: Object | string | Buffer,
originalSource?: string | Buffer,
innerSourceMap?: Object | string | Buffer,
removeOriginalSource?: boolean
);
getArgsAsBuffers(): [
Buffer,
string,
Buffer,
Buffer | undefined,
Buffer | undefined,
boolean
];
}
export class ConcatSource extends Source {
constructor(...args: (string | Source)[]);
getChildren(): Source[];
add(item: string | Source): void;
addAllSkipOptimizing(items: Source[]): void;
}
export class PrefixSource extends Source {
constructor(prefix: string, source: string | Source);
original(): Source;
getPrefix(): string;
}
export class CachedSource extends Source {
constructor(source: Source);
constructor(source: Source | (() => Source), cachedData?: any);
original(): Source;
originalLazy(): Source | (() => Source);
getCachedData(): any;
}
export class SizeOnlySource extends Source {
constructor(size: number);
}
interface SourceLike {
source(): string | Buffer;
}
export class CompatSource extends Source {
constructor(sourceLike: SourceLike);
static from(sourceLike: SourceLike): Source;
}
MIT License
Copyright (c) 2017 JS Foundation and other contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
{"name":"webpack-sources","author":"Tobias Koppers @sokra","version":"3.2.3","license":"MIT","types":"index.d.ts","type":"commonjs"}
import * as zod from 'zod';
declare class ValidationError extends Error {
details: Array<zod.ZodIssue>;
name: 'ZodValidationError';
constructor(message: string, details?: Array<zod.ZodIssue> | undefined);
toString(): string;
}
type ZodError = zod.ZodError;
type FromZodErrorOptions = {
maxIssuesInMessage?: number;
issueSeparator?: string;
unionSeparator?: string;
prefixSeparator?: string;
prefix?: string;
};
declare function fromZodError(zodError: ZodError, options?: FromZodErrorOptions): ValidationError;
declare const toValidationError: (options?: Parameters<typeof fromZodError>[1]) => (err: unknown) => ValidationError | Error;
declare function isValidationError(err: unknown): err is ValidationError;
declare function isValidationErrorLike(err: unknown): err is ValidationError;
export { type FromZodErrorOptions, ValidationError, type ZodError, fromZodError, isValidationError, isValidationErrorLike, toValidationError };
/******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = ({
/***/ 381:
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.isValidationErrorLike = exports.isValidationError = exports.toValidationError = exports.fromZodError = exports.ValidationError = void 0;
const zod = __importStar(__nccwpck_require__(934));
const joinPath_1 = __nccwpck_require__(954);
const NonEmptyArray_1 = __nccwpck_require__(978);
class ValidationError extends Error {
details;
name;
constructor(message, details = []) {
super(message);
this.details = details;
this.name = 'ZodValidationError';
}
toString() {
return this.message;
}
}
exports.ValidationError = ValidationError;
function fromZodIssue(issue, issueSeparator, unionSeparator) {
if (issue.code === 'invalid_union') {
return issue.unionErrors
.reduce((acc, zodError) => {
const newIssues = zodError.issues
.map((issue) => fromZodIssue(issue, issueSeparator, unionSeparator))
.join(issueSeparator);
if (!acc.includes(newIssues)) {
acc.push(newIssues);
}
return acc;
}, [])
.join(unionSeparator);
}
if ((0, NonEmptyArray_1.isNonEmptyArray)(issue.path)) {
if (issue.path.length === 1) {
const identifier = issue.path[0];
if (typeof identifier === 'number') {
return `${issue.message} at index ${identifier}`;
}
}
return `${issue.message} at "${(0, joinPath_1.joinPath)(issue.path)}"`;
}
return issue.message;
}
function fromZodError(zodError, options = {}) {
const { maxIssuesInMessage = 99, issueSeparator = '; ', unionSeparator = ', or ', prefixSeparator = ': ', prefix = 'Validation error', } = options;
const reason = zodError.errors
.slice(0, maxIssuesInMessage)
.map((issue) => fromZodIssue(issue, issueSeparator, unionSeparator))
.join(issueSeparator);
const message = reason ? [prefix, reason].join(prefixSeparator) : prefix;
return new ValidationError(message, zodError.errors);
}
exports.fromZodError = fromZodError;
const toValidationError = (options = {}) => (err) => {
if (err instanceof zod.ZodError) {
return fromZodError(err, options);
}
if (err instanceof Error) {
return err;
}
return new Error('Unknown error');
};
exports.toValidationError = toValidationError;
function isValidationError(err) {
return err instanceof ValidationError;
}
exports.isValidationError = isValidationError;
function isValidationErrorLike(err) {
return err instanceof Error && err.name === 'ZodValidationError';
}
exports.isValidationErrorLike = isValidationErrorLike;
/***/ }),
/***/ 978:
/***/ ((__unused_webpack_module, exports) => {
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.isNonEmptyArray = void 0;
function isNonEmptyArray(value) {
return value.length !== 0;
}
exports.isNonEmptyArray = isNonEmptyArray;
/***/ }),
/***/ 954:
/***/ ((__unused_webpack_module, exports) => {
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.joinPath = void 0;
const identifierRegex = /[$_\p{ID_Start}][$\u200c\u200d\p{ID_Continue}]*/u;
function joinPath(path) {
if (path.length === 1) {
return path[0].toString();
}
return path.reduce((acc, item) => {
if (typeof item === 'number') {
return acc + '[' + item.toString() + ']';
}
if (item.includes('"')) {
return acc + '["' + escapeQuotes(item) + '"]';
}
if (!identifierRegex.test(item)) {
return acc + '["' + item + '"]';
}
const separator = acc.length === 0 ? '' : '.';
return acc + separator + item;
}, '');
}
exports.joinPath = joinPath;
function escapeQuotes(str) {
return str.replace(/"/g, '\\"');
}
/***/ }),
/***/ 934:
/***/ ((module) => {
module.exports = require("../zod");
/***/ })
/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __nccwpck_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ var threw = true;
/******/ try {
/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __nccwpck_require__);
/******/ threw = false;
/******/ } finally {
/******/ if(threw) delete __webpack_module_cache__[moduleId];
/******/ }
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
/******/ /* webpack/runtime/compat */
/******/
/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";
/******/
/************************************************************************/
var __webpack_exports__ = {};
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
(() => {
var exports = __webpack_exports__;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.fromZodError = exports.isValidationErrorLike = exports.isValidationError = exports.toValidationError = exports.ValidationError = void 0;
var ValidationError_1 = __nccwpck_require__(381);
Object.defineProperty(exports, "ValidationError", ({ enumerable: true, get: function () { return ValidationError_1.ValidationError; } }));
Object.defineProperty(exports, "toValidationError", ({ enumerable: true, get: function () { return ValidationError_1.toValidationError; } }));
Object.defineProperty(exports, "isValidationError", ({ enumerable: true, get: function () { return ValidationError_1.isValidationError; } }));
Object.defineProperty(exports, "isValidationErrorLike", ({ enumerable: true, get: function () { return ValidationError_1.isValidationErrorLike; } }));
Object.defineProperty(exports, "fromZodError", ({ enumerable: true, get: function () { return ValidationError_1.fromZodError; } }));
})();
module.exports = __webpack_exports__;
/******/ })()
;
\ No newline at end of file
(The MIT License)
Copyright 2022 Causaly, Inc <front-end@causaly.com>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
{"name":"zod-validation-error","author":{"name":"Causaly Team","email":"front-end@causaly.com","url":"https://www.causaly.com"},"version":"1.3.1","license":"MIT","types":"index.d.ts","type":"commonjs"}
This source diff could not be displayed because it is too large. You can view the blob instead.
MIT License
Copyright (c) 2020 Colin McDonnell
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
{"name":"zod","author":"Colin McDonnell <colin@colinhacks.com>","version":"3.23.8","funding":"https://github.com/sponsors/colinhacks","license":"MIT","types":"index.d.ts","type":"commonjs"}
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
/* globals __webpack_hash__ */
if (module.hot) {
/** @type {undefined|string} */
var lastHash;
var upToDate = function upToDate() {
return /** @type {string} */ (lastHash).indexOf(__webpack_hash__) >= 0;
};
var log = require("./log");
var check = function check() {
module.hot
.check(true)
.then(function (updatedModules) {
if (!updatedModules) {
log(
"warning",
"[HMR] Cannot find update. " +
(typeof window !== "undefined"
? "Need to do a full reload!"
: "Please reload manually!")
);
log(
"warning",
"[HMR] (Probably because of restarting the webpack-dev-server)"
);
if (typeof window !== "undefined") {
window.location.reload();
}
return;
}
if (!upToDate()) {
check();
}
require("./log-apply-result")(updatedModules, updatedModules);
if (upToDate()) {
log("info", "[HMR] App is up to date.");
}
})
.catch(function (err) {
var status = module.hot.status();
if (["abort", "fail"].indexOf(status) >= 0) {
log(
"warning",
"[HMR] Cannot apply update. " +
(typeof window !== "undefined"
? "Need to do a full reload!"
: "Please reload manually!")
);
log("warning", "[HMR] " + log.formatError(err));
if (typeof window !== "undefined") {
window.location.reload();
}
} else {
log("warning", "[HMR] Update failed: " + log.formatError(err));
}
});
};
var hotEmitter = require("./emitter");
hotEmitter.on("webpackHotUpdate", function (currentHash) {
lastHash = currentHash;
if (!upToDate() && module.hot.status() === "idle") {
log("info", "[HMR] Checking for updates on the server...");
check();
}
});
log("info", "[HMR] Waiting for update signal from WDS...");
} else {
throw new Error("[HMR] Hot Module Replacement is disabled.");
}
function EventEmitter() {
this.events = {};
}
EventEmitter.prototype.on = function (eventName, callback) {
if (!this.events[eventName]) {
this.events[eventName] = [];
}
this.events[eventName].push(callback);
};
EventEmitter.prototype.emit = function (eventName) {
var args = Array.prototype.slice.call(arguments, 1);
if (this.events[eventName]) {
this.events[eventName].forEach(function (callback) {
callback.apply(null, args);
});
}
};
module.exports = new EventEmitter();
/* global __resourceQuery */
"use strict";
var urlBase = decodeURIComponent(__resourceQuery.slice(1));
/**
* @param {{ data: string, onError: (err: Error) => void, active: boolean, module: module }} options options
* @returns {() => void} function to destroy response
*/
exports.keepAlive = function (options) {
var data = options.data;
var onError = options.onError;
var active = options.active;
var module = options.module;
/** @type {import("http").IncomingMessage} */
var response;
var request = (
urlBase.startsWith("https") ? require("https") : require("http")
).request(
urlBase + data,
{
agent: false,
headers: { accept: "text/event-stream" }
},
function (res) {
response = res;
response.on("error", errorHandler);
if (!active && !module.hot) {
console.log(
"Hot Module Replacement is not enabled. Waiting for process restart..."
);
}
}
);
/**
* @param {Error} err error
*/
function errorHandler(err) {
err.message =
"Problem communicating active modules to the server: " + err.message;
onError(err);
}
request.on("error", errorHandler);
request.end();
return function () {
response.destroy();
};
};
/* global __resourceQuery */
"use strict";
if (typeof EventSource !== "function") {
throw new Error(
"Environment doesn't support lazy compilation (requires EventSource)"
);
}
var urlBase = decodeURIComponent(__resourceQuery.slice(1));
/** @type {EventSource | undefined} */
var activeEventSource;
var activeKeys = new Map();
var errorHandlers = new Set();
var updateEventSource = function updateEventSource() {
if (activeEventSource) activeEventSource.close();
if (activeKeys.size) {
activeEventSource = new EventSource(
urlBase + Array.from(activeKeys.keys()).join("@")
);
/**
* @this {EventSource}
* @param {Event & { message?: string, filename?: string, lineno?: number, colno?: number, error?: Error }} event event
*/
activeEventSource.onerror = function (event) {
errorHandlers.forEach(function (onError) {
onError(
new Error(
"Problem communicating active modules to the server: " +
event.message +
" " +
event.filename +
":" +
event.lineno +
":" +
event.colno +
" " +
event.error
)
);
});
};
} else {
activeEventSource = undefined;
}
};
/**
* @param {{ data: string, onError: (err: Error) => void, active: boolean, module: module }} options options
* @returns {() => void} function to destroy response
*/
exports.keepAlive = function (options) {
var data = options.data;
var onError = options.onError;
var active = options.active;
var module = options.module;
errorHandlers.add(onError);
var value = activeKeys.get(data) || 0;
activeKeys.set(data, value + 1);
if (value === 0) {
updateEventSource();
}
if (!active && !module.hot) {
console.log(
"Hot Module Replacement is not enabled. Waiting for process restart..."
);
}
return function () {
errorHandlers.delete(onError);
setTimeout(function () {
var value = activeKeys.get(data);
if (value === 1) {
activeKeys.delete(data);
updateEventSource();
} else {
activeKeys.set(data, value - 1);
}
}, 1000);
};
};
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
/**
* @param {(string | number)[]} updatedModules updated modules
* @param {(string | number)[] | null} renewedModules renewed modules
*/
module.exports = function (updatedModules, renewedModules) {
var unacceptedModules = updatedModules.filter(function (moduleId) {
return renewedModules && renewedModules.indexOf(moduleId) < 0;
});
var log = require("./log");
if (unacceptedModules.length > 0) {
log(
"warning",
"[HMR] The following modules couldn't be hot updated: (They would need a full reload!)"
);
unacceptedModules.forEach(function (moduleId) {
log("warning", "[HMR] - " + moduleId);
});
}
if (!renewedModules || renewedModules.length === 0) {
log("info", "[HMR] Nothing hot updated.");
} else {
log("info", "[HMR] Updated modules:");
renewedModules.forEach(function (moduleId) {
if (typeof moduleId === "string" && moduleId.indexOf("!") !== -1) {
var parts = moduleId.split("!");
log.groupCollapsed("info", "[HMR] - " + parts.pop());
log("info", "[HMR] - " + moduleId);
log.groupEnd("info");
} else {
log("info", "[HMR] - " + moduleId);
}
});
var numberIds = renewedModules.every(function (moduleId) {
return typeof moduleId === "number";
});
if (numberIds)
log(
"info",
'[HMR] Consider using the optimization.moduleIds: "named" for module names.'
);
}
};
/** @typedef {"info" | "warning" | "error"} LogLevel */
/** @type {LogLevel} */
var logLevel = "info";
function dummy() {}
/**
* @param {LogLevel} level log level
* @returns {boolean} true, if should log
*/
function shouldLog(level) {
var shouldLog =
(logLevel === "info" && level === "info") ||
(["info", "warning"].indexOf(logLevel) >= 0 && level === "warning") ||
(["info", "warning", "error"].indexOf(logLevel) >= 0 && level === "error");
return shouldLog;
}
/**
* @param {(msg?: string) => void} logFn log function
* @returns {(level: LogLevel, msg?: string) => void} function that logs when log level is sufficient
*/
function logGroup(logFn) {
return function (level, msg) {
if (shouldLog(level)) {
logFn(msg);
}
};
}
/**
* @param {LogLevel} level log level
* @param {string|Error} msg message
*/
module.exports = function (level, msg) {
if (shouldLog(level)) {
if (level === "info") {
console.log(msg);
} else if (level === "warning") {
console.warn(msg);
} else if (level === "error") {
console.error(msg);
}
}
};
var group = console.group || dummy;
var groupCollapsed = console.groupCollapsed || dummy;
var groupEnd = console.groupEnd || dummy;
module.exports.group = logGroup(group);
module.exports.groupCollapsed = logGroup(groupCollapsed);
module.exports.groupEnd = logGroup(groupEnd);
/**
* @param {LogLevel} level log level
*/
module.exports.setLogLevel = function (level) {
logLevel = level;
};
/**
* @param {Error} err error
* @returns {string} formatted error
*/
module.exports.formatError = function (err) {
var message = err.message;
var stack = err.stack;
if (!stack) {
return message;
} else if (stack.indexOf(message) < 0) {
return message + "\n" + stack;
} else {
return stack;
}
};
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
/*globals __webpack_hash__ */
if (module.hot) {
/** @type {undefined|string} */
var lastHash;
var upToDate = function upToDate() {
return /** @type {string} */ (lastHash).indexOf(__webpack_hash__) >= 0;
};
var log = require("./log");
var check = function check() {
module.hot
.check()
.then(function (updatedModules) {
if (!updatedModules) {
log("warning", "[HMR] Cannot find update. Need to do a full reload!");
log(
"warning",
"[HMR] (Probably because of restarting the webpack-dev-server)"
);
return;
}
return module.hot
.apply({
ignoreUnaccepted: true,
ignoreDeclined: true,
ignoreErrored: true,
onUnaccepted: function (data) {
log(
"warning",
"Ignored an update to unaccepted module " +
data.chain.join(" -> ")
);
},
onDeclined: function (data) {
log(
"warning",
"Ignored an update to declined module " +
data.chain.join(" -> ")
);
},
onErrored: function (data) {
log("error", data.error);
log(
"warning",
"Ignored an error while updating module " +
data.moduleId +
" (" +
data.type +
")"
);
}
})
.then(function (renewedModules) {
if (!upToDate()) {
check();
}
require("./log-apply-result")(updatedModules, renewedModules);
if (upToDate()) {
log("info", "[HMR] App is up to date.");
}
});
})
.catch(function (err) {
var status = module.hot.status();
if (["abort", "fail"].indexOf(status) >= 0) {
log(
"warning",
"[HMR] Cannot check for update. Need to do a full reload!"
);
log("warning", "[HMR] " + log.formatError(err));
} else {
log("warning", "[HMR] Update check failed: " + log.formatError(err));
}
});
};
var hotEmitter = require("./emitter");
hotEmitter.on("webpackHotUpdate", function (currentHash) {
lastHash = currentHash;
if (!upToDate()) {
var status = module.hot.status();
if (status === "idle") {
log("info", "[HMR] Checking for updates on the server...");
check();
} else if (["abort", "fail"].indexOf(status) >= 0) {
log(
"warning",
"[HMR] Cannot apply update as a previous update " +
status +
"ed. Need to do a full reload!"
);
}
}
});
log("info", "[HMR] Waiting for update signal from WDS...");
} else {
throw new Error("[HMR] Hot Module Replacement is disabled.");
}
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
/*globals __resourceQuery */
if (module.hot) {
var hotPollInterval = +__resourceQuery.slice(1) || 10 * 60 * 1000;
var log = require("./log");
/**
* @param {boolean=} fromUpdate true when called from update
*/
var checkForUpdate = function checkForUpdate(fromUpdate) {
if (module.hot.status() === "idle") {
module.hot
.check(true)
.then(function (updatedModules) {
if (!updatedModules) {
if (fromUpdate) log("info", "[HMR] Update applied.");
return;
}
require("./log-apply-result")(updatedModules, updatedModules);
checkForUpdate(true);
})
.catch(function (err) {
var status = module.hot.status();
if (["abort", "fail"].indexOf(status) >= 0) {
log("warning", "[HMR] Cannot apply update.");
log("warning", "[HMR] " + log.formatError(err));
log("warning", "[HMR] You need to restart the application!");
} else {
log("warning", "[HMR] Update failed: " + log.formatError(err));
}
});
}
};
setInterval(checkForUpdate, hotPollInterval);
} else {
throw new Error("[HMR] Hot Module Replacement is disabled.");
}
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
/*globals __resourceQuery */
if (module.hot) {
var log = require("./log");
/**
* @param {boolean=} fromUpdate true when called from update
*/
var checkForUpdate = function checkForUpdate(fromUpdate) {
module.hot
.check()
.then(function (updatedModules) {
if (!updatedModules) {
if (fromUpdate) log("info", "[HMR] Update applied.");
else log("warning", "[HMR] Cannot find update.");
return;
}
return module.hot
.apply({
ignoreUnaccepted: true,
onUnaccepted: function (data) {
log(
"warning",
"Ignored an update to unaccepted module " +
data.chain.join(" -> ")
);
}
})
.then(function (renewedModules) {
require("./log-apply-result")(updatedModules, renewedModules);
checkForUpdate(true);
return null;
});
})
.catch(function (err) {
var status = module.hot.status();
if (["abort", "fail"].indexOf(status) >= 0) {
log("warning", "[HMR] Cannot apply update.");
log("warning", "[HMR] " + log.formatError(err));
log("warning", "[HMR] You need to restart the application!");
} else {
log("warning", "[HMR] Update failed: " + (err.stack || err.message));
}
});
};
process.on(__resourceQuery.slice(1) || "SIGUSR2", function () {
if (module.hot.status() !== "idle") {
log(
"warning",
"[HMR] Got signal but currently in " + module.hot.status() + " state."
);
log("warning", "[HMR] Need to be in idle state to start hot update.");
return;
}
checkForUpdate();
});
} else {
throw new Error("[HMR] Hot Module Replacement is disabled.");
}
/**
* The following code is modified based on
* https://github.com/webpack/webpack/blob/v5.92.0/module.d.ts
*
* MIT Licensed
* Author Tobias Koppers @sokra
* Copyright (c) JS Foundation and other contributors
* https://github.com/webpack/webpack/blob/main/LICENSE
*/
declare namespace Rspack {
type DeclinedEvent =
| {
type: "declined";
/** The module in question. */
moduleId: number | string;
/** the chain from where the update was propagated. */
chain: (number | string)[];
/** the module id of the declining parent */
parentId: number | string;
}
| {
type: "self-declined";
/** The module in question. */
moduleId: number | string;
/** the chain from where the update was propagated. */
chain: (number | string)[];
};
type UnacceptedEvent = {
type: "unaccepted";
/** The module in question. */
moduleId: number | string;
/** the chain from where the update was propagated. */
chain: (number | string)[];
};
type AcceptedEvent = {
type: "accepted";
/** The module in question. */
moduleId: number | string;
/** the modules that are outdated and will be disposed */
outdatedModules: (number | string)[];
/** the accepted dependencies that are outdated */
outdatedDependencies: {
[id: number]: (number | string)[];
};
};
type DisposedEvent = {
type: "disposed";
/** The module in question. */
moduleId: number | string;
};
type ErroredEvent =
| {
type: "accept-error-handler-errored";
/** The module in question. */
moduleId: number | string;
/** the module id owning the accept handler. */
dependencyId: number | string;
/** the thrown error */
error: Error;
/** the error thrown by the module before the error handler tried to handle it. */
originalError: Error;
}
| {
type: "self-accept-error-handler-errored";
/** The module in question. */
moduleId: number | string;
/** the thrown error */
error: Error;
/** the error thrown by the module before the error handler tried to handle it. */
originalError: Error;
}
| {
type: "accept-errored";
/** The module in question. */
moduleId: number | string;
/** the module id owning the accept handler. */
dependencyId: number | string;
/** the thrown error */
error: Error;
}
| {
type: "self-accept-errored";
/** The module in question. */
moduleId: number | string;
/** the thrown error */
error: Error;
};
type HotEvent =
| DeclinedEvent
| UnacceptedEvent
| AcceptedEvent
| DisposedEvent
| ErroredEvent;
interface ApplyOptions {
ignoreUnaccepted?: boolean;
ignoreDeclined?: boolean;
ignoreErrored?: boolean;
onDeclined?: (event: DeclinedEvent) => void;
onUnaccepted?: (event: UnacceptedEvent) => void;
onAccepted?: (event: AcceptedEvent) => void;
onDisposed?: (event: DisposedEvent) => void;
onErrored?: (event: ErroredEvent) => void;
}
const enum HotUpdateStatus {
idle = "idle",
check = "check",
prepare = "prepare",
ready = "ready",
dispose = "dispose",
apply = "apply",
abort = "abort",
fail = "fail"
}
interface Hot {
accept: {
(
modules: string | string[],
callback?: (outdatedDependencies: string[]) => void,
errorHandler?: (
err: Error,
context: { moduleId: string | number; dependencyId: string | number }
) => void
): void;
(
errorHandler?: (
err: Error,
ids: { moduleId: string | number; module: NodeJS.Module }
) => void
): void;
};
status(): HotUpdateStatus;
decline(module?: string | string[]): void;
dispose(callback: (data: object) => void): void;
addDisposeHandler(callback: (data: object) => void): void;
removeDisposeHandler(callback: (data: object) => void): void;
invalidate(): void;
addStatusHandler(callback: (status: HotUpdateStatus) => void): void;
removeStatusHandler(callback: (status: HotUpdateStatus) => void): void;
data: object;
check(
autoApply?: boolean | ApplyOptions
): Promise<(string | number)[] | null>;
apply(options?: ApplyOptions): Promise<(string | number)[] | null>;
}
interface ExportInfo {
used: boolean;
provideInfo: boolean | null | undefined;
useInfo: boolean | null | undefined;
canMangle: boolean;
}
interface ExportsInfo {
[k: string]: ExportInfo & ExportsInfo;
}
interface Context {
resolve(dependency: string): string | number;
keys(): Array<string>;
id: string | number;
(dependency: string): unknown;
}
}
interface ImportMeta {
url: string;
// TODO: unsupported
// webpack: number;
webpackHot: Rspack.Hot;
webpackContext: (
request: string,
options?: {
recursive?: boolean;
regExp?: RegExp;
include?: RegExp;
exclude?: RegExp;
preload?: boolean | number;
prefetch?: boolean | number;
fetchPriority?: "low" | "high" | "auto";
chunkName?: string;
exports?: string | string[][];
mode?: "sync" | "eager" | "weak" | "lazy" | "lazy-once";
}
) => Rspack.Context;
}
declare const __resourceQuery: string;
declare var __webpack_public_path__: string;
declare var __webpack_nonce__: string;
declare const __webpack_chunkname__: string;
declare var __webpack_base_uri__: string;
declare var __webpack_runtime_id__: string;
declare const __webpack_hash__: string;
declare const __webpack_modules__: Record<string | number, NodeJS.Module>;
declare const __webpack_require__: (id: string | number) => unknown;
declare var __webpack_chunk_load__: (chunkId: string | number) => Promise<void>;
declare var __webpack_get_script_filename__: (
chunkId: string | number
) => string;
declare var __webpack_is_included__: (request: string) => boolean;
declare var __webpack_exports_info__: Rspack.ExportsInfo;
declare const __webpack_share_scopes__: Record<
string,
Record<
string,
{ loaded?: 1; get: () => Promise<unknown>; from: string; eager: boolean }
>
>;
declare var __webpack_init_sharing__: (scope: string) => Promise<void>;
declare var __non_webpack_require__: (id: any) => unknown;
declare const __system_context__: object;
declare namespace NodeJS {
interface Module {
hot: Rspack.Hot;
}
interface Require {
ensure(
dependencies: string[],
callback: (require: (module: string) => void) => void,
errorCallback?: (error: Error) => void,
chunkName?: string
): void;
context(
request: string,
includeSubdirectories?: boolean,
filter?: RegExp,
mode?: "sync" | "eager" | "weak" | "lazy" | "lazy-once"
): Rspack.Context;
include(dependency: string): void;
resolveWeak(dependency: string): void;
onError?: (error: Error) => void;
}
}
{
"name": "@rspack/core",
"version": "1.0.0-beta.1",
"webpackVersion": "5.75.0",
"license": "MIT",
"description": "The fast Rust-based web bundler with webpack-compatible API",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"publishConfig": {
"access": "public",
"provenance": true
},
"exports": {
".": {
"default": "./dist/index.js"
},
"./hot/*": "./hot/*.js",
"./hot/*.js": "./hot/*.js",
"./package.json": "./package.json",
"./module": "./module.d.ts"
},
"files": [
"dist",
"hot",
"compiled",
"module.d.ts"
],
"engines": {
"node": ">=16.0.0"
},
"homepage": "https://rspack.dev",
"bugs": "https://github.com/web-infra-dev/rspack/issues",
"repository": {
"type": "git",
"url": "https://github.com/web-infra-dev/rspack",
"directory": "packages/rspack"
},
"devDependencies": {
"@swc/core": "1.4.0",
"@types/neo-async": "^2.6.6",
"@types/watchpack": "^2.4.0",
"@types/webpack-sources": "3.2.3",
"browserslist": "^4.21.3",
"cross-env": "^7.0.3",
"enhanced-resolve": "5.12.0",
"graceful-fs": "4.2.10",
"@types/graceful-fs": "4.1.9",
"json-parse-even-better-errors": "^3.0.0",
"neo-async": "2.6.2",
"prebundle": "^1.1.0",
"typescript": "5.0.2",
"tsc-alias": "^1.8.8",
"watchpack": "^2.4.0",
"webpack-sources": "3.2.3",
"webpack-dev-server": "^5.0.4",
"zod": "^3.23.8",
"zod-validation-error": "1.3.1"
},
"dependencies": {
"@module-federation/runtime-tools": "0.2.3",
"caniuse-lite": "^1.0.30001616",
"@rspack/lite-tapable": "1.0.0-beta.1",
"@rspack/binding": "1.0.0-beta.1"
},
"peerDependencies": {
"@swc/helpers": ">=0.5.1"
},
"peerDependenciesMeta": {
"@swc/helpers": {
"optional": true
}
},
"scripts": {
"build": "tsc -b ./tsconfig.build.json && tsc-alias -p tsconfig.build.json && npm run prepare-container-runtime",
"build:force": "tsc -b ./tsconfig.build.json --force && tsc-alias -p tsconfig.build.json && npm run prepare-container-runtime",
"dev": "tsc -w",
"prepare-container-runtime": "node ./scripts/prepare-container-runtime.js",
"doc-coverage": "node scripts/check-documentation-coverage.mjs",
"api-extractor": "api-extractor run --verbose",
"api-extractor:ci": "api-extractor run --verbose || diff temp/api.md etc/api.md"
}
}
\ No newline at end of file
MIT License
Copyright (c) 2022-present Bytedance, Inc. and its affiliates.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://assets.rspack.dev/rspack/rspack-banner-plain-dark.png">
<img alt="Rspack Banner" src="https://assets.rspack.dev/rspack/rspack-banner-plain-light.png">
</picture>
# @rspack/lite-tapable
Lite weight tapable for Rspack.
## Documentation
See <https://rspack.dev> for details.
## License
Rspack is [MIT licensed](https://github.com/web-infra-dev/rspack/blob/main/LICENSE).
{
"name": "@rspack/lite-tapable",
"version": "1.0.0-beta.1",
"license": "MIT",
"description": "Lite weight tapable for Rspack",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"publishConfig": {
"access": "public",
"provenance": true
},
"exports": {
".": {
"default": "./dist/index.js"
}
},
"devDependencies": {
"typescript": "5.0.2"
},
"files": [
"dist"
],
"engines": {
"node": ">=16.0.0"
},
"homepage": "https://rspack.dev",
"bugs": "https://github.com/web-infra-dev/rspack/issues",
"repository": {
"type": "git",
"url": "https://github.com/web-infra-dev/rspack",
"directory": "packages/lite-tapable"
},
"scripts": {
"build": "tsc -b ./tsconfig.build.json",
"build:force": "tsc -b ./tsconfig.build.json --force",
"test": "jest --colors",
"api-extractor": "api-extractor run --verbose",
"api-extractor:ci": "api-extractor run --verbose || diff temp/api.md etc/api.md"
}
}
\ No newline at end of file
MIT License
Copyright (c) 2022-present Bytedance, Inc. and its affiliates.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://assets.rspack.dev/rspack/rspack-banner-plain-dark.png">
<img alt="Rspack Banner" src="https://assets.rspack.dev/rspack/rspack-banner-plain-light.png">
</picture>
# @rspack/binding
Private node binding crate for rspack.
> Rspack's internal package, don't use it directly in your project, This package does *NOT* follow [semantic versioning](https://semver.org/).
## Documentation
See [https://rspack.dev](https://rspack.dev) for details.
## License
Rspack is [MIT licensed](https://github.com/web-infra-dev/rspack/blob/main/LICENSE).
const { existsSync, readFileSync } = require('fs')
const { join } = require('path')
const { platform, arch } = process
let nativeBinding = null
let localFileExisted = false
let loadError = null
function isMusl() {
// For Node 10
if (!process.report || typeof process.report.getReport !== 'function') {
try {
const lddPath = require('child_process').execSync('which ldd').toString().trim();
return readFileSync(lddPath, 'utf8').includes('musl')
} catch (e) {
return true
}
} else {
const { glibcVersionRuntime } = process.report.getReport().header
return !glibcVersionRuntime
}
}
switch (platform) {
case 'android':
switch (arch) {
case 'arm64':
localFileExisted = existsSync(join(__dirname, 'rspack.android-arm64.node'))
try {
if (localFileExisted) {
nativeBinding = require('./rspack.android-arm64.node')
} else {
nativeBinding = require('@rspack/binding-android-arm64')
}
} catch (e) {
loadError = e
}
break
case 'arm':
localFileExisted = existsSync(join(__dirname, 'rspack.android-arm-eabi.node'))
try {
if (localFileExisted) {
nativeBinding = require('./rspack.android-arm-eabi.node')
} else {
nativeBinding = require('@rspack/binding-android-arm-eabi')
}
} catch (e) {
loadError = e
}
break
default:
throw new Error(`Unsupported architecture on Android ${arch}`)
}
break
case 'win32':
switch (arch) {
case 'x64':
localFileExisted = existsSync(join(__dirname, 'rspack.win32-x64-msvc.node'))
try {
if (localFileExisted) {
nativeBinding = require('./rspack.win32-x64-msvc.node')
} else {
nativeBinding = require('@rspack/binding-win32-x64-msvc')
}
} catch (e) {
loadError = e
}
break
case 'ia32':
localFileExisted = existsSync(join(__dirname, 'rspack.win32-ia32-msvc.node'))
try {
if (localFileExisted) {
nativeBinding = require('./rspack.win32-ia32-msvc.node')
} else {
nativeBinding = require('@rspack/binding-win32-ia32-msvc')
}
} catch (e) {
loadError = e
}
break
case 'arm64':
localFileExisted = existsSync(join(__dirname, 'rspack.win32-arm64-msvc.node'))
try {
if (localFileExisted) {
nativeBinding = require('./rspack.win32-arm64-msvc.node')
} else {
nativeBinding = require('@rspack/binding-win32-arm64-msvc')
}
} catch (e) {
loadError = e
}
break
default:
throw new Error(`Unsupported architecture on Windows: ${arch}`)
}
break
case 'darwin':
switch (arch) {
case 'x64':
localFileExisted = existsSync(join(__dirname, 'rspack.darwin-x64.node'))
try {
if (localFileExisted) {
nativeBinding = require('./rspack.darwin-x64.node')
} else {
nativeBinding = require('@rspack/binding-darwin-x64')
}
} catch (e) {
loadError = e
}
break
case 'arm64':
localFileExisted = existsSync(join(__dirname, 'rspack.darwin-arm64.node'))
try {
if (localFileExisted) {
nativeBinding = require('./rspack.darwin-arm64.node')
} else {
nativeBinding = require('@rspack/binding-darwin-arm64')
}
} catch (e) {
loadError = e
}
break
default:
throw new Error(`Unsupported architecture on macOS: ${arch}`)
}
break
case 'freebsd':
if (arch !== 'x64') {
throw new Error(`Unsupported architecture on FreeBSD: ${arch}`)
}
localFileExisted = existsSync(join(__dirname, 'rspack.freebsd-x64.node'))
try {
if (localFileExisted) {
nativeBinding = require('./rspack.freebsd-x64.node')
} else {
nativeBinding = require('@rspack/binding-freebsd-x64')
}
} catch (e) {
loadError = e
}
break
case 'linux':
switch (arch) {
case 'x64':
if (isMusl()) {
localFileExisted = existsSync(join(__dirname, 'rspack.linux-x64-musl.node'))
try {
if (localFileExisted) {
nativeBinding = require('./rspack.linux-x64-musl.node')
} else {
nativeBinding = require('@rspack/binding-linux-x64-musl')
}
} catch (e) {
loadError = e
}
} else {
localFileExisted = existsSync(join(__dirname, 'rspack.linux-x64-gnu.node'))
try {
if (localFileExisted) {
nativeBinding = require('./rspack.linux-x64-gnu.node')
} else {
nativeBinding = require('@rspack/binding-linux-x64-gnu')
}
} catch (e) {
loadError = e
}
}
break
case 'arm64':
if (isMusl()) {
localFileExisted = existsSync(join(__dirname, 'rspack.linux-arm64-musl.node'))
try {
if (localFileExisted) {
nativeBinding = require('./rspack.linux-arm64-musl.node')
} else {
nativeBinding = require('@rspack/binding-linux-arm64-musl')
}
} catch (e) {
loadError = e
}
} else {
localFileExisted = existsSync(join(__dirname, 'rspack.linux-arm64-gnu.node'))
try {
if (localFileExisted) {
nativeBinding = require('./rspack.linux-arm64-gnu.node')
} else {
nativeBinding = require('@rspack/binding-linux-arm64-gnu')
}
} catch (e) {
loadError = e
}
}
break
case 'arm':
localFileExisted = existsSync(join(__dirname, 'rspack.linux-arm-gnueabihf.node'))
try {
if (localFileExisted) {
nativeBinding = require('./rspack.linux-arm-gnueabihf.node')
} else {
nativeBinding = require('@rspack/binding-linux-arm-gnueabihf')
}
} catch (e) {
loadError = e
}
break
default:
throw new Error(`Unsupported architecture on Linux: ${arch}`)
}
break
default:
throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`)
}
if (!nativeBinding) {
if (loadError) {
throw loadError
}
throw new Error(`Failed to load native binding`)
}
module.exports.default = module.exports = nativeBinding
{
"name": "@rspack/binding",
"version": "1.0.0-beta.1",
"license": "MIT",
"description": "Node binding for rspack",
"main": "binding.js",
"types": "binding.d.ts",
"publishConfig": {
"access": "public",
"provenance": true
},
"files": [
"binding.js",
"binding.d.ts"
],
"homepage": "https://rspack.dev",
"bugs": "https://github.com/web-infra-dev/rspack/issues",
"repository": "web-infra-dev/rspack",
"devDependencies": {
"@napi-rs/cli": "3.0.0-alpha.45",
"typescript": "5.0.2"
},
"napi": {
"binaryName": "rspack"
},
"optionalDependencies": {
"@rspack/binding-darwin-arm64": "1.0.0-beta.1",
"@rspack/binding-win32-arm64-msvc": "1.0.0-beta.1",
"@rspack/binding-linux-arm64-gnu": "1.0.0-beta.1",
"@rspack/binding-linux-arm64-musl": "1.0.0-beta.1",
"@rspack/binding-win32-ia32-msvc": "1.0.0-beta.1",
"@rspack/binding-linux-x64-gnu": "1.0.0-beta.1",
"@rspack/binding-linux-x64-musl": "1.0.0-beta.1",
"@rspack/binding-win32-x64-msvc": "1.0.0-beta.1",
"@rspack/binding-darwin-x64": "1.0.0-beta.1"
},
"scripts": {
"build:debug": "node scripts/build.js",
"watch:debug": "node scripts/build.js --watch",
"build:debug:x64": "cross-env RUST_TARGET=x86_64-apple-darwin node scripts/build.js",
"build:debug:linux": "cross-env RUST_TARGET=x86_64-unknown-linux-gnu node scripts/build.js",
"build:release:all": "run-p build:release:arm64 build:release:x64 build:release:linux && pnpm move-binding",
"build:release": "node scripts/build.js --release",
"watch:release": "node scripts/build.js --release --watch",
"build:release:arm64": "cross-env RUST_TARGET=aarch64-apple-darwin node scripts/build.js --release",
"build:release:x64": "cross-env RUST_TARGET=x86_64-apple-darwin node scripts/build.js --release",
"build:release:linux": "cross-env RUST_TARGET=x86_64-unknown-linux-gnu node scripts/build.js --release",
"build:release:musl": "cross-env RUST_TARGET=aarch64-unknown-linux-musl node scripts/build.js --release",
"build:release:win": "cross-env RUST_TARGET=x86_64-pc-windows-msvc node scripts/build.js --release",
"build:release-prod:all": "run-p build:release-prod:arm64 build:release-prod:x64 build:release-prod:linux && pnpm move-binding",
"build:release-prod": "node scripts/build.js --release-prod",
"watch:release-prod": "node scripts/build.js --release-prod --watch",
"build:release-prod:arm64": "cross-env RUST_TARGET=aarch64-apple-darwin node scripts/build.js --release-prod",
"build:release-prod:x64": "cross-env RUST_TARGET=x86_64-apple-darwin node scripts/build.js --release-prod",
"build:release-prod:linux": "cross-env RUST_TARGET=x86_64-unknown-linux-gnu node scripts/build.js --release-prod",
"build:release-prod:win": "cross-env RUST_TARGET=x86_64-pc-windows-msvc node scripts/build.js --release-prod",
"build:release-debug": "node scripts/build.js --release-debug",
"move-binding": "node scripts/move-binding",
"test": "tsc -p tsconfig.type-test.json"
}
}
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment