@rspack/core
Advanced tools
Comparing version 1.0.0-alpha.4 to 1.0.0-alpha.5
@@ -7,3 +7,3 @@ "use strict"; | ||
exports.pitch = exports.SINGLE_DOT_PATH_SEGMENT = exports.BASE_URI = exports.ABSOLUTE_PUBLIC_PATH = exports.AUTO_PUBLIC_PATH = exports.MODULE_TYPE = void 0; | ||
const path_1 = __importDefault(require("path")); | ||
const node_path_1 = __importDefault(require("node:path")); | ||
const index_1 = require("./index"); | ||
@@ -25,3 +25,3 @@ const loader_options_json_1 = __importDefault(require("./loader-options.json")); | ||
// ${Date.now()} | ||
var cssReload = require(${(0, utils_1.stringifyRequest)(context.loaderContext, path_1.default.join(__dirname, "./hmr/hotModuleReplacement.js"))})(module.id, ${JSON.stringify({ | ||
var cssReload = require(${(0, utils_1.stringifyRequest)(context.loaderContext, node_path_1.default.join(__dirname, "./hmr/hotModuleReplacement.js"))})(module.id, ${JSON.stringify({ | ||
...context.options, | ||
@@ -28,0 +28,0 @@ locals: !!context.locals |
@@ -7,5 +7,5 @@ "use strict"; | ||
exports.stringifyLocal = exports.stringifyRequest = exports.isRelativePath = exports.isAbsolutePath = void 0; | ||
const path_1 = __importDefault(require("path")); | ||
const node_path_1 = __importDefault(require("node:path")); | ||
function isAbsolutePath(str) { | ||
return path_1.default.posix.isAbsolute(str) || path_1.default.win32.isAbsolute(str); | ||
return node_path_1.default.posix.isAbsolute(str) || node_path_1.default.win32.isAbsolute(str); | ||
} | ||
@@ -32,3 +32,3 @@ exports.isAbsolutePath = isAbsolutePath; | ||
if (isAbsolutePath(singlePath) && context) { | ||
singlePath = path_1.default.relative(context, singlePath); | ||
singlePath = node_path_1.default.relative(context, singlePath); | ||
if (isAbsolutePath(singlePath)) { | ||
@@ -35,0 +35,0 @@ // If singlePath still matches an absolute path, singlePath was on a different drive than context. |
@@ -5,5 +5,5 @@ /// <reference types="node" /> | ||
/// <reference types="node" /> | ||
import type { IncomingMessage, ServerOptions as ServerOptionsImport, ServerResponse } from "http"; | ||
import type { ListenOptions, Server } from "net"; | ||
import type { SecureContextOptions, TlsOptions } from "tls"; | ||
import type { IncomingMessage, ServerOptions as ServerOptionsImport, ServerResponse } from "node:http"; | ||
import type { ListenOptions, Server } from "node:net"; | ||
import type { SecureContextOptions, TlsOptions } from "node:tls"; | ||
import type { Compiler } from "../.."; | ||
@@ -10,0 +10,0 @@ export interface LazyCompilationDefaultBackendOptions { |
@@ -19,3 +19,3 @@ /* | ||
: (() => { | ||
const http = isHttps ? require("https") : require("http"); | ||
const http = isHttps ? require("node:https") : require("node:http"); | ||
return http.createServer.bind(http, options.server); | ||
@@ -22,0 +22,0 @@ })(); |
@@ -7,3 +7,3 @@ "use strict"; | ||
exports.SplitChunksPlugin = void 0; | ||
const assert_1 = __importDefault(require("assert")); | ||
const node_assert_1 = __importDefault(require("node:assert")); | ||
const binding_1 = require("@rspack/binding"); | ||
@@ -23,3 +23,3 @@ const Chunk_1 = require("../Chunk"); | ||
const rawOptions = toRawSplitChunksOptions(this.options, compiler); | ||
(0, assert_1.default)(typeof rawOptions !== "undefined"); | ||
(0, node_assert_1.default)(typeof rawOptions !== "undefined"); | ||
return (0, base_1.createBuiltinPlugin)(this.name, rawOptions); | ||
@@ -26,0 +26,0 @@ } |
@@ -7,3 +7,3 @@ "use strict"; | ||
exports.getRawChunkLoading = exports.getRawLibrary = exports.getRawResolve = exports.getRawOptions = void 0; | ||
const assert_1 = __importDefault(require("assert")); | ||
const node_assert_1 = __importDefault(require("node:assert")); | ||
const Stats_1 = require("../Stats"); | ||
@@ -14,3 +14,3 @@ const util_1 = require("../util"); | ||
const getRawOptions = (options, compiler) => { | ||
(0, assert_1.default)(!(0, util_1.isNil)(options.context) && !(0, util_1.isNil)(options.devtool) && !(0, util_1.isNil)(options.cache), "context, devtool, cache should not be nil after defaults"); | ||
(0, node_assert_1.default)(!(0, util_1.isNil)(options.context) && !(0, util_1.isNil)(options.devtool) && !(0, util_1.isNil)(options.cache), "context, devtool, cache should not be nil after defaults"); | ||
const devtool = options.devtool === false ? "" : options.devtool; | ||
@@ -91,3 +91,3 @@ const mode = options.mode; | ||
function getRawTsConfig(tsConfig) { | ||
(0, assert_1.default)(typeof tsConfig !== "string", "should resolve string tsConfig in normalization"); | ||
(0, node_assert_1.default)(typeof tsConfig !== "string", "should resolve string tsConfig in normalization"); | ||
if (tsConfig === undefined) | ||
@@ -215,3 +215,3 @@ return tsConfig; | ||
function getRawModule(module, options) { | ||
(0, assert_1.default)(!(0, util_1.isNil)(module.defaultRules), "module.defaultRules should not be nil after defaults"); | ||
(0, node_assert_1.default)(!(0, util_1.isNil)(module.defaultRules), "module.defaultRules should not be nil after defaults"); | ||
// "..." in defaultRules will be flatten in `applyModuleDefaults`, and "..." in rules is empty, so it's safe to use `as RuleSetRule[]` at here | ||
@@ -614,3 +614,3 @@ const ruleSet = [ | ||
function getRawOptimization(optimization) { | ||
(0, assert_1.default)(!(0, util_1.isNil)(optimization.removeAvailableModules) && | ||
(0, node_assert_1.default)(!(0, util_1.isNil)(optimization.removeAvailableModules) && | ||
!(0, util_1.isNil)(optimization.sideEffects) && | ||
@@ -637,3 +637,3 @@ !(0, util_1.isNil)(optimization.realContentHash) && | ||
const { topLevelAwait, rspackFuture } = experiments; | ||
(0, assert_1.default)(!(0, util_1.isNil)(topLevelAwait) && !(0, util_1.isNil)(rspackFuture)); | ||
(0, node_assert_1.default)(!(0, util_1.isNil)(topLevelAwait) && !(0, util_1.isNil)(rspackFuture)); | ||
return { | ||
@@ -651,3 +651,3 @@ topLevelAwait, | ||
} | ||
(0, assert_1.default)(!(0, util_1.isNil)(node.__dirname) && !(0, util_1.isNil)(node.global) && !(0, util_1.isNil)(node.__filename)); | ||
(0, node_assert_1.default)(!(0, util_1.isNil)(node.__dirname) && !(0, util_1.isNil)(node.global) && !(0, util_1.isNil)(node.__filename)); | ||
return { | ||
@@ -654,0 +654,0 @@ dirname: String(node.__dirname), |
@@ -12,3 +12,3 @@ /** | ||
const browserslist = require("../../compiled/browserslist"); | ||
const path = require("path"); | ||
const path = require("node:path"); | ||
/** @typedef {import("./target").ApiTargetProperties} ApiTargetProperties */ | ||
@@ -15,0 +15,0 @@ /** @typedef {import("./target").EcmaTargetProperties} EcmaTargetProperties */ |
@@ -16,5 +16,5 @@ "use strict"; | ||
exports.applyRspackOptionsBaseDefaults = exports.applyRspackOptionsDefaults = void 0; | ||
const assert_1 = __importDefault(require("assert")); | ||
const fs_1 = __importDefault(require("fs")); | ||
const path_1 = __importDefault(require("path")); | ||
const node_assert_1 = __importDefault(require("node:assert")); | ||
const node_fs_1 = __importDefault(require("node:fs")); | ||
const node_path_1 = __importDefault(require("node:path")); | ||
const ModuleTypeConstants_1 = require("../ModuleTypeConstants"); | ||
@@ -33,3 +33,3 @@ const builtin_plugin_1 = require("../builtin-plugin"); | ||
const { mode, target } = options; | ||
(0, assert_1.default)(!(0, util_1.isNil)(target)); | ||
(0, node_assert_1.default)(!(0, util_1.isNil)(target)); | ||
const targetProperties = target === false | ||
@@ -362,5 +362,5 @@ ? false | ||
return libraryName; | ||
const pkgPath = path_1.default.resolve(context, "package.json"); | ||
const pkgPath = node_path_1.default.resolve(context, "package.json"); | ||
try { | ||
const packageInfo = JSON.parse(fs_1.default.readFileSync(pkgPath, "utf-8")); | ||
const packageInfo = JSON.parse(node_fs_1.default.readFileSync(pkgPath, "utf-8")); | ||
return packageInfo.name || ""; | ||
@@ -418,3 +418,3 @@ } | ||
D(output, "webassemblyModuleFilename", "[hash].module.wasm"); | ||
F(output, "path", () => path_1.default.join(process.cwd(), "dist")); | ||
F(output, "path", () => node_path_1.default.join(process.cwd(), "dist")); | ||
F(output, "pathinfo", () => development); | ||
@@ -421,0 +421,0 @@ D(output, "publicPath", tp && (tp.document || tp.importScripts) ? "auto" : ""); |
@@ -121,3 +121,3 @@ "use strict"; | ||
const pathinfo = zod_1.z.boolean().or(zod_1.z.literal("verbose")); | ||
const assetModuleFilename = zod_1.z.string(); | ||
const assetModuleFilename = filename; | ||
const webassemblyModuleFilename = zod_1.z.string(); | ||
@@ -124,0 +124,0 @@ const chunkFilename = filename; |
@@ -7,3 +7,3 @@ "use strict"; | ||
exports.ThreadsafeWritableNodeFS = void 0; | ||
const util_1 = __importDefault(require("util")); | ||
const node_util_1 = __importDefault(require("node:util")); | ||
const fs_1 = require("./util/fs"); | ||
@@ -25,7 +25,7 @@ const memoize_1 = require("./util/memoize"); | ||
} | ||
this.writeFile = (0, memoize_1.memoizeFn)(() => util_1.default.promisify(fs.writeFile.bind(fs))); | ||
this.removeFile = (0, memoize_1.memoizeFn)(() => util_1.default.promisify(fs.unlink.bind(fs))); | ||
this.mkdir = (0, memoize_1.memoizeFn)(() => util_1.default.promisify(fs.mkdir.bind(fs))); | ||
this.mkdirp = (0, memoize_1.memoizeFn)(() => util_1.default.promisify(fs_1.mkdirp.bind(null, fs))); | ||
this.removeDirAll = (0, memoize_1.memoizeFn)(() => util_1.default.promisify(fs_1.rmrf.bind(null, fs))); | ||
this.writeFile = (0, memoize_1.memoizeFn)(() => node_util_1.default.promisify(fs.writeFile.bind(fs))); | ||
this.removeFile = (0, memoize_1.memoizeFn)(() => node_util_1.default.promisify(fs.unlink.bind(fs))); | ||
this.mkdir = (0, memoize_1.memoizeFn)(() => node_util_1.default.promisify(fs.mkdir.bind(fs))); | ||
this.mkdirp = (0, memoize_1.memoizeFn)(() => node_util_1.default.promisify(fs_1.mkdirp.bind(null, fs))); | ||
this.removeDirAll = (0, memoize_1.memoizeFn)(() => node_util_1.default.promisify(fs_1.rmrf.bind(null, fs))); | ||
} | ||
@@ -32,0 +32,0 @@ static __to_binding(fs) { |
@@ -15,3 +15,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const assert_1 = __importDefault(require("assert")); | ||
const node_assert_1 = __importDefault(require("node:assert")); | ||
const builtin_plugin_1 = require("../builtin-plugin"); | ||
@@ -33,3 +33,3 @@ class EntryOptionPlugin { | ||
const options = EntryOptionPlugin.entryDescriptionToOptions(compiler, name, desc); | ||
(0, assert_1.default)(desc.import !== undefined, "desc.import should not be `undefined` once `EntryOptionPlugin.applyEntryOption` is called"); | ||
(0, node_assert_1.default)(desc.import !== undefined, "desc.import should not be `undefined` once `EntryOptionPlugin.applyEntryOption` is called"); | ||
for (const entry of desc.import) { | ||
@@ -36,0 +36,0 @@ new builtin_plugin_1.EntryPlugin(context, entry, options).apply(compiler); |
@@ -6,3 +6,3 @@ /* | ||
"use strict"; | ||
const inspect = require("util").inspect.custom; | ||
const inspect = require("node:util").inspect.custom; | ||
// /** @typedef {import("./Chunk")} Chunk */ | ||
@@ -9,0 +9,0 @@ // /** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */ |
@@ -29,4 +29,4 @@ "use strict"; | ||
const node_querystring_1 = __importDefault(require("node:querystring")); | ||
const assert_1 = __importDefault(require("assert")); | ||
const util_1 = require("util"); | ||
const node_assert_1 = __importDefault(require("node:assert")); | ||
const node_util_1 = require("node:util"); | ||
const binding_1 = require("@rspack/binding"); | ||
@@ -38,3 +38,3 @@ const webpack_sources_1 = require("../../compiled/webpack-sources"); | ||
const adapterRuleUse_1 = require("../config/adapterRuleUse"); | ||
const util_2 = require("../util"); | ||
const util_1 = require("../util"); | ||
const createHash_1 = require("../util/createHash"); | ||
@@ -128,3 +128,3 @@ const identifier_1 = require("../util/identifier"); | ||
set pitchExecuted(value) { | ||
(0, assert_1.default)(value); | ||
(0, node_assert_1.default)(value); | ||
__classPrivateFieldGet(this, _LoaderObject_loaderItem, "f").pitchExecuted = true; | ||
@@ -136,3 +136,3 @@ } | ||
set normalExecuted(value) { | ||
(0, assert_1.default)(value); | ||
(0, node_assert_1.default)(value); | ||
__classPrivateFieldGet(this, _LoaderObject_loaderItem, "f").normalExecuted = true; | ||
@@ -174,10 +174,10 @@ } | ||
static __from_binding(map) { | ||
return (0, util_2.isNil)(map) ? undefined : (0, util_2.toObject)(map); | ||
return (0, util_1.isNil)(map) ? undefined : (0, util_1.toObject)(map); | ||
} | ||
static __to_binding(map) { | ||
return (0, util_2.serializeObject)(map); | ||
return (0, util_1.serializeObject)(map); | ||
} | ||
} | ||
const loadLoaderAsync = (0, util_1.promisify)(loadLoader_1.default); | ||
const runSyncOrAsync = (0, util_1.promisify)(function runSyncOrAsync(fn, context, args, callback) { | ||
const loadLoaderAsync = (0, node_util_1.promisify)(loadLoader_1.default); | ||
const runSyncOrAsync = (0, node_util_1.promisify)(function runSyncOrAsync(fn, context, args, callback) { | ||
let isSync = true; | ||
@@ -524,5 +524,5 @@ let isDone = false; | ||
error.name = "ModuleError"; | ||
error.message = `${error.message} (from: ${(0, util_2.stringifyLoaderObject)(loaderContext.loaders[loaderContext.loaderIndex])})`; | ||
error.message = `${error.message} (from: ${(0, util_1.stringifyLoaderObject)(loaderContext.loaders[loaderContext.loaderIndex])})`; | ||
!hasStack && Error.captureStackTrace(error); | ||
error = (0, util_2.concatErrorMsgAndStack)(error); | ||
error = (0, util_1.concatErrorMsgAndStack)(error); | ||
error.moduleIdentifier = this._module.identifier(); | ||
@@ -540,5 +540,5 @@ compiler._lastCompilation.__internal__pushDiagnostic({ | ||
warning.name = "ModuleWarning"; | ||
warning.message = `${warning.message} (from: ${(0, util_2.stringifyLoaderObject)(loaderContext.loaders[loaderContext.loaderIndex])})`; | ||
warning.message = `${warning.message} (from: ${(0, util_1.stringifyLoaderObject)(loaderContext.loaders[loaderContext.loaderIndex])})`; | ||
hasStack && Error.captureStackTrace(warning); | ||
warning = (0, util_2.concatErrorMsgAndStack)(warning); | ||
warning = (0, util_1.concatErrorMsgAndStack)(warning); | ||
warning.moduleIdentifier = this._module.identifier(); | ||
@@ -671,4 +671,4 @@ compiler._lastCompilation.__internal__pushDiagnostic({ | ||
const [content, sourceMap, additionalData] = args; | ||
context.content = (0, util_2.isNil)(content) ? null : (0, util_2.toBuffer)(content); | ||
context.sourceMap = (0, util_2.serializeObject)(sourceMap); | ||
context.content = (0, util_1.isNil)(content) ? null : (0, util_1.toBuffer)(content); | ||
context.sourceMap = (0, util_1.serializeObject)(sourceMap); | ||
context.additionalData = additionalData; | ||
@@ -702,3 +702,3 @@ break; | ||
} | ||
context.content = (0, util_2.isNil)(content) ? null : (0, util_2.toBuffer)(content); | ||
context.content = (0, util_1.isNil)(content) ? null : (0, util_1.toBuffer)(content); | ||
context.sourceMap = JsSourceMap.__to_binding(sourceMap); | ||
@@ -705,0 +705,0 @@ context.additionalData = additionalData; |
@@ -19,3 +19,3 @@ "use strict"; | ||
if (url === undefined) | ||
url = require("url"); | ||
url = require("node:url"); | ||
var loaderUrl = url.pathToFileURL(loader.path); | ||
@@ -22,0 +22,0 @@ /** @type {Promise<any>} */ |
@@ -34,3 +34,3 @@ "use strict"; | ||
}; | ||
const util = __importStar(require("util")); | ||
const util = __importStar(require("node:util")); | ||
const truncateArgs_1 = require("../logging/truncateArgs"); | ||
@@ -37,0 +37,0 @@ module.exports = ({ colors, appendOnly, stream }) => { |
@@ -15,3 +15,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const util_1 = __importDefault(require("util")); | ||
const node_util_1 = __importDefault(require("node:util")); | ||
const watchpack_1 = __importDefault(require("../../compiled/watchpack")); | ||
@@ -95,3 +95,3 @@ class NodeWatchFileSystem { | ||
}, | ||
getAggregatedRemovals: util_1.default.deprecate(() => { | ||
getAggregatedRemovals: node_util_1.default.deprecate(() => { | ||
const items = this.watcher && this.watcher.aggregatedRemovals; | ||
@@ -106,3 +106,3 @@ if (items && this.inputFileSystem && this.inputFileSystem.purge) { | ||
}, "Watcher.getAggregatedRemovals is deprecated in favor of Watcher.getInfo since that's more performant.", "DEP_WEBPACK_WATCHER_GET_AGGREGATED_REMOVALS"), | ||
getAggregatedChanges: util_1.default.deprecate(() => { | ||
getAggregatedChanges: node_util_1.default.deprecate(() => { | ||
const items = this.watcher && this.watcher.aggregatedChanges; | ||
@@ -117,6 +117,6 @@ if (items && this.inputFileSystem && this.inputFileSystem.purge) { | ||
}, "Watcher.getAggregatedChanges is deprecated in favor of Watcher.getInfo since that's more performant.", "DEP_WEBPACK_WATCHER_GET_AGGREGATED_CHANGES"), | ||
getFileTimeInfoEntries: util_1.default.deprecate(() => { | ||
getFileTimeInfoEntries: node_util_1.default.deprecate(() => { | ||
return fetchTimeInfo().fileTimeInfoEntries; | ||
}, "Watcher.getFileTimeInfoEntries is deprecated in favor of Watcher.getInfo since that's more performant.", "DEP_WEBPACK_WATCHER_FILE_TIME_INFO_ENTRIES"), | ||
getContextTimeInfoEntries: util_1.default.deprecate(() => { | ||
getContextTimeInfoEntries: node_util_1.default.deprecate(() => { | ||
return fetchTimeInfo().contextTimeInfoEntries; | ||
@@ -123,0 +123,0 @@ }, "Watcher.getContextTimeInfoEntries is deprecated in favor of Watcher.getInfo since that's more performant.", "DEP_WEBPACK_WATCHER_CONTEXT_TIME_INFO_ENTRIES"), |
@@ -30,3 +30,3 @@ "use strict"; | ||
exports.NormalModule = void 0; | ||
const util_1 = __importDefault(require("util")); | ||
const node_util_1 = __importDefault(require("node:util")); | ||
const liteTapable = __importStar(require("@rspack/lite-tapable")); | ||
@@ -49,3 +49,3 @@ const Compilation_1 = require("./Compilation"); | ||
...descriptor, | ||
value: util_1.default.deprecate(descriptor.value, message, code) | ||
value: node_util_1.default.deprecate(descriptor.value, message, code) | ||
}); | ||
@@ -56,4 +56,4 @@ } | ||
...descriptor, | ||
get: descriptor.get && util_1.default.deprecate(descriptor.get, message, code), | ||
set: descriptor.set && util_1.default.deprecate(descriptor.set, message, code) | ||
get: descriptor.get && node_util_1.default.deprecate(descriptor.get, message, code), | ||
set: descriptor.set && node_util_1.default.deprecate(descriptor.set, message, code) | ||
}); | ||
@@ -66,5 +66,5 @@ } | ||
enumerable: descriptor.enumerable, | ||
get: util_1.default.deprecate(() => value, message, code), | ||
get: node_util_1.default.deprecate(() => value, message, code), | ||
set: descriptor.writable | ||
? util_1.default.deprecate((v) => (value = v), message, code) | ||
? node_util_1.default.deprecate((v) => (value = v), message, code) | ||
: undefined | ||
@@ -71,0 +71,0 @@ }); |
@@ -16,4 +16,4 @@ "use strict"; | ||
*/ | ||
const assert_1 = __importDefault(require("assert")); | ||
const util_1 = __importDefault(require("util")); | ||
const node_assert_1 = __importDefault(require("node:assert")); | ||
const node_util_1 = __importDefault(require("node:util")); | ||
const Compiler_1 = require("./Compiler"); | ||
@@ -28,3 +28,3 @@ const MultiCompiler_1 = require("./MultiCompiler"); | ||
const rspackOptionsApply_1 = require("./rspackOptionsApply"); | ||
const util_2 = require("./util"); | ||
const util_1 = require("./util"); | ||
const validate_1 = require("./util/validate"); | ||
@@ -45,3 +45,3 @@ function createMultiCompiler(options) { | ||
(0, config_1.applyRspackOptionsBaseDefaults)(options); | ||
(0, assert_1.default)(!(0, util_2.isNil)(options.context)); | ||
(0, node_assert_1.default)(!(0, util_1.isNil)(options.context)); | ||
const compiler = new Compiler_1.Compiler(options.context, options); | ||
@@ -74,3 +74,3 @@ new NodeEnvironmentPlugin_1.default({ | ||
try { | ||
for (const o of (0, util_2.asArray)(options)) { | ||
for (const o of (0, util_1.asArray)(options)) { | ||
(0, validate_1.validate)(o, config_1.rspackOptions); | ||
@@ -121,3 +121,3 @@ } | ||
if (watch) { | ||
util_1.default.deprecate(() => { }, "A 'callback' argument needs to be provided to the 'rspack(options, callback)' function when the 'watch' option is set. There is no way to handle the 'watch' option without a callback.")(); | ||
node_util_1.default.deprecate(() => { }, "A 'callback' argument needs to be provided to the 'rspack(options, callback)' function when the 'watch' option is set. There is no way to handle the 'watch' option without a callback.")(); | ||
} | ||
@@ -124,0 +124,0 @@ return compiler; |
@@ -16,3 +16,3 @@ "use strict"; | ||
*/ | ||
const assert_1 = __importDefault(require("assert")); | ||
const node_assert_1 = __importDefault(require("node:assert")); | ||
const graceful_fs_1 = __importDefault(require("../compiled/graceful-fs")); | ||
@@ -30,3 +30,3 @@ const Module_1 = require("./Module"); | ||
process(options, compiler) { | ||
(0, assert_1.default)(options.output.path, "options.output.path should have value after `applyRspackOptionsDefaults`"); | ||
(0, node_assert_1.default)(options.output.path, "options.output.path should have value after `applyRspackOptionsDefaults`"); | ||
compiler.outputPath = options.output.path; | ||
@@ -36,3 +36,3 @@ compiler.name = options.name; | ||
if (options.externals) { | ||
(0, assert_1.default)(options.externalsType, "options.externalsType should have value after `applyRspackOptionsDefaults`"); | ||
(0, node_assert_1.default)(options.externalsType, "options.externalsType should have value after `applyRspackOptionsDefaults`"); | ||
new builtin_plugin_1.ExternalsPlugin(options.externalsType, options.externals).apply(compiler); | ||
@@ -39,0 +39,0 @@ } |
@@ -186,5 +186,5 @@ "use strict"; | ||
groupByNames("chunkNames"); | ||
// groupByNames("auxiliaryChunkNames"); | ||
// groupByNames("chunkIdHints"); | ||
// groupByNames("auxiliaryChunkIdHints"); | ||
groupByNames("auxiliaryChunkNames"); | ||
groupByNames("chunkIdHints"); | ||
groupByNames("auxiliaryChunkIdHints"); | ||
}, | ||
@@ -627,5 +627,35 @@ excludeAssets: (groupConfigs, context, { excludeAssets }) => { | ||
assets: (object, compilation, context, options, factory) => { | ||
const { assets, assetsByChunkName } = context | ||
const { assets: compilationAssets, assetsByChunkName } = context | ||
.getInner(compilation) | ||
.getAssets(); | ||
const assetMap = new Map(); | ||
const assets = new Set(); | ||
for (const asset of compilationAssets) { | ||
const item = { | ||
...asset, | ||
type: "asset", | ||
related: [] | ||
}; | ||
assets.add(item); | ||
assetMap.set(asset.name, item); | ||
} | ||
for (const item of assetMap.values()) { | ||
const related = item.info.related; | ||
if (!related) | ||
continue; | ||
for (const { name: type, value: relatedEntry } of related) { | ||
const deps = Array.isArray(relatedEntry) | ||
? relatedEntry | ||
: [relatedEntry]; | ||
for (const dep of deps) { | ||
const depItem = assetMap.get(dep); | ||
if (!depItem) | ||
continue; | ||
assets.delete(depItem); | ||
depItem.type = type; | ||
item.related = item.related || []; | ||
item.related.push(depItem); | ||
} | ||
} | ||
} | ||
object.assetsByChunkName = assetsByChunkName.reduce((acc, cur) => { | ||
@@ -635,3 +665,3 @@ acc[cur.name] = cur.files; | ||
}, {}); | ||
const groupedAssets = factory.create(`${context.type}.assets`, assets, { | ||
const groupedAssets = factory.create(`${context.type}.assets`, Array.from(assets), { | ||
...context | ||
@@ -642,5 +672,4 @@ // compilationFileToChunks | ||
const limited = (0, statsFactoryUtils_1.spaceLimited)(groupedAssets, options.assetsSpace || Number.POSITIVE_INFINITY); | ||
// object.filteredAssets = limited.filteredChildren; | ||
// const limited = spaceLimited(groupedAssets, options.assetsSpace); | ||
object.assets = limited.children; | ||
object.filteredAssets = limited.filteredChildren; | ||
}, | ||
@@ -745,11 +774,17 @@ chunks: (object, compilation, context, options, factory) => { | ||
object.chunkNames = asset.chunkNames; | ||
// - chunkIdHints | ||
// - auxiliaryChunkNames | ||
// - auxiliaryChunkIdHints | ||
// - filteredRelated | ||
object.chunkIdHints = asset.chunkIdHints.filter(Boolean); | ||
object.auxiliaryChunkNames = asset.auxiliaryChunkNames; | ||
object.auxiliaryChunkIdHints = | ||
asset.auxiliaryChunkIdHints.filter(Boolean); | ||
}, | ||
// relatedAssets | ||
relatedAssets: (object, asset, context, options, factory) => { | ||
const { type } = context; | ||
object.related = factory.create(`${type.slice(0, -8)}.related`, asset.related, context); | ||
object.filteredRelated = asset.related | ||
? asset.related.length - object.related.length | ||
: undefined; | ||
}, | ||
ids: (object, asset) => { | ||
object.chunks = asset.chunks; | ||
// - auxiliaryChunks | ||
object.auxiliaryChunks = asset.auxiliaryChunks; | ||
} | ||
@@ -756,0 +791,0 @@ }, |
@@ -84,3 +84,3 @@ "use strict"; | ||
else { | ||
statusMessage = `compiled`; | ||
statusMessage = "compiled"; | ||
} | ||
@@ -87,0 +87,0 @@ if (builtAtMessage || |
@@ -5,16 +5,15 @@ import type * as binding from "@rspack/binding"; | ||
import type { StatsFactory, StatsFactoryContext } from "./StatsFactory"; | ||
type Writable<T> = { | ||
-readonly [K in keyof T]: T[K]; | ||
}; | ||
export type KnownStatsChunkGroup = binding.JsStatsChunkGroup; | ||
export type KnownStatsChunk = Omit<binding.JsStatsChunk, "sizes"> & { | ||
export type KnownStatsChunk = Omit<Writable<binding.JsStatsChunk>, "sizes"> & { | ||
sizes: Record<string, number>; | ||
}; | ||
export type KnownStatsAssetInfo = Omit<binding.JsStatsAssetInfo, "related"> & { | ||
related: Record<string, string[]>; | ||
}; | ||
export type KnownStatsAssetInfo = Omit<binding.JsStatsAssetInfo, "related">; | ||
export type StatsChunkGroup = binding.JsStatsChunkGroup & Record<string, any>; | ||
export type KnownStatsAsset = Omit<binding.JsStatsAsset, "info"> & { | ||
info: KnownStatsAssetInfo; | ||
}; | ||
export type KnownStatsAsset = Omit<binding.JsStatsAsset, "info">; | ||
export type StatsAsset = KnownStatsAsset & Record<string, any>; | ||
export type StatsChunk = KnownStatsChunk & Record<string, any>; | ||
export type KnownStatsModule = Omit<binding.JsStatsModule, "usedExports" | "providedExports" | "optimizationBailout" | "sizes"> & { | ||
export type KnownStatsModule = Omit<Writable<binding.JsStatsModule>, "usedExports" | "providedExports" | "optimizationBailout" | "sizes"> & { | ||
profile?: StatsProfile; | ||
@@ -46,3 +45,3 @@ usedExports?: null | string[] | boolean; | ||
}; | ||
export type StatsModuleReason = binding.JsStatsModuleReason & Record<string, any>; | ||
export type StatsModuleReason = Writable<binding.JsStatsModuleReason> & Record<string, any>; | ||
export type KnownStatsCompilation = { | ||
@@ -103,3 +102,3 @@ /** | ||
}; | ||
type PreprocessedAsset = StatsAsset & { | ||
export type PreprocessedAsset = StatsAsset & { | ||
type: string; | ||
@@ -106,0 +105,0 @@ related: PreprocessedAsset[]; |
@@ -7,4 +7,4 @@ "use strict"; | ||
exports.checkVersion = void 0; | ||
const fs_1 = require("fs"); | ||
const path_1 = __importDefault(require("path")); | ||
const node_fs_1 = require("node:fs"); | ||
const node_path_1 = __importDefault(require("node:path")); | ||
const NodePlatformArchToAbi = { | ||
@@ -43,7 +43,7 @@ android: { | ||
try { | ||
const lddPath = require("child_process") | ||
const lddPath = require("node:child_process") | ||
.execSync("which ldd") | ||
.toString() | ||
.trim(); | ||
return (0, fs_1.readFileSync)(lddPath, "utf8").includes("musl"); | ||
return (0, node_fs_1.readFileSync)(lddPath, "utf8").includes("musl"); | ||
} | ||
@@ -101,4 +101,4 @@ catch (e) { | ||
try { | ||
const BINDING_PKG_DIR = path_1.default.dirname(require.resolve("@rspack/binding/package.json")); | ||
const isLocal = (0, fs_1.readdirSync)(BINDING_PKG_DIR).some(item => item === `rspack.${platformArchAbi}.node`); | ||
const BINDING_PKG_DIR = node_path_1.default.dirname(require.resolve("@rspack/binding/package.json")); | ||
const isLocal = (0, node_fs_1.readdirSync)(BINDING_PKG_DIR).some(item => item === `rspack.${platformArchAbi}.node`); | ||
if (isLocal) { | ||
@@ -105,0 +105,0 @@ // Treat addon version the same as binding version if running locally |
@@ -162,7 +162,7 @@ "use strict"; | ||
if (crypto === undefined) | ||
crypto = require("crypto"); | ||
crypto = require("node:crypto"); | ||
return new BulkUpdateDecorator(() => crypto.createHash("md4"), "md4"); | ||
default: | ||
if (crypto === undefined) | ||
crypto = require("crypto"); | ||
crypto = require("node:crypto"); | ||
return new BulkUpdateDecorator(() => crypto.createHash(algorithm), algorithm); | ||
@@ -169,0 +169,0 @@ } |
@@ -16,4 +16,4 @@ "use strict"; | ||
exports.mkdirp = exports.rmrf = void 0; | ||
const assert_1 = __importDefault(require("assert")); | ||
const path_1 = __importDefault(require("path")); | ||
const node_assert_1 = __importDefault(require("node:assert")); | ||
const node_path_1 = __importDefault(require("node:path")); | ||
function rmrf(fs, p, callback) { | ||
@@ -38,3 +38,3 @@ fs.stat(p, (err, stats) => { | ||
files.forEach(file => { | ||
(0, assert_1.default)(typeof file === "string"); | ||
(0, node_assert_1.default)(typeof file === "string"); | ||
const fullPath = join(fs, p, file); | ||
@@ -64,7 +64,7 @@ rmrf(fs, fullPath, err => { | ||
} | ||
else if (path_1.default.posix.isAbsolute(rootPath)) { | ||
return path_1.default.posix.join(rootPath, filename); | ||
else if (node_path_1.default.posix.isAbsolute(rootPath)) { | ||
return node_path_1.default.posix.join(rootPath, filename); | ||
} | ||
else if (path_1.default.win32.isAbsolute(rootPath)) { | ||
return path_1.default.win32.join(rootPath, filename); | ||
else if (node_path_1.default.win32.isAbsolute(rootPath)) { | ||
return node_path_1.default.win32.join(rootPath, filename); | ||
} | ||
@@ -79,7 +79,7 @@ else { | ||
} | ||
else if (path_1.default.posix.isAbsolute(absPath)) { | ||
return path_1.default.posix.dirname(absPath); | ||
else if (node_path_1.default.posix.isAbsolute(absPath)) { | ||
return node_path_1.default.posix.dirname(absPath); | ||
} | ||
else if (path_1.default.win32.isAbsolute(absPath)) { | ||
return path_1.default.win32.dirname(absPath); | ||
else if (node_path_1.default.win32.isAbsolute(absPath)) { | ||
return node_path_1.default.win32.dirname(absPath); | ||
} | ||
@@ -86,0 +86,0 @@ else { |
@@ -10,3 +10,3 @@ "use strict"; | ||
exports.getUndoPath = exports.parseResourceWithoutFragment = exports.parseResource = exports.absolutify = exports.contextify = exports.makePathsAbsolute = exports.makePathsRelative = void 0; | ||
const path_1 = __importDefault(require("path")); | ||
const node_path_1 = __importDefault(require("node:path")); | ||
const WINDOWS_ABS_PATH_REGEXP = /^[a-zA-Z]:[\\/]/; | ||
@@ -41,3 +41,3 @@ const SEGMENTS_SPLIT_REGEXP = /([|!])/; | ||
: maybeAbsolutePath.slice(0, querySplitPos); | ||
resource = relativePathToRequest(path_1.default.posix.relative(context, resource)); | ||
resource = relativePathToRequest(node_path_1.default.posix.relative(context, resource)); | ||
return querySplitPos === -1 | ||
@@ -52,3 +52,3 @@ ? resource | ||
: maybeAbsolutePath.slice(0, querySplitPos); | ||
resource = path_1.default.win32.relative(context, resource); | ||
resource = node_path_1.default.win32.relative(context, resource); | ||
if (!WINDOWS_ABS_PATH_REGEXP.test(resource)) { | ||
@@ -71,3 +71,3 @@ resource = relativePathToRequest(resource.replace(WINDOWS_PATH_SEPARATOR_REGEXP, "/")); | ||
if (relativePath.startsWith("./") || relativePath.startsWith("../")) | ||
return path_1.default.join(context, relativePath); | ||
return node_path_1.default.join(context, relativePath); | ||
return relativePath; | ||
@@ -74,0 +74,0 @@ }; |
@@ -28,3 +28,3 @@ "use strict"; | ||
*/ | ||
const assert_1 = __importDefault(require("assert")); | ||
const node_assert_1 = __importDefault(require("node:assert")); | ||
const _1 = require("."); | ||
@@ -190,3 +190,3 @@ class Watching { | ||
} | ||
(0, assert_1.default)(compilation); | ||
(0, node_assert_1.default)(compilation); | ||
compilation.startTime = startTime; | ||
@@ -193,0 +193,0 @@ compilation.endTime = Date.now(); |
{ | ||
"name": "@rspack/core", | ||
"version": "1.0.0-alpha.4", | ||
"version": "1.0.0-alpha.5", | ||
"webpackVersion": "5.75.0", | ||
@@ -61,4 +61,4 @@ "license": "MIT", | ||
"caniuse-lite": "^1.0.30001616", | ||
"@rspack/lite-tapable": "1.0.0-alpha.4", | ||
"@rspack/binding": "1.0.0-alpha.4" | ||
"@rspack/binding": "1.0.0-alpha.5", | ||
"@rspack/lite-tapable": "1.0.0-alpha.5" | ||
}, | ||
@@ -65,0 +65,0 @@ "peerDependencies": { |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
2563358
65316
44
5
18
2
142186
+ Added@rspack/binding@1.0.0-alpha.5(transitive)
+ Added@rspack/binding-darwin-arm64@1.0.0-alpha.5(transitive)
+ Added@rspack/binding-darwin-x64@1.0.0-alpha.5(transitive)
+ Added@rspack/binding-linux-arm64-gnu@1.0.0-alpha.5(transitive)
+ Added@rspack/binding-linux-arm64-musl@1.0.0-alpha.5(transitive)
+ Added@rspack/binding-linux-x64-gnu@1.0.0-alpha.5(transitive)
+ Added@rspack/binding-linux-x64-musl@1.0.0-alpha.5(transitive)
+ Added@rspack/binding-win32-arm64-msvc@1.0.0-alpha.5(transitive)
+ Added@rspack/binding-win32-ia32-msvc@1.0.0-alpha.5(transitive)
+ Added@rspack/binding-win32-x64-msvc@1.0.0-alpha.5(transitive)
+ Added@rspack/lite-tapable@1.0.0-alpha.5(transitive)
- Removed@rspack/binding@1.0.0-alpha.4(transitive)
- Removed@rspack/binding-darwin-arm64@1.0.0-alpha.4(transitive)
- Removed@rspack/binding-darwin-x64@1.0.0-alpha.4(transitive)
- Removed@rspack/binding-linux-arm64-gnu@1.0.0-alpha.4(transitive)
- Removed@rspack/binding-linux-arm64-musl@1.0.0-alpha.4(transitive)
- Removed@rspack/binding-linux-x64-gnu@1.0.0-alpha.4(transitive)
- Removed@rspack/binding-linux-x64-musl@1.0.0-alpha.4(transitive)
- Removed@rspack/binding-win32-arm64-msvc@1.0.0-alpha.4(transitive)
- Removed@rspack/binding-win32-ia32-msvc@1.0.0-alpha.4(transitive)
- Removed@rspack/binding-win32-x64-msvc@1.0.0-alpha.4(transitive)
- Removed@rspack/lite-tapable@1.0.0-alpha.4(transitive)