Socket
Socket
Sign inDemoInstall

@rspack/core

Package Overview
Dependencies
Maintainers
2
Versions
1084
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rspack/core - npm Package Compare versions

Comparing version 1.0.0-alpha.5 to 1.0.0-beta.0

dist/builtin-loader/lightningcss/index.d.ts

12

compiled/zod-validation-error/index.js

@@ -5,3 +5,3 @@ /******/ (() => { // webpackBootstrap

/***/ 479:
/***/ 381:
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {

@@ -36,4 +36,4 @@

const zod = __importStar(__nccwpck_require__(934));
const joinPath_1 = __nccwpck_require__(14);
const NonEmptyArray_1 = __nccwpck_require__(80);
const joinPath_1 = __nccwpck_require__(954);
const NonEmptyArray_1 = __nccwpck_require__(978);
class ValidationError extends Error {

@@ -109,3 +109,3 @@ details;

/***/ 80:
/***/ 978:
/***/ ((__unused_webpack_module, exports) => {

@@ -124,3 +124,3 @@

/***/ 14:
/***/ 954:
/***/ ((__unused_webpack_module, exports) => {

@@ -210,3 +210,3 @@

exports.fromZodError = exports.isValidationErrorLike = exports.isValidationError = exports.toValidationError = exports.ValidationError = void 0;
var ValidationError_1 = __nccwpck_require__(479);
var ValidationError_1 = __nccwpck_require__(381);
Object.defineProperty(exports, "ValidationError", ({ enumerable: true, get: function () { return ValidationError_1.ValidationError; } }));

@@ -213,0 +213,0 @@ Object.defineProperty(exports, "toValidationError", ({ enumerable: true, get: function () { return ValidationError_1.toValidationError; } }));

@@ -1,1 +0,1 @@

{"name":"zod","author":"Colin McDonnell <colin@colinhacks.com>","version":"3.22.4","funding":"https://github.com/sponsors/colinhacks","license":"MIT","types":"index.d.ts","type":"commonjs"}
{"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"}

@@ -57,35 +57,27 @@ import { BuiltinPluginName, type JsChunk } from "@rspack/binding";

}, "strict", z.ZodTypeAny, {
banner: (string | ((args_0: {
banner: string | ((args_0: {
hash: string;
chunk: JsChunk;
filename: string;
}, ...args_1: unknown[]) => string)) & (string | ((args_0: {
hash: string;
chunk: JsChunk;
filename: string;
}, ...args_1: unknown[]) => string) | undefined);
entryOnly?: boolean | undefined;
}, ...args_1: unknown[]) => string);
test?: string | RegExp | (string | RegExp)[] | undefined;
exclude?: string | RegExp | (string | RegExp)[] | undefined;
include?: string | RegExp | (string | RegExp)[] | undefined;
entryOnly?: boolean | undefined;
raw?: boolean | undefined;
footer?: boolean | undefined;
stage?: number | undefined;
test?: string | RegExp | (string | RegExp)[] | undefined;
}, {
banner: (string | ((args_0: {
banner: string | ((args_0: {
hash: string;
chunk: JsChunk;
filename: string;
}, ...args_1: unknown[]) => string)) & (string | ((args_0: {
hash: string;
chunk: JsChunk;
filename: string;
}, ...args_1: unknown[]) => string) | undefined);
entryOnly?: boolean | undefined;
}, ...args_1: unknown[]) => string);
test?: string | RegExp | (string | RegExp)[] | undefined;
exclude?: string | RegExp | (string | RegExp)[] | undefined;
include?: string | RegExp | (string | RegExp)[] | undefined;
entryOnly?: boolean | undefined;
raw?: boolean | undefined;
footer?: boolean | undefined;
stage?: number | undefined;
test?: string | RegExp | (string | RegExp)[] | undefined;
}>;

@@ -127,35 +119,27 @@ export type BannerPluginOptions = z.infer<typeof bannerPluginOptions>;

}, "strict", z.ZodTypeAny, {
banner: (string | ((args_0: {
banner: string | ((args_0: {
hash: string;
chunk: JsChunk;
filename: string;
}, ...args_1: unknown[]) => string)) & (string | ((args_0: {
hash: string;
chunk: JsChunk;
filename: string;
}, ...args_1: unknown[]) => string) | undefined);
entryOnly?: boolean | undefined;
}, ...args_1: unknown[]) => string);
test?: string | RegExp | (string | RegExp)[] | undefined;
exclude?: string | RegExp | (string | RegExp)[] | undefined;
include?: string | RegExp | (string | RegExp)[] | undefined;
entryOnly?: boolean | undefined;
raw?: boolean | undefined;
footer?: boolean | undefined;
stage?: number | undefined;
test?: string | RegExp | (string | RegExp)[] | undefined;
}, {
banner: (string | ((args_0: {
banner: string | ((args_0: {
hash: string;
chunk: JsChunk;
filename: string;
}, ...args_1: unknown[]) => string)) & (string | ((args_0: {
hash: string;
chunk: JsChunk;
filename: string;
}, ...args_1: unknown[]) => string) | undefined);
entryOnly?: boolean | undefined;
}, ...args_1: unknown[]) => string);
test?: string | RegExp | (string | RegExp)[] | undefined;
exclude?: string | RegExp | (string | RegExp)[] | undefined;
include?: string | RegExp | (string | RegExp)[] | undefined;
entryOnly?: boolean | undefined;
raw?: boolean | undefined;
footer?: boolean | undefined;
stage?: number | undefined;
test?: string | RegExp | (string | RegExp)[] | undefined;
}>]>;

@@ -169,18 +153,14 @@ export type BannerPluginArgument = z.infer<typeof bannerPluginArgument>;

}, ...args_1: unknown[]) => string) | {
banner: (string | ((args_0: {
banner: string | ((args_0: {
hash: string;
chunk: JsChunk;
filename: string;
}, ...args_1: unknown[]) => string)) & (string | ((args_0: {
hash: string;
chunk: JsChunk;
filename: string;
}, ...args_1: unknown[]) => string) | undefined);
entryOnly?: boolean | undefined;
}, ...args_1: unknown[]) => string);
test?: string | RegExp | (string | RegExp)[] | undefined;
exclude?: string | RegExp | (string | RegExp)[] | undefined;
include?: string | RegExp | (string | RegExp)[] | undefined;
entryOnly?: boolean | undefined;
raw?: boolean | undefined;
footer?: boolean | undefined;
stage?: number | undefined;
test?: string | RegExp | (string | RegExp)[] | undefined;
}): {

@@ -193,18 +173,14 @@ name: BuiltinPluginName;

}, ...args_1: unknown[]) => string) | {
banner: (string | ((args_0: {
banner: string | ((args_0: {
hash: string;
chunk: JsChunk;
filename: string;
}, ...args_1: unknown[]) => string)) & (string | ((args_0: {
hash: string;
chunk: JsChunk;
filename: string;
}, ...args_1: unknown[]) => string) | undefined);
entryOnly?: boolean | undefined;
}, ...args_1: unknown[]) => string);
test?: string | RegExp | (string | RegExp)[] | undefined;
exclude?: string | RegExp | (string | RegExp)[] | undefined;
include?: string | RegExp | (string | RegExp)[] | undefined;
entryOnly?: boolean | undefined;
raw?: boolean | undefined;
footer?: boolean | undefined;
stage?: number | undefined;
test?: string | RegExp | (string | RegExp)[] | undefined;
}];

@@ -211,0 +187,0 @@ affectedHooks: "done" | "compilation" | "failed" | "environment" | "emit" | "make" | "compile" | "afterEmit" | "invalid" | "thisCompilation" | "afterDone" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "shutdown" | "watchRun" | "watchClose" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | undefined;

@@ -18,5 +18,3 @@ "use strict";

}
else {
return !exports.HOOKS_CAN_NOT_INHERENT_FROM_PARENT.includes(affectedHooks);
}
return !exports.HOOKS_CAN_NOT_INHERENT_FROM_PARENT.includes(affectedHooks);
}

@@ -23,0 +21,0 @@ exports.canInherentFromParent = canInherentFromParent;

@@ -1,3 +0,3 @@

declare function _exports(moduleId: TODO, options: TODO): TODO;
export = _exports;
export type TODO = any;
declare function noop(): void;
declare function cssReload(moduleId: string, options: Record<string, any>): typeof noop;
export { cssReload };
"use strict";
/* eslint-env browser */
/*
eslint-disable
no-console,
func-names
*/
/** @typedef {any} TODO */
const normalizeUrl = require("./normalize-url");
Object.defineProperty(exports, "__esModule", { value: true });
exports.cssReload = void 0;
const normalizeUrl_1 = require("./normalizeUrl");
const srcByModuleId = Object.create(null);
const noDocument = typeof document === "undefined";
const { forEach } = Array.prototype;
/**
* @param {function} fn
* @param {number} time
* @returns {(function(): void)|*}
*/
function debounce(fn, time) {

@@ -23,3 +13,2 @@ let timeout = 0;

const self = this;
// eslint-disable-next-line prefer-rest-params
const args = arguments;

@@ -30,3 +19,2 @@ const functionCall = function functionCall() {

clearTimeout(timeout);
// @ts-ignore
timeout = setTimeout(functionCall, time);

@@ -36,6 +24,2 @@ };

function noop() { }
/**
* @param {TODO} moduleId
* @returns {TODO}
*/
function getCurrentScriptUrl(moduleId) {

@@ -45,3 +29,3 @@ let src = srcByModuleId[moduleId];

if (document.currentScript) {
({ src } = /** @type {HTMLScriptElement} */ (document.currentScript));
({ src } = document.currentScript);
}

@@ -57,6 +41,2 @@ else {

}
/**
* @param {string} fileMap
* @returns {null | string[]}
*/
return function (fileMap) {

@@ -76,10 +56,6 @@ if (!src) {

const reg = new RegExp(`${filename}\\.js$`, "g");
return normalizeUrl(src.replace(reg, `${mapRule.replace(/{fileName}/g, filename)}.css`));
return (0, normalizeUrl_1.normalizeUrl)(src.replace(reg, `${mapRule.replace(/{fileName}/g, filename)}.css`));
});
};
}
/**
* @param {TODO} el
* @param {string} [url]
*/
function updateCss(el, url) {

@@ -90,6 +66,5 @@ if (!url) {

}
// eslint-disable-next-line
url = el.href.split("?")[0];
}
if (!isUrlRequest(/** @type {string} */ (url))) {
if (!isUrlRequest(url)) {
return;

@@ -105,3 +80,2 @@ }

}
// eslint-disable-next-line no-param-reassign
el.visited = true;

@@ -115,3 +89,3 @@ const newEl = el.cloneNode();

newEl.isLoaded = true;
el.parentNode.removeChild(el);
el.parentNode?.removeChild(el);
});

@@ -123,27 +97,16 @@ newEl.addEventListener("error", () => {

newEl.isLoaded = true;
el.parentNode.removeChild(el);
el.parentNode?.removeChild(el);
});
newEl.href = `${url}?${Date.now()}`;
if (el.nextSibling) {
el.parentNode.insertBefore(newEl, el.nextSibling);
el.parentNode?.insertBefore(newEl, el.nextSibling);
}
else {
el.parentNode.appendChild(newEl);
el.parentNode?.appendChild(newEl);
}
}
/**
* @param {string} href
* @param {TODO} src
* @returns {TODO}
*/
function getReloadUrl(href, src) {
let ret;
// eslint-disable-next-line no-param-reassign
href = normalizeUrl(href);
src.some(
/**
* @param {string} url
*/
// eslint-disable-next-line array-callback-return
url => {
let ret = "";
href = (0, normalizeUrl_1.normalizeUrl)(href);
src.some(url => {
if (href.indexOf(src) > -1) {

@@ -155,6 +118,2 @@ ret = url;

}
/**
* @param {string} [src]
* @returns {boolean}
*/
function reloadStyle(src) {

@@ -193,6 +152,2 @@ if (!src) {

}
/**
* @param {string} url
* @returns {boolean}
*/
function isUrlRequest(url) {

@@ -206,8 +161,3 @@ // An URL is not an request if

}
/**
* @param {TODO} moduleId
* @param {TODO} options
* @returns {TODO}
*/
module.exports = function (moduleId, options) {
function cssReload(moduleId, options) {
if (noDocument) {

@@ -227,3 +177,3 @@ console.log("no window.document found, will not HMR CSS");

if (reloaded) {
console.log("[HMR] css reload %s", src.join(" "));
console.log("[HMR] css reload %s", src?.join(" "));
}

@@ -236,2 +186,3 @@ else {

return debounce(update, 50);
};
}
exports.cssReload = cssReload;

@@ -24,3 +24,3 @@ "use strict";

// ${Date.now()}
var cssReload = require(${(0, utils_1.stringifyRequest)(context.loaderContext, node_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"))}).cssReload(module.id, ${JSON.stringify({
...context.options,

@@ -105,3 +105,3 @@ locals: !!context.locals

if (namedExport) {
Object.keys(originalExports).forEach(key => {
for (const key of Object.keys(originalExports)) {
if (key !== "default") {

@@ -113,3 +113,3 @@ if (!locals) {

}
});
}
}

@@ -177,3 +177,3 @@ else {

}
else if (esModule) {
if (esModule) {
return "\nexport {};";

@@ -209,3 +209,3 @@ }

this.importModule(`${this.resourcePath}.webpack[javascript/auto]!=!!!${request}`, {
publicPath: /** @type {string} */ publicPathForExtract,
publicPath: /** @type {Filename} */ publicPathForExtract,
baseUri: `${exports.BASE_URI}/`

@@ -212,0 +212,0 @@ }, (error, exports) => {

@@ -15,18 +15,16 @@ "use strict";

}
else if (Object.is(p, -0)) {
if (Object.is(p, -0)) {
return "-0";
}
else if (p instanceof RegExp) {
if (p instanceof RegExp) {
return p.toString();
}
else if (typeof p === "function") {
if (typeof p === "function") {
return "(" + p.toString() + ")";
}
else if (typeof p === "bigint") {
if (typeof p === "bigint") {
return supportsBigIntLiteral ? `${p}n` : `BigInt("${p}")`;
}
else {
// assume `p` is a valid JSON value
return p;
}
// assume `p` is a valid JSON value
return p;
};

@@ -37,14 +35,12 @@ const normalizeObject = (define) => {

}
else if (define instanceof RegExp) {
if (define instanceof RegExp) {
return normalizePrimitive(define);
}
else if (define && typeof define === "object") {
if (define && typeof define === "object") {
const keys = Object.keys(define);
return Object.fromEntries(keys.map(k => [k, normalizeObject(define[k])]));
}
else {
return normalizePrimitive(define);
}
return normalizePrimitive(define);
};
return normalizeObject(define);
};
import { BuiltinPluginName, type RawEntryOptions } from "@rspack/binding";
import { type ChunkLoading, type EntryRuntime, type FilenameTemplate, type LibraryOptions, type PublicPath } from "../config";
import { type ChunkLoading, type EntryRuntime, type Filename, type LibraryOptions, type PublicPath } from "../config";
export type EntryOptions = {

@@ -10,3 +10,3 @@ name?: string;

baseUri?: string;
filename?: FilenameTemplate;
filename?: Filename;
library?: LibraryOptions;

@@ -13,0 +13,0 @@ dependOn?: string[];

@@ -7,2 +7,5 @@ import { BuiltinPluginName } from "@rspack/binding";

request?: string | undefined;
contextInfo?: {
issuer: string;
} | undefined;
}, args_1: (args_0: Error | undefined, args_1: string | boolean | string[] | Record<string, string | string[]> | undefined, args_2: "promise" | "module" | "commonjs" | "umd" | "amd" | "jsonp" | "import" | "commonjs2" | "var" | "assign" | "this" | "window" | "self" | "global" | "commonjs-module" | "commonjs-static" | "amd-require" | "umd2" | "system" | "script" | "node-commonjs" | undefined, ...args_3: unknown[]) => void, ...args_2: unknown[]) => unknown) | ((args_0: {

@@ -12,2 +15,5 @@ context?: string | undefined;

request?: string | undefined;
contextInfo?: {
issuer: string;
} | undefined;
}, ...args_1: unknown[]) => Promise<string | boolean | string[] | Record<string, string | string[]>>) | (string | RegExp | Record<string, string | boolean | string[] | Record<string, string | string[]>> | ((args_0: {

@@ -17,2 +23,5 @@ context?: string | undefined;

request?: string | undefined;
contextInfo?: {
issuer: string;
} | undefined;
}, args_1: (args_0: Error | undefined, args_1: string | boolean | string[] | Record<string, string | string[]> | undefined, args_2: "promise" | "module" | "commonjs" | "umd" | "amd" | "jsonp" | "import" | "commonjs2" | "var" | "assign" | "this" | "window" | "self" | "global" | "commonjs-module" | "commonjs-static" | "amd-require" | "umd2" | "system" | "script" | "node-commonjs" | undefined, ...args_3: unknown[]) => void, ...args_2: unknown[]) => unknown) | ((args_0: {

@@ -22,2 +31,5 @@ context?: string | undefined;

request?: string | undefined;
contextInfo?: {
issuer: string;
} | undefined;
}, ...args_1: unknown[]) => Promise<string | boolean | string[] | Record<string, string | string[]>>))[]): {

@@ -29,2 +41,5 @@ name: BuiltinPluginName;

request?: string | undefined;
contextInfo?: {
issuer: string;
} | undefined;
}, args_1: (args_0: Error | undefined, args_1: string | boolean | string[] | Record<string, string | string[]> | undefined, args_2: "promise" | "module" | "commonjs" | "umd" | "amd" | "jsonp" | "import" | "commonjs2" | "var" | "assign" | "this" | "window" | "self" | "global" | "commonjs-module" | "commonjs-static" | "amd-require" | "umd2" | "system" | "script" | "node-commonjs" | undefined, ...args_3: unknown[]) => void, ...args_2: unknown[]) => unknown) | ((args_0: {

@@ -34,2 +49,5 @@ context?: string | undefined;

request?: string | undefined;
contextInfo?: {
issuer: string;
} | undefined;
}, ...args_1: unknown[]) => Promise<string | boolean | string[] | Record<string, string | string[]>>) | (string | RegExp | Record<string, string | boolean | string[] | Record<string, string | string[]>> | ((args_0: {

@@ -39,2 +57,5 @@ context?: string | undefined;

request?: string | undefined;
contextInfo?: {
issuer: string;
} | undefined;
}, args_1: (args_0: Error | undefined, args_1: string | boolean | string[] | Record<string, string | string[]> | undefined, args_2: "promise" | "module" | "commonjs" | "umd" | "amd" | "jsonp" | "import" | "commonjs2" | "var" | "assign" | "this" | "window" | "self" | "global" | "commonjs-module" | "commonjs-static" | "amd-require" | "umd2" | "system" | "script" | "node-commonjs" | undefined, ...args_3: unknown[]) => void, ...args_2: unknown[]) => unknown) | ((args_0: {

@@ -44,2 +65,5 @@ context?: string | undefined;

request?: string | undefined;
contextInfo?: {
issuer: string;
} | undefined;
}, ...args_1: unknown[]) => Promise<string | boolean | string[] | Record<string, string | string[]>>))[]];

@@ -46,0 +70,0 @@ affectedHooks: "done" | "compilation" | "failed" | "environment" | "emit" | "make" | "compile" | "afterEmit" | "invalid" | "thisCompilation" | "afterDone" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "shutdown" | "watchRun" | "watchClose" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | undefined;

@@ -19,2 +19,4 @@ import { BuiltinPluginName } from "@rspack/binding";

}, "strict", z.ZodTypeAny, {
chunks?: string[] | undefined;
publicPath?: string | undefined;
filename?: string | undefined;

@@ -25,5 +27,3 @@ template?: string | undefined;

inject?: boolean | "head" | "body" | undefined;
publicPath?: string | undefined;
scriptLoading?: "module" | "blocking" | "defer" | undefined;
chunks?: string[] | undefined;
excludedChunks?: string[] | undefined;

@@ -36,2 +36,4 @@ sri?: "sha256" | "sha384" | "sha512" | undefined;

}, {
chunks?: string[] | undefined;
publicPath?: string | undefined;
filename?: string | undefined;

@@ -42,5 +44,3 @@ template?: string | undefined;

inject?: boolean | "head" | "body" | undefined;
publicPath?: string | undefined;
scriptLoading?: "module" | "blocking" | "defer" | undefined;
chunks?: string[] | undefined;
excludedChunks?: string[] | undefined;

@@ -56,2 +56,4 @@ sri?: "sha256" | "sha384" | "sha512" | undefined;

new (c?: {
chunks?: string[] | undefined;
publicPath?: string | undefined;
filename?: string | undefined;

@@ -62,5 +64,3 @@ template?: string | undefined;

inject?: boolean | "head" | "body" | undefined;
publicPath?: string | undefined;
scriptLoading?: "module" | "blocking" | "defer" | undefined;
chunks?: string[] | undefined;
excludedChunks?: string[] | undefined;

@@ -75,2 +75,4 @@ sri?: "sha256" | "sha384" | "sha512" | undefined;

_args: [c?: {
chunks?: string[] | undefined;
publicPath?: string | undefined;
filename?: string | undefined;

@@ -81,5 +83,3 @@ template?: string | undefined;

inject?: boolean | "head" | "body" | undefined;
publicPath?: string | undefined;
scriptLoading?: "module" | "blocking" | "defer" | undefined;
chunks?: string[] | undefined;
excludedChunks?: string[] | undefined;

@@ -86,0 +86,0 @@ sri?: "sha256" | "sha384" | "sha512" | undefined;

import { type BuiltinPlugin, BuiltinPluginName } from "@rspack/binding";
import * as liteTapable from "@rspack/lite-tapable";
import type { Chunk } from "../Chunk";
import { Compilation } from "../Compilation";
import type Hash from "../util/hash";
import { RspackBuiltinPlugin } from "./base";
import Hash = require("../util/hash");
import type { Chunk } from "../Chunk";
export type CompilationHooks = {

@@ -8,0 +8,0 @@ chunkHash: liteTapable.SyncHook<[Chunk, Hash]>;

import { BuiltinPluginName, type RawLightningCssMinimizerRspackPluginOptions } from "@rspack/binding";
export type LightningCssMinimizerRspackPluginOptions = Partial<RawLightningCssMinimizerRspackPluginOptions>;
type MinifyCondition = string | RegExp;
type MinifyConditions = MinifyCondition | MinifyCondition[];
export type LightningCssMinimizerRspackPluginOptions = Partial<RawLightningCssMinimizerRspackPluginOptions> & {
test?: MinifyConditions;
exclude?: MinifyConditions;
include?: MinifyConditions;
};
export declare const LightningCssMinimizerRspackPlugin: {
new (options?: Partial<RawLightningCssMinimizerRspackPluginOptions> | undefined): {
new (options?: LightningCssMinimizerRspackPluginOptions | undefined): {
name: BuiltinPluginName;
_args: [options?: Partial<RawLightningCssMinimizerRspackPluginOptions> | undefined];
_args: [options?: LightningCssMinimizerRspackPluginOptions | undefined];
affectedHooks: "done" | "compilation" | "failed" | "environment" | "emit" | "make" | "compile" | "afterEmit" | "invalid" | "thisCompilation" | "afterDone" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "shutdown" | "watchRun" | "watchClose" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | undefined;

@@ -12,1 +18,2 @@ raw(compiler: import("../Compiler").Compiler): import("@rspack/binding").BuiltinPlugin;

};
export {};

@@ -11,4 +11,7 @@ "use strict";

removeUnusedLocalIdents: options?.removeUnusedLocalIdents ?? true,
browserslist: options?.browserslist ?? ["defaults"]
browserslist: options?.browserslist ?? ["defaults"],
test: options?.test,
include: options?.include,
exclude: options?.exclude
};
});

@@ -37,10 +37,6 @@ "use strict";

}
else {
return name(Module_1.Module.__from_binding(ctx.module, compiler._lastCompilation), getChunks(ctx.chunks), ctx.cacheGroupKey);
}
return name(Module_1.Module.__from_binding(ctx.module, compiler._lastCompilation), getChunks(ctx.chunks), ctx.cacheGroupKey);
};
}
else {
return name;
}
return name;
}

@@ -53,10 +49,6 @@ function getTest(test) {

}
else {
return test(Module_1.Module.__from_binding(ctx.module, compiler._lastCompilation));
}
return test(Module_1.Module.__from_binding(ctx.module, compiler._lastCompilation));
};
}
else {
return test;
}
return test;
}

@@ -67,5 +59,3 @@ function getChunks(chunks) {

}
else {
return chunks;
}
return chunks;
}

@@ -72,0 +62,0 @@ const { name, chunks, defaultSizeTypes, cacheGroups = {}, fallbackCacheGroup, minSize, maxSize, maxAsyncSize, maxInitialSize, ...passThrough } = sc;

@@ -16,9 +16,7 @@ "use strict";

}
else if (condition === false) {
if (condition === false) {
throw Error("unreachable");
}
else {
// FIXME: flags
return condition.source;
}
// FIXME: flags
return condition.source;
};

@@ -29,10 +27,8 @@ if (typeof extractComments === "boolean") {

}
else {
const res = {
condition: conditionStr(extractComments)
};
return res;
}
const res = {
condition: conditionStr(extractComments)
};
return res;
}
else if (extractComments instanceof RegExp) {
if (extractComments instanceof RegExp) {
const res = {

@@ -43,17 +39,13 @@ condition: extractComments.source

}
else if (isObject(extractComments)) {
if (isObject(extractComments)) {
if (extractComments.condition === false) {
return undefined;
}
else {
const res = {
condition: conditionStr(extractComments.condition),
banner: extractComments.banner
};
return res;
}
const res = {
condition: conditionStr(extractComments.condition),
banner: extractComments.banner
};
return res;
}
else {
return undefined;
}
return undefined;
}

@@ -60,0 +52,0 @@ exports.SwcJsMinimizerRspackPlugin = (0, base_1.create)(binding_1.BuiltinPluginName.SwcJsMinimizerRspackPlugin, (options) => {

@@ -16,2 +16,3 @@ /**

import { ChunkGraph } from "./ChunkGraph";
import { ChunkGroup } from "./ChunkGroup";
import type { Compiler } from "./Compiler";

@@ -23,2 +24,3 @@ import type { ContextModuleFactory } from "./ContextModuleFactory";

import type { ResolverFactory } from "./ResolverFactory";
import { type RspackError } from "./RspackError";
import { Stats, type StatsAsset, type StatsError, type StatsModule } from "./Stats";

@@ -30,4 +32,3 @@ import type { Filename, OutputNormalized, RspackOptionsNormalized, RspackPluginInstance, StatsOptions, StatsValue } from "./config";

import { type AssetInfo } from "./util/AssetInfo";
import Hash = require("./util/hash");
import { type RspackError } from "./RspackError";
import type Hash from "./util/hash";
export { type AssetInfo } from "./util/AssetInfo";

@@ -47,2 +48,6 @@ export type Assets = Record<string, Source>;

}
export type RuntimeModule = liteTapable.SyncHook<[
JsRuntimeModule,
Chunk
], void>;
export interface CompilationParams {

@@ -150,3 +155,3 @@ normalModuleFactory: NormalModuleFactory;

], void>;
runtimeModule: liteTapable.SyncHook<[JsRuntimeModule, Chunk], void>;
runtimeModule: RuntimeModule;
afterSeal: liteTapable.AsyncSeriesHook<[], void>;

@@ -180,2 +185,9 @@ }>;

get entrypoints(): ReadonlyMap<string, Entrypoint>;
get chunkGroups(): ReadonlyArray<ChunkGroup>;
/**
* Get the named chunk groups.
*
* Note: This is a proxy for webpack internal API, only method `get` and `keys` are supported now.
*/
get namedChunkGroups(): ReadonlyMap<string, Readonly<ChunkGroup>>;
get modules(): ReadonlySet<Module>;

@@ -216,2 +228,8 @@ get chunks(): ReadonlySet<Chunk>;

emitAsset(filename: string, source: Source, assetInfo?: AssetInfo): void;
/**
* Note: This is not a webpack public API, maybe removed in future.
*
* @internal
*/
__internal__emit_asset_from_loader(filename: string, source: Source, assetInfo: AssetInfo, module: string): void;
deleteAsset(filename: string): void;

@@ -218,0 +236,0 @@ renameAsset(filename: string, newFilename: string): void;

@@ -39,3 +39,3 @@ "use strict";

};
var _Compilation_instances, _Compilation_inner, _Compilation_cachedAssets, _Compilation_cachedEntrypoints, _Compilation_customModules, _Compilation_createCachedAssets, _Compilation_rebuildModuleCaller;
var _Compilation_instances, _Compilation_inner, _Compilation_customModules, _Compilation_createCachedAssets, _Compilation_rebuildModuleCaller;
Object.defineProperty(exports, "__esModule", { value: true });

@@ -47,5 +47,7 @@ exports.Compilation = void 0;

const ChunkGraph_1 = require("./ChunkGraph");
const ChunkGroup_1 = require("./ChunkGroup");
const Entrypoint_1 = require("./Entrypoint");
const ErrorHelpers_1 = require("./ErrorHelpers");
const Module_1 = require("./Module");
const RspackError_1 = require("./RspackError");
const Stats_1 = require("./Stats");

@@ -60,3 +62,2 @@ const Logger_1 = require("./logging/Logger");

const source_1 = require("./util/source");
const RspackError_1 = require("./RspackError");
class Compilation {

@@ -66,4 +67,2 @@ constructor(compiler, inner) {

_Compilation_inner.set(this, void 0);
_Compilation_cachedAssets.set(this, void 0);
_Compilation_cachedEntrypoints.set(this, void 0);
this.fileSystemInfo = {

@@ -187,6 +186,3 @@ createSnapshot() {

get assets() {
if (!__classPrivateFieldGet(this, _Compilation_cachedAssets, "f")) {
__classPrivateFieldSet(this, _Compilation_cachedAssets, __classPrivateFieldGet(this, _Compilation_instances, "m", _Compilation_createCachedAssets).call(this), "f");
}
return __classPrivateFieldGet(this, _Compilation_cachedAssets, "f");
return (0, memoize_1.memoizeValue)(() => __classPrivateFieldGet(this, _Compilation_instances, "m", _Compilation_createCachedAssets).call(this));
}

@@ -197,10 +193,29 @@ /**

get entrypoints() {
if (!__classPrivateFieldGet(this, _Compilation_cachedEntrypoints, "f")) {
__classPrivateFieldSet(this, _Compilation_cachedEntrypoints, new Map(Object.entries(__classPrivateFieldGet(this, _Compilation_inner, "f").entrypoints).map(([n, e]) => [
n,
Entrypoint_1.Entrypoint.__from_binding(e, __classPrivateFieldGet(this, _Compilation_inner, "f"))
])), "f");
}
return __classPrivateFieldGet(this, _Compilation_cachedEntrypoints, "f");
return (0, memoize_1.memoizeValue)(() => new Map(Object.entries(__classPrivateFieldGet(this, _Compilation_inner, "f").entrypoints).map(([n, e]) => [
n,
Entrypoint_1.Entrypoint.__from_binding(e, __classPrivateFieldGet(this, _Compilation_inner, "f"))
])));
}
get chunkGroups() {
return (0, memoize_1.memoizeValue)(() => __classPrivateFieldGet(this, _Compilation_inner, "f").chunkGroups.map(cg => ChunkGroup_1.ChunkGroup.__from_binding(cg, __classPrivateFieldGet(this, _Compilation_inner, "f"))));
}
/**
* Get the named chunk groups.
*
* Note: This is a proxy for webpack internal API, only method `get` and `keys` are supported now.
*/
get namedChunkGroups() {
return {
keys: () => {
const names = __classPrivateFieldGet(this, _Compilation_inner, "f").getNamedChunkGroupKeys();
return names[Symbol.iterator]();
},
get: (property) => {
if (typeof property === "string") {
const chunk = __classPrivateFieldGet(this, _Compilation_inner, "f").getNamedChunkGroup(property) || undefined;
return chunk && ChunkGroup_1.ChunkGroup.__from_binding(chunk, __classPrivateFieldGet(this, _Compilation_inner, "f"));
}
}
};
}
get modules() {

@@ -268,7 +283,5 @@ return (0, memoize_1.memoizeValue)(() => new Set(this.__internal__getModules().map(item => Module_1.Module.__from_binding(item, this))));

}
else {
const options = {};
this.hooks.statsNormalize.call(options, context);
return options;
}
const options = {};
this.hooks.statsNormalize.call(options, context);
return options;
}

@@ -316,2 +329,10 @@ createStatsFactory(options) {

}
/**
* Note: This is not a webpack public API, maybe removed in future.
*
* @internal
*/
__internal__emit_asset_from_loader(filename, source, assetInfo, module) {
__classPrivateFieldGet(this, _Compilation_inner, "f").emitAssetFromLoader(filename, source_1.JsSource.__to_binding(source), AssetInfo_1.JsAssetInfo.__to_binding(assetInfo), module);
}
deleteAsset(filename) {

@@ -422,3 +443,3 @@ __classPrivateFieldGet(this, _Compilation_inner, "f").deleteAsset(filename);

];
proxyMethod.forEach(item => {
for (const item of proxyMethod) {
const proxyedMethod = new Proxy(errors[item.method], {

@@ -428,3 +449,3 @@ apply: item.handler

errors[item.method] = proxyedMethod;
});
}
return errors;

@@ -489,3 +510,3 @@ }

];
proxyMethod.forEach(item => {
for (const item of proxyMethod) {
const proxyedMethod = new Proxy(warnings[item.method], {

@@ -495,3 +516,3 @@ apply: item.handler

warnings[item.method] = proxyedMethod;
});
}
return warnings;

@@ -578,30 +599,24 @@ }

}
else {
return this.getLogger(() => {
if (typeof name === "function") {
name = name();
if (!name) {
throw new TypeError("Compilation.getLogger(name) called with a function not returning a name");
}
return this.getLogger(() => {
if (typeof name === "function") {
name = name();
if (!name) {
throw new TypeError("Compilation.getLogger(name) called with a function not returning a name");
}
return `${name}/${childName}`;
});
}
}
return `${name}/${childName}`;
});
}
else {
if (typeof childName === "function") {
return this.getLogger(() => {
if (typeof childName === "function") {
childName = childName();
if (!childName) {
throw new TypeError("Logger.getChildLogger(name) called with a function not returning a name");
}
if (typeof childName === "function") {
return this.getLogger(() => {
if (typeof childName === "function") {
childName = childName();
if (!childName) {
throw new TypeError("Logger.getChildLogger(name) called with a function not returning a name");
}
return `${name}/${childName}`;
});
}
else {
return this.getLogger(`${name}/${childName}`);
}
}
return `${name}/${childName}`;
});
}
return this.getLogger(`${name}/${childName}`);
});

@@ -703,3 +718,3 @@ }

}
_Compilation_inner = new WeakMap(), _Compilation_cachedAssets = new WeakMap(), _Compilation_cachedEntrypoints = new WeakMap(), _Compilation_customModules = new WeakMap(), _Compilation_rebuildModuleCaller = new WeakMap(), _Compilation_instances = new WeakSet(), _Compilation_createCachedAssets = function _Compilation_createCachedAssets() {
_Compilation_inner = new WeakMap(), _Compilation_customModules = new WeakMap(), _Compilation_rebuildModuleCaller = new WeakMap(), _Compilation_instances = new WeakSet(), _Compilation_createCachedAssets = function _Compilation_createCachedAssets() {
return new Proxy({}, {

@@ -706,0 +721,0 @@ get: (_, property) => {

@@ -236,30 +236,24 @@ "use strict";

}
else {
return this.getInfrastructureLogger(() => {
if (typeof name === "function") {
name = name();
if (!name) {
throw new TypeError("Compiler.getInfrastructureLogger(name) called with a function not returning a name");
}
return this.getInfrastructureLogger(() => {
if (typeof name === "function") {
name = name();
if (!name) {
throw new TypeError("Compiler.getInfrastructureLogger(name) called with a function not returning a name");
}
return `${name}/${childName}`;
});
}
}
return `${name}/${childName}`;
});
}
else {
if (typeof childName === "function") {
return this.getInfrastructureLogger(() => {
if (typeof childName === "function") {
childName = childName();
if (!childName) {
throw new TypeError("Logger.getChildLogger(name) called with a function not returning a name");
}
if (typeof childName === "function") {
return this.getInfrastructureLogger(() => {
if (typeof childName === "function") {
childName = childName();
if (!childName) {
throw new TypeError("Logger.getChildLogger(name) called with a function not returning a name");
}
return `${name}/${childName}`;
});
}
else {
return this.getInfrastructureLogger(`${name}/${childName}`);
}
}
return `${name}/${childName}`;
});
}
return this.getInfrastructureLogger(`${name}/${childName}`);
});

@@ -326,5 +320,3 @@ }

}
else {
return finalCallback(null, stats);
}
return finalCallback(null, stats);
});

@@ -637,3 +629,5 @@ });

};
interceptModuleExecution.forEach((handler) => handler(execOptions));
for (const handler of interceptModuleExecution) {
handler(execOptions);
}
const result = codegenResults.map[id]["build time"];

@@ -666,2 +660,5 @@ const moduleObject = execOptions.module;

registerCompilationChunkHashTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationChunkHash, () => __classPrivateFieldGet(this, _Compiler_compilation, "f").hooks.chunkHash, queried => (chunk) => {
if (!this.options.output.hashFunction) {
throw new Error("'output.hashFunction' cannot be undefined");
}
const hash = (0, createHash_1.createHash)(this.options.output.hashFunction);

@@ -786,2 +783,5 @@ queried.call(Chunk_1.Chunk.__from_binding(chunk, __classPrivateFieldGet(this, _Compiler_compilation, "f")), hash);

.chunkHash, queried => (chunk) => {
if (!this.options.output.hashFunction) {
throw new Error("'output.hashFunction' cannot be undefined");
}
const hash = (0, createHash_1.createHash)(this.options.output.hashFunction);

@@ -788,0 +788,0 @@ queried.call(Chunk_1.Chunk.__from_binding(chunk, __classPrivateFieldGet(this, _Compiler_compilation, "f")), hash);

@@ -1,2 +0,2 @@

import type { RawLibraryOptions, RawOptions } from "@rspack/binding";
import { type RawLibraryOptions, type RawOptions } from "@rspack/binding";
import type { Compiler } from "../Compiler";

@@ -3,0 +3,0 @@ import { type LoaderContext, type LoaderDefinition, type LoaderDefinitionFunction } from "./adapterRuleUse";

@@ -8,2 +8,3 @@ "use strict";

const node_assert_1 = __importDefault(require("node:assert"));
const binding_1 = require("@rspack/binding");
const Stats_1 = require("../Stats");

@@ -72,5 +73,3 @@ const util_1 = require("../util");

}
else {
return [key, [value]];
}
return [key, [value]];
});

@@ -97,4 +96,4 @@ return Object.fromEntries(entries);

configFile,
referencesType: references == "auto" ? "auto" : references ? "manual" : "disabled",
references: references == "auto" ? undefined : references
referencesType: references === "auto" ? "auto" : references ? "manual" : "disabled",
references: references === "auto" ? undefined : references
};

@@ -163,2 +162,4 @@ }

scriptType: output.scriptType === false ? "false" : output.scriptType,
charset: output.charset,
chunkLoadTimeout: output.chunkLoadTimeout,
environment: output.environment

@@ -338,3 +339,3 @@ };

}
else if (rule.resource && !tryMatch(path, rule.resource)) {
if (rule.resource && !tryMatch(path, rule.resource)) {
return false;

@@ -357,4 +358,4 @@ }

return {
type: "string",
stringMatcher: condition
type: binding_1.RawRuleSetConditionType.string,
string: condition
};

@@ -364,4 +365,4 @@ }

return {
type: "regexp",
regexpMatcher: {
type: binding_1.RawRuleSetConditionType.regexp,
regexp: {
source: condition.source,

@@ -374,4 +375,4 @@ flags: condition.flags

return {
type: "function",
funcMatcher: condition
type: binding_1.RawRuleSetConditionType.func,
func: condition
};

@@ -381,4 +382,4 @@ }

return {
type: "array",
arrayMatcher: condition.map(i => getRawRuleSetCondition(i))
type: binding_1.RawRuleSetConditionType.array,
array: condition.map(i => getRawRuleSetCondition(i))
};

@@ -388,4 +389,4 @@ }

return {
type: "logical",
logicalMatcher: [getRawRuleSetLogicalConditions(condition)]
type: binding_1.RawRuleSetConditionType.logical,
logical: [getRawRuleSetLogicalConditions(condition)]
};

@@ -421,7 +422,7 @@ }

}
else if (type === "javascript") {
if (type === "javascript") {
// Filter this out, since `parser["javascript"]` already merge into `parser["javascript/*"]` in default.ts
return;
}
else if (type === "javascript/auto") {
if (type === "javascript/auto") {
return {

@@ -432,3 +433,3 @@ type: "javascript/auto",

}
else if (type === "javascript/dynamic") {
if (type === "javascript/dynamic") {
return {

@@ -439,3 +440,3 @@ type: "javascript/dynamic",

}
else if (type === "javascript/esm") {
if (type === "javascript/esm") {
return {

@@ -446,3 +447,3 @@ type: "javascript/esm",

}
else if (type === "css") {
if (type === "css") {
return {

@@ -453,3 +454,3 @@ type: "css",

}
else if (type === "css/auto") {
if (type === "css/auto") {
return {

@@ -460,3 +461,3 @@ type: "css/auto",

}
else if (type === "css/module") {
if (type === "css/module") {
return {

@@ -463,0 +464,0 @@ type: "css/module",

/// <reference types="node" />
import type { JsAssetInfo, RawModuleRuleUse, RawOptions } from "@rspack/binding";
import type { ResolveRequest } from "../../compiled/enhanced-resolve";
import type { Compilation } from "../Compilation";
import type { Compiler } from "../Compiler";
import type { Logger } from "../logging/Logger";
import Hash = require("../util/hash");
import type { Compilation } from "../Compilation";
import type { Module } from "../Module";
import { type LoaderObject } from "../loader-runner";
import type { Mode, Resolve, RuleSetUseItem, Target } from "./zod";
import type { Logger } from "../logging/Logger";
import type Hash from "../util/hash";
import type { Mode, PublicPath, Resolve, RuleSetUseItem, Target } from "./zod";
export declare const BUILTIN_LOADER_PREFIX = "builtin:";

@@ -90,3 +90,3 @@ export interface ComposeJsUseOptions {

importModule(request: string, options: {
publicPath?: string;
publicPath?: PublicPath;
baseUri?: string;

@@ -93,0 +93,0 @@ }, callback: (err?: Error, res?: any) => void): void;

@@ -5,4 +5,6 @@ "use strict";

const builtin_loader_1 = require("../builtin-loader");
const lightningcss_1 = require("../builtin-loader/lightningcss");
const loader_runner_1 = require("../loader-runner");
const util_1 = require("../util");
const browserslist = require("../../compiled/browserslist");
exports.BUILTIN_LOADER_PREFIX = "builtin:";

@@ -17,3 +19,3 @@ function createRawModuleRuleUses(uses, path, options) {

exports.createRawModuleRuleUses = createRawModuleRuleUses;
const getSwcLoaderOptions = (o, options) => {
const getSwcLoaderOptions = (o, _) => {
if (o && typeof o === "object" && o.rspackExperiments) {

@@ -27,2 +29,19 @@ const expr = o.rspackExperiments;

};
const getLightningcssLoaderOptions = (o, _) => {
if (o && typeof o === "object") {
if (o.targets && typeof o.targets === "string") {
o.targets = (0, lightningcss_1.browserslistToTargets)(browserslist(o.targets));
}
if (o.targets && Array.isArray(o.targets)) {
o.targets = (0, lightningcss_1.browserslistToTargets)(o.targets);
}
if (o.include) {
o.include = (0, lightningcss_1.toFeatures)(o.include);
}
if (o.exclude) {
o.exclude = (0, lightningcss_1.toFeatures)(o.exclude);
}
}
return o;
};
function getBuiltinLoaderOptions(identifier, o, options) {

@@ -32,2 +51,5 @@ if (identifier.startsWith(`${exports.BUILTIN_LOADER_PREFIX}swc-loader`)) {

}
if (identifier.startsWith(`${exports.BUILTIN_LOADER_PREFIX}lightningcss-loader`)) {
return getLightningcssLoaderOptions(o, options);
}
return o;

@@ -34,0 +56,0 @@ }

@@ -1,19 +0,21 @@

export type ApiTargetProperties = import("./target").ApiTargetProperties;
export type EcmaTargetProperties = import("./target").EcmaTargetProperties;
export type PlatformTargetProperties = import("./target").PlatformTargetProperties;
export type BrowserslistHandlerConfig = {
configPath?: string | undefined;
env?: string | undefined;
query?: string | undefined;
};
/**
* @param {string[]} browsers supported browsers list
* @returns {EcmaTargetProperties & PlatformTargetProperties & ApiTargetProperties} target properties
* The following code is modified based on
* https://github.com/webpack/webpack/blob/4b4ca3b/lib/config/browserslistTargetHandler.js
*
* MIT Licensed
* Author Sergey Melyukov @smelukov
* Copyright (c) JS Foundation and other contributors
* https://github.com/webpack/webpack/blob/main/LICENSE
*/
export function resolve(browsers: string[]): EcmaTargetProperties & PlatformTargetProperties & ApiTargetProperties;
import type { ApiTargetProperties, EcmaTargetProperties, PlatformTargetProperties } from "./target";
/**
* @param {string | null | undefined} input input string
* @param {string} context the context directory
* @returns {string[] | undefined} selected browsers
* @param input input string
* @param context the context directory
* @returns selected browsers
*/
export function load(input: string | null | undefined, context: string): string[] | undefined;
export declare const load: (input: string | null | undefined, context: string) => string[] | undefined;
/**
* @param browsers supported browsers list
* @returns target properties
*/
export declare const resolve: (browsers: string[]) => EcmaTargetProperties & PlatformTargetProperties & ApiTargetProperties;

@@ -0,1 +1,2 @@

"use strict";
/**

@@ -10,21 +11,16 @@ * The following code is modified based on

*/
"use strict";
const browserslist = require("../../compiled/browserslist");
const path = require("node:path");
/** @typedef {import("./target").ApiTargetProperties} ApiTargetProperties */
/** @typedef {import("./target").EcmaTargetProperties} EcmaTargetProperties */
/** @typedef {import("./target").PlatformTargetProperties} PlatformTargetProperties */
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.resolve = exports.load = void 0;
const node_path_1 = __importDefault(require("node:path"));
const browserslist_1 = __importDefault(require("../../compiled/browserslist"));
// [[C:]/path/to/config][:env]
const inputRx = /^(?:((?:[A-Z]:)?[/\\].*?))?(?::(.+?))?$/i;
/**
* @typedef {Object} BrowserslistHandlerConfig
* @property {string=} configPath
* @property {string=} env
* @property {string=} query
* @param input input string
* @param context the context directory
* @returns config
*/
/**
* @param {string | null | undefined} input input string
* @param {string} context the context directory
* @returns {BrowserslistHandlerConfig} config
*/
const parse = (input, context) => {

@@ -34,7 +30,7 @@ if (!input) {

}
if (path.isAbsolute(input)) {
if (node_path_1.default.isAbsolute(input)) {
const [, configPath, env] = inputRx.exec(input) || [];
return { configPath, env };
}
const config = browserslist.findConfig(context);
const config = browserslist_1.default.findConfig(context);
if (config && Object.keys(config).includes(input)) {

@@ -46,5 +42,5 @@ return { env: input };

/**
* @param {string | null | undefined} input input string
* @param {string} context the context directory
* @returns {string[] | undefined} selected browsers
* @param input input string
* @param context the context directory
* @returns selected browsers
*/

@@ -59,22 +55,23 @@ const load = (input, context) => {

: configPath
? browserslist.loadConfig({
? browserslist_1.default.loadConfig({
config: configPath,
env
})
: browserslist.loadConfig({ path: context, env });
: browserslist_1.default.loadConfig({ path: context, env });
if (!config)
return;
return browserslist(config);
return (0, browserslist_1.default)(config);
};
exports.load = load;
/**
* @param {string[]} browsers supported browsers list
* @returns {EcmaTargetProperties & PlatformTargetProperties & ApiTargetProperties} target properties
* @param browsers supported browsers list
* @returns target properties
*/
const resolve = browsers => {
const resolve = (browsers) => {
/**
* Checks all against a version number
* @param {Record<string, number | [number, number]>} versions first supported version
* @returns {boolean} true if supports
* @param versions first supported version
* @returns true if supports
*/
const rawChecker = versions => {
const rawChecker = (versions) => {
return browsers.every(v => {

@@ -351,5 +348,2 @@ const [name, parsedVersion] = v.split(" ");

};
module.exports = {
resolve,
load
};
exports.resolve = resolve;

@@ -20,2 +20,3 @@ "use strict";

const ModuleTypeConstants_1 = require("../ModuleTypeConstants");
const Template_1 = require("../Template");
const builtin_plugin_1 = require("../builtin-plugin");

@@ -26,3 +27,2 @@ const util_1 = require("../util");

const target_1 = require("./target");
const Template = require("../Template");
const applyRspackOptionsDefaults = (options) => {

@@ -193,4 +193,4 @@ F(options, "context", () => process.cwd());

(0, assertNotNil_1.assertNotNill)(module.generator.css);
D(module.generator["css"], "exportsOnly", !targetProperties || !targetProperties.document);
D(module.generator["css"], "esModule", true);
D(module.generator.css, "exportsOnly", !targetProperties || !targetProperties.document);
D(module.generator.css, "esModule", true);
F(module.generator, "css/auto", () => ({}));

@@ -346,6 +346,6 @@ (0, assertNotNil_1.assertNotNill)(module.generator["css/auto"]);

}
else if (typeof libraryName === "object") {
if (typeof libraryName === "object") {
return getLibraryName(libraryName.root);
}
else if (typeof libraryName === "string") {
if (typeof libraryName === "string") {
return libraryName;

@@ -413,4 +413,3 @@ }

D(output, "hotUpdateMainFilename", "[runtime].[fullhash].hot-update.json");
const uniqueNameId = Template.toIdentifier(
/** @type {NonNullable<Output["uniqueName"]>} */ output.uniqueName);
const uniqueNameId = Template_1.Template.toIdentifier(output.uniqueName);
F(output, "hotUpdateGlobal", () => "webpackHotUpdate" + uniqueNameId);

@@ -445,16 +444,14 @@ F(output, "chunkLoadingGlobal", () => "webpackChunk" + uniqueNameId);

}
else {
if (tp.document)
return "array-push";
if (tp.require)
return "commonjs";
if (tp.nodeBuiltins)
return "commonjs";
if (tp.importScripts)
return "array-push";
throw new Error("For the selected environment is no default script chunk format available:\n" +
"JSONP Array push can be chosen when 'document' or 'importScripts' is available.\n" +
"CommonJs exports can be chosen when 'require' or node builtins are available.\n" +
helpMessage);
}
if (tp.document)
return "array-push";
if (tp.require)
return "commonjs";
if (tp.nodeBuiltins)
return "commonjs";
if (tp.importScripts)
return "array-push";
throw new Error("For the selected environment is no default script chunk format available:\n" +
"JSONP Array push can be chosen when 'document' or 'importScripts' is available.\n" +
"CommonJs exports can be chosen when 'require' or node builtins are available.\n" +
helpMessage);
}

@@ -548,2 +545,4 @@ throw new Error("Chunk format can't be selected by default when no target is specified");

F(output, "scriptType", () => (output.module ? "module" : false));
D(output, "charset", true);
D(output, "chunkLoadTimeout", 120000);
const { trustedTypes } = output;

@@ -550,0 +549,0 @@ if (trustedTypes) {

@@ -73,2 +73,4 @@ /**

environment?: Environment;
charset?: boolean;
chunkLoadTimeout?: number;
}

@@ -75,0 +77,0 @@ export interface ModuleOptionsNormalized {

@@ -20,7 +20,5 @@ "use strict";

}
else {
return (warning) => {
return ignore.test(warning.message);
};
}
return (warning) => {
return ignore.test(warning.message);
};
})

@@ -121,2 +119,4 @@ : undefined,

devtoolFallbackModuleFilenameTemplate: output.devtoolFallbackModuleFilenameTemplate,
chunkLoadTimeout: output.chunkLoadTimeout,
charset: output.charset,
environment: cloneObject(output.environment)

@@ -123,0 +123,0 @@ };

@@ -0,150 +1,89 @@

/**
* @param context the context directory
* @returns default target
*/
export declare const getDefaultTarget: (context: string) => "browserslist" | "web";
export type PlatformTargetProperties = {
/**
* web platform, importing of http(s) and std: is available
*/
/** web platform, importing of http(s) and std: is available */
web: boolean | null;
/**
* browser platform, running in a normal web browser
*/
/** browser platform, running in a normal web browser */
browser: boolean | null;
/**
* (Web)Worker platform, running in a web/shared/service worker
*/
/** (Web)Worker platform, running in a web/shared/service worker */
webworker: boolean | null;
/**
* node platform, require of node built-in modules is available
*/
/** node platform, require of node built-in modules is available */
node: boolean | null;
/**
* nwjs platform, require of legacy nw.gui is available
*/
/** nwjs platform, require of legacy nw.gui is available */
nwjs: boolean | null;
/**
* electron platform, require of some electron built-in modules is available
*/
/** electron platform, require of some electron built-in modules is available */
electron: boolean | null;
};
export type ElectronContextTargetProperties = {
/**
* in main context
*/
/** in main context */
electronMain: boolean | null;
/**
* in preload context
*/
/** in preload context */
electronPreload: boolean | null;
/**
* in renderer context with node integration
*/
/** in renderer context with node integration */
electronRenderer: boolean | null;
};
export type ApiTargetProperties = {
/**
* has require function available
*/
/** has require function available */
require: boolean | null;
/**
* has node.js built-in modules available
*/
/** has node.js built-in modules available */
nodeBuiltins: boolean | null;
/**
* node.js allows to use `node:` prefix for core modules
*/
/** node.js allows to use `node:` prefix for core modules */
nodePrefixForCoreModules: boolean | null;
/**
* has document available (allows script tags)
*/
/** has document available (allows script tags) */
document: boolean | null;
/**
* has importScripts available
*/
/** has importScripts available */
importScripts: boolean | null;
/**
* has importScripts available when creating a worker
*/
/** has importScripts available when creating a worker */
importScriptsInWorker: boolean | null;
/**
* has fetch function available for WebAssembly
*/
/** has fetch function available for WebAssembly */
fetchWasm: boolean | null;
/**
* has global variable available
*/
/** has global variable available */
global: boolean | null;
};
export type EcmaTargetProperties = {
/**
* has globalThis variable available
*/
/** has globalThis variable available */
globalThis: boolean | null;
/**
* big int literal syntax is available
*/
/** big int literal syntax is available */
bigIntLiteral: boolean | null;
/**
* const and let variable declarations are available
*/
/** const and let variable declarations are available */
const: boolean | null;
/**
* arrow functions are available
*/
/** arrow functions are available */
arrowFunction: boolean | null;
/**
* for of iteration is available
*/
/** for of iteration is available */
forOf: boolean | null;
/**
* destructuring is available
*/
/** destructuring is available */
destructuring: boolean | null;
/**
* async import() is available
*/
/** async import() is available */
dynamicImport: boolean | null;
/**
* async import() is available when creating a worker
*/
/** async import() is available when creating a worker */
dynamicImportInWorker: boolean | null;
/**
* ESM syntax is available (when in module)
*/
/** ESM syntax is available (when in module) */
module: boolean | null;
/**
* optional chaining is available
*/
/** optional chaining is available */
optionalChaining: boolean | null;
/**
* template literal is available
*/
/** template literal is available */
templateLiteral: boolean | null;
/**
* async functions and await are available
*/
/** async functions and await are available */
asyncFunction: boolean | null;
};
type Never<T> = {
[P in keyof T]?: never;
};
type Mix<A, B> = (A & Never<B>) | (Never<A> & B) | (A & B);
type TargetProperties = Mix<Mix<PlatformTargetProperties, ElectronContextTargetProperties>, Mix<ApiTargetProperties, EcmaTargetProperties>>;
/**
* <T>
* @param target the target
* @param context the context directory
* @returns target properties
*/
export type Never<T> = { [P in keyof T]?: undefined; };
export declare const getTargetProperties: (target: string, context: string) => TargetProperties;
/**
* <A, B>
* @param targets the targets
* @param context the context directory
* @returns target properties
*/
export type Mix<A, B> = (A & Never<B>) | (Never<A> & B) | (A & B);
export type TargetProperties = Mix<Mix<PlatformTargetProperties, ElectronContextTargetProperties>, Mix<ApiTargetProperties, EcmaTargetProperties>>;
/**
* @param {string} context the context directory
* @returns {"browserslist" | "web"} default target
*/
export function getDefaultTarget(context: string): "browserslist" | "web";
/**
* @param {string} target the target
* @param {string} context the context directory
* @returns {TargetProperties} target properties
*/
export function getTargetProperties(target: string, context: string): TargetProperties;
/**
* @param {string[]} targets the targets
* @param {string} context the context directory
* @returns {TargetProperties} target properties
*/
export function getTargetsProperties(targets: string[], context: string): TargetProperties;
export declare const getTargetsProperties: (targets: string[], context: string) => TargetProperties;
export {};

@@ -0,1 +1,27 @@

"use strict";
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.getTargetsProperties = exports.getTargetProperties = exports.getDefaultTarget = void 0;
/**

@@ -10,77 +36,24 @@ * The following code is modified based on

*/
"use strict";
const { memoize } = require("../util/memoize");
const getBrowserslistTargetHandler = memoize(() => require("./browserslistTargetHandler"));
const memoize_1 = require("../util/memoize");
const browserslistTargetHandler = __importStar(require("./browserslistTargetHandler"));
const getBrowserslistTargetHandler = (0, memoize_1.memoize)(() => browserslistTargetHandler);
/**
* @param {string} context the context directory
* @returns {"browserslist" | "web"} default target
* @param context the context directory
* @returns default target
*/
const getDefaultTarget = context => {
const getDefaultTarget = (context) => {
const browsers = getBrowserslistTargetHandler().load(null, context);
return browsers ? "browserslist" : "web";
};
exports.getDefaultTarget = getDefaultTarget;
/**
* @typedef {Object} PlatformTargetProperties
* @property {boolean | null} web web platform, importing of http(s) and std: is available
* @property {boolean | null} browser browser platform, running in a normal web browser
* @property {boolean | null} webworker (Web)Worker platform, running in a web/shared/service worker
* @property {boolean | null} node node platform, require of node built-in modules is available
* @property {boolean | null} nwjs nwjs platform, require of legacy nw.gui is available
* @property {boolean | null} electron electron platform, require of some electron built-in modules is available
* @param major major version
* @param minor minor version
* @returns check if version is greater or equal
*/
/**
* @typedef {Object} ElectronContextTargetProperties
* @property {boolean | null} electronMain in main context
* @property {boolean | null} electronPreload in preload context
* @property {boolean | null} electronRenderer in renderer context with node integration
*/
/**
* @typedef {Object} ApiTargetProperties
* @property {boolean | null} require has require function available
* @property {boolean | null} nodeBuiltins has node.js built-in modules available
* @property {boolean | null} nodePrefixForCoreModules node.js allows to use `node:` prefix for core modules
* @property {boolean | null} document has document available (allows script tags)
* @property {boolean | null} importScripts has importScripts available
* @property {boolean | null} importScriptsInWorker has importScripts available when creating a worker
* @property {boolean | null} fetchWasm has fetch function available for WebAssembly
* @property {boolean | null} global has global variable available
*/
/**
* @typedef {Object} EcmaTargetProperties
* @property {boolean | null} globalThis has globalThis variable available
* @property {boolean | null} bigIntLiteral big int literal syntax is available
* @property {boolean | null} const const and let variable declarations are available
* @property {boolean | null} arrowFunction arrow functions are available
* @property {boolean | null} forOf for of iteration is available
* @property {boolean | null} destructuring destructuring is available
* @property {boolean | null} dynamicImport async import() is available
* @property {boolean | null} dynamicImportInWorker async import() is available when creating a worker
* @property {boolean | null} module ESM syntax is available (when in module)
* @property {boolean | null} optionalChaining optional chaining is available
* @property {boolean | null} templateLiteral template literal is available
* @property {boolean | null} asyncFunction async functions and await are available
*/
///** @typedef {PlatformTargetProperties | ApiTargetProperties | EcmaTargetProperties | PlatformTargetProperties & ApiTargetProperties | PlatformTargetProperties & EcmaTargetProperties | ApiTargetProperties & EcmaTargetProperties} TargetProperties */
/**
* @template T
* @typedef {{ [P in keyof T]?: never }} Never<T>
*/
/**
* @template A
* @template B
* @typedef {(A & Never<B>) | (Never<A> & B) | (A & B)} Mix<A, B>
*/
/** @typedef {Mix<Mix<PlatformTargetProperties, ElectronContextTargetProperties>, Mix<ApiTargetProperties, EcmaTargetProperties>>} TargetProperties */
/**
* @param {string} major major version
* @param {string | undefined} minor minor version
* @returns {(vMajor: number, vMinor?: number) => boolean | undefined} check if version is greater or equal
*/
const versionDependent = (major, minor) => {
if (!major) {
return () => /** @type {undefined} */ (undefined);
return () => undefined;
}
/** @type {number} */
const nMajor = +major;
/** @type {number} */
const nMinor = minor ? +minor : 0;

@@ -91,3 +64,2 @@ return (vMajor, vMinor = 0) => {

};
/** @type {[string, string, RegExp, (...args: string[]) => Partial<TargetProperties>][]} */
const TARGETS = [

@@ -296,5 +268,5 @@ [

/**
* @param {string} target the target
* @param {string} context the context directory
* @returns {TargetProperties} target properties
* @param target the target
* @param context the context directory
* @returns target properties
*/

@@ -308,3 +280,3 @@ const getTargetProperties = (target, context) => {

if (result)
return /** @type {TargetProperties} */ (result);
return result;
}

@@ -314,15 +286,10 @@ }

};
/**
* @param {TargetProperties[]} targetProperties array of target properties
* @returns {TargetProperties} merged target properties
*/
const mergeTargetProperties = targetProperties => {
/** @type {Set<keyof TargetProperties>} */
exports.getTargetProperties = getTargetProperties;
const mergeTargetProperties = (targetProperties) => {
const keys = new Set();
for (const tp of targetProperties) {
for (const key of Object.keys(tp)) {
keys.add(/** @type {keyof TargetProperties} */ (key));
keys.add(key);
}
}
/** @type {Object} */
const result = {};

@@ -344,17 +311,14 @@ for (const key of keys) {

if (hasTrue || hasFalse)
/** @type {TargetProperties} */
(result)[key] = hasFalse && hasTrue ? null : hasTrue ? true : false;
result[key] = hasFalse && hasTrue ? null : hasTrue;
}
return /** @type {TargetProperties} */ (result);
return result;
};
/**
* @param {string[]} targets the targets
* @param {string} context the context directory
* @returns {TargetProperties} target properties
* @param targets the targets
* @param context the context directory
* @returns target properties
*/
const getTargetsProperties = (targets, context) => {
return mergeTargetProperties(targets.map(t => getTargetProperties(t, context)));
return mergeTargetProperties(targets.map(t => (0, exports.getTargetProperties)(t, context)));
};
exports.getDefaultTarget = getDefaultTarget;
exports.getTargetProperties = getTargetProperties;
exports.getTargetsProperties = getTargetsProperties;

@@ -7,2 +7,7 @@ "use strict";

const Module_1 = require("../Module");
const filenameTemplate = zod_1.z.string();
const filename = filenameTemplate.or(zod_1.z
.function()
.args(zod_1.z.custom(), zod_1.z.custom().optional())
.returns(zod_1.z.string()));
//#region Name

@@ -30,4 +35,3 @@ const name = zod_1.z.string();

//#region Entry
const rawPublicPath = zod_1.z.string();
const publicPath = zod_1.z.literal("auto").or(rawPublicPath);
const publicPath = zod_1.z.literal("auto").or(filename);
const baseUri = zod_1.z.string();

@@ -94,8 +98,3 @@ const chunkLoadingType = zod_1.z

const library = libraryName.or(libraryOptions).optional();
const filenameTemplate = zod_1.z.string();
const filename = filenameTemplate.or(zod_1.z
.function()
.args(zod_1.z.custom(), zod_1.z.custom().optional())
.returns(zod_1.z.string()));
const entryFilename = filenameTemplate;
const entryFilename = filename;
const entryRuntime = zod_1.z.literal(false).or(zod_1.z.string());

@@ -227,2 +226,4 @@ const entryItem = zod_1.z.string().or(zod_1.z.array(zod_1.z.string()));

devtoolFallbackModuleFilenameTemplate: devtoolFallbackModuleFilenameTemplate.optional(),
chunkLoadTimeout: zod_1.z.number().optional(),
charset: zod_1.z.boolean().optional(),
environment: environment.optional()

@@ -397,3 +398,3 @@ });

emit: zod_1.z.boolean().optional(),
filename: filenameTemplate.optional(),
filename: filename.optional(),
publicPath: publicPath.optional()

@@ -527,3 +528,8 @@ });

dependencyType: zod_1.z.string().optional(),
request: zod_1.z.string().optional()
request: zod_1.z.string().optional(),
contextInfo: zod_1.z
.strictObject({
issuer: zod_1.z.string()
})
.optional()
});

@@ -626,8 +632,15 @@ const externalItem = zod_1.z

//#region Stats
const statsPresets = zod_1.z.enum([
"normal",
"none",
"verbose",
"errors-only",
"errors-warnings",
"minimal",
"detailed",
"summary"
]);
const statsOptions = zod_1.z.strictObject({
all: zod_1.z.boolean().optional(),
preset: zod_1.z
.boolean()
.or(zod_1.z.enum(["normal", "none", "verbose", "errors-only", "errors-warnings"]))
.optional(),
preset: zod_1.z.boolean().or(statsPresets).optional(),
assets: zod_1.z.boolean().optional(),

@@ -723,6 +736,3 @@ chunks: zod_1.z.boolean().optional(),

});
const statsValue = zod_1.z
.enum(["none", "errors-only", "errors-warnings", "normal", "verbose"])
.or(zod_1.z.boolean())
.or(statsOptions);
const statsValue = zod_1.z.boolean().or(statsPresets).or(statsOptions);
const plugin = zod_1.z.union([

@@ -729,0 +739,0 @@ zod_1.z.custom(),

@@ -31,15 +31,15 @@ import { type BuiltinPlugin, BuiltinPluginName } from "@rspack/binding";

type: string;
name?: string | string[] | {
commonjs?: string | undefined;
amd?: string | undefined;
root?: string | string[] | undefined;
} | undefined;
amdContainer?: string | undefined;
auxiliaryComment?: string | {
commonjs?: string | undefined;
amd?: string | undefined;
commonjs?: string | undefined;
root?: string | undefined;
commonjs2?: string | undefined;
root?: string | undefined;
} | undefined;
export?: string | string[] | undefined;
name?: string | string[] | {
amd?: string | undefined;
commonjs?: string | undefined;
root?: string | string[] | undefined;
} | undefined;
umdNamedDefine?: boolean | undefined;

@@ -46,0 +46,0 @@ };

@@ -31,3 +31,3 @@ "use strict";

}
else if (Array.isArray(options)) {
if (Array.isArray(options)) {
array(options);

@@ -34,0 +34,0 @@ }

@@ -45,6 +45,4 @@ "use strict";

}
else {
const firstLine = stack.slice(0, nextLine);
return firstLine === message ? stack.slice(nextLine + 1) : stack;
}
const firstLine = stack.slice(0, nextLine);
return firstLine === message ? stack.slice(nextLine + 1) : stack;
};

@@ -51,0 +49,0 @@ exports.cutOffMessage = cutOffMessage;

@@ -21,4 +21,3 @@ declare const rspackVersion: any, webpackVersion: any;

export { ModuleFilenameHelpers };
import Template = require("./Template");
export { Template };
export { Template } from "./Template";
export declare const WebpackError: ErrorConstructor;

@@ -38,4 +37,4 @@ export type { Watching } from "./Watching";

export declare const util: {
createHash: (algorithm: any) => any;
cleverMerge: <T, O>(first: T, second: O) => T | O | (T & O);
createHash: (algorithm: "debug" | "md4" | "xxhash64" | (string & {}) | "native-md4" | (new () => import("./util/hash").default)) => import("./util/hash").default;
cleverMerge: <First, Second>(first: First, second: Second) => First | Second | (First & Second);
};

@@ -153,2 +152,3 @@ export { default as EntryOptionPlugin } from "./lib/EntryOptionPlugin";

export type { SwcLoaderEnvConfig, SwcLoaderEsParserConfig, SwcLoaderJscConfig, SwcLoaderModuleConfig, SwcLoaderOptions, SwcLoaderParserConfig, SwcLoaderTransformConfig, SwcLoaderTsParserConfig } from "./builtin-loader/swc/index";
export { type LoaderOptions as LightningcssLoaderOptions, type FeatureOptions as LightningcssFeatureOptions } from "./builtin-loader/lightningcss/index";
import { cleanupGlobalTrace, registerGlobalTrace } from "@rspack/binding";

@@ -155,0 +155,0 @@ interface Experiments {

@@ -55,4 +55,4 @@ "use strict";

// API extractor not working with some re-exports, see: https://github.com/microsoft/fluentui/issues/20694
const Template = require("./Template");
exports.Template = Template;
var Template_1 = require("./Template");
Object.defineProperty(exports, "Template", { enumerable: true, get: function () { return Template_1.Template; } });
exports.WebpackError = Error;

@@ -59,0 +59,0 @@ const sources = require("../compiled/webpack-sources");

@@ -32,7 +32,5 @@ /*

}
else {
const temp = b;
b = a;
a = temp;
}
const temp = b;
b = a;
a = temp;
}

@@ -52,5 +50,3 @@ else {

}
else {
return mergedEtag;
}
return mergedEtag;
}

@@ -69,6 +65,4 @@ }

}
else {
return mergedEtag;
}
return mergedEtag;
};
module.exports = mergeEtags;

@@ -55,2 +55,3 @@ /*

const next = i => {
// @ts-ignore if your typescript version >= 5.5, this line will throw an error
return this._items[i].getPromise().then(result => {

@@ -57,0 +58,0 @@ if (result !== undefined)

@@ -19,3 +19,3 @@ /*

}
else if ("line" in pos) {
if ("line" in pos) {
return `${pos.line}:?`;

@@ -41,3 +41,3 @@ }

}
else if (typeof loc.start === "object" &&
if (typeof loc.start === "object" &&
typeof loc.start.line === "number" &&

@@ -50,5 +50,3 @@ typeof loc.start.column !== "number" &&

}
else {
return `${formatPosition(loc.start)}-${formatPosition(loc.end)}`;
}
return `${formatPosition(loc.start)}-${formatPosition(loc.end)}`;
}

@@ -55,0 +53,0 @@ if ("start" in loc && loc.start) {

@@ -30,5 +30,3 @@ "use strict";

}
else {
return (0, exports.asRegExp)(test).test(str);
}
return (0, exports.asRegExp)(test).test(str);
};

@@ -35,0 +33,0 @@ exports.matchPart = matchPart;

@@ -296,3 +296,2 @@ "use strict";

const buildDependencies = context.buildDependencies;
const assetFilenames = context.assetFilenames;
/// Construct `loaderContext`

@@ -360,3 +359,2 @@ const loaderContext = {};

}
assetFilenames.push(...res.assets);
resolve(compiler.__internal__getModuleExecutionResult(res.id));

@@ -389,3 +387,2 @@ }

}
assetFilenames.push(...res.assets);
callback(undefined, compiler.__internal__getModuleExecutionResult(res.id));

@@ -566,5 +563,8 @@ }

}
assetFilenames.push(name),
// @ts-expect-error
compiler._lastCompilation.emitAsset(name, source, assetInfo);
// @ts-expect-error
compiler._lastCompilation.__internal__emit_asset_from_loader(name,
// @ts-expect-error
source,
// @ts-expect-error
assetInfo, context._moduleIdentifier);
};

@@ -716,5 +716,3 @@ loaderContext.fs = compiler.inputFileSystem;

}
else {
return str;
}
return str;
}

@@ -721,0 +719,0 @@ function convertArgs(args, raw) {

@@ -1,3 +0,13 @@

export = LoadingLoaderError;
/**
* The following code is from
* https://github.com/webpack/loader-runner
*
* MIT Licensed
* Author Tobias Koppers @sokra
* Copyright (c) JS Foundation and other contributors
* https://github.com/webpack/loader-runner/blob/main/LICENSE
*/
declare class LoadingLoaderError extends Error {
constructor(message: string);
}
export default LoadingLoaderError;

@@ -0,1 +1,2 @@

"use strict";
/**

@@ -10,7 +11,4 @@ * The following code is from

*/
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class LoadingLoaderError extends Error {
/**
* @param {string=} message
*/
constructor(message) {

@@ -22,2 +20,2 @@ super(message);

}
module.exports = LoadingLoaderError;
exports.default = LoadingLoaderError;

@@ -1,2 +0,11 @@

declare function _exports(loader: any, callback: any): any;
export = _exports;
/**
* The following code is from
* https://github.com/webpack/loader-runner
*
* MIT Licensed
* Author Tobias Koppers @sokra
* Copyright (c) JS Foundation and other contributors
* https://github.com/webpack/loader-runner/blob/main/LICENSE
*/
import type { LoaderObject } from ".";
export default function loadLoader(loader: LoaderObject, callback: (err: unknown) => void): void;

@@ -11,7 +11,9 @@ "use strict";

*/
var LoaderLoadingError = require("./LoaderLoadingError");
/** @type {undefined | import('node:url')} */
var url;
// @ts-expect-error
module.exports = function loadLoader(loader, callback) {
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const LoaderLoadingError_1 = __importDefault(require("./LoaderLoadingError"));
var url = undefined;
function loadLoader(loader, callback) {
if (loader.type === "module") {

@@ -22,5 +24,4 @@ try {

var loaderUrl = url.pathToFileURL(loader.path);
/** @type {Promise<any>} */
var modulePromise = eval("import(" + JSON.stringify(loaderUrl.toString()) + ")");
modulePromise.then(module => {
modulePromise.then((module) => {
handleResult(loader, module, callback);

@@ -41,14 +42,11 @@ }, callback);

// limit has been reached. give it a chance to recover.
// @ts-expect-error
if (e instanceof Error && e.code === "EMFILE") {
// @ts-expect-error
if (e instanceof Error &&
e.code === "EMFILE") {
var retry = loadLoader.bind(null, loader, callback);
if (typeof setImmediate === "function") {
// node >= 0.9.0
return setImmediate(retry);
return void setImmediate(retry);
}
else {
// node < 0.9.0
return process.nextTick(retry);
}
// node < 0.9.0
return process.nextTick(retry);
}

@@ -59,7 +57,7 @@ return callback(e);

}
};
// @ts-expect-error
}
exports.default = loadLoader;
function handleResult(loader, module, callback) {
if (typeof module !== "function" && typeof module !== "object") {
return callback(new LoaderLoadingError("Module '" +
return callback(new LoaderLoadingError_1.default("Module '" +
loader.path +

@@ -73,3 +71,3 @@ "' is not a loader (export function or es6 module)"));

typeof loader.pitch !== "function") {
return callback(new LoaderLoadingError("Module '" +
return callback(new LoaderLoadingError_1.default("Module '" +
loader.path +

@@ -76,0 +74,0 @@ "' is not a loader (must have normal or pitch function)"));

@@ -90,9 +90,5 @@ "use strict";

}
else {
return [`[${name}]`, ...args];
}
return [`[${name}]`, ...args];
}
else {
return [];
}
return [];
};

@@ -99,0 +95,0 @@ const debug = debugFilters.some(f => f(name));

@@ -33,8 +33,6 @@ "use strict";

}
else if (availableLength > 3) {
if (availableLength > 3) {
return ["..." + args[0].slice(-availableLength + 3)];
}
else {
return [args[0].slice(-availableLength)];
}
return [args[0].slice(-availableLength)];
}

@@ -80,13 +78,11 @@ // Check if there is space for at least 4 chars per arg

}
else if (length > 5) {
if (length > 5) {
return "..." + str.slice(-length + 3);
}
else if (length > 0) {
if (length > 0) {
return str.slice(-length);
}
else {
return "";
}
return "";
});
};
exports.truncateArgs = truncateArgs;

@@ -43,5 +43,3 @@ "use strict";

}
else {
return null;
}
return null;
}

@@ -55,5 +53,3 @@ identifier() {

}
else {
return null;
}
return null;
}

@@ -60,0 +56,0 @@ }

@@ -1,117 +0,93 @@

export type JavaScriptModuleTypes = "javascript/auto" | "javascript/dynamic" | "javascript/esm";
export type JSONModuleType = "json";
export type WebAssemblyModuleTypes = "webassembly/async" | "webassembly/sync";
export type CSSModuleTypes = "css" | "css/global" | "css/module";
export type AssetModuleTypes = "asset" | "asset/inline" | "asset/resource" | "asset/source" | "asset/raw-data-url";
export type WebpackModuleTypes = "runtime" | "fallback-module" | "remote-module" | "provide-module" | "consume-shared-module" | "lazy-compilation-proxy";
export type UnknownModuleTypes = string;
export type ModuleTypes = JavaScriptModuleTypes | JSONModuleType | WebAssemblyModuleTypes | CSSModuleTypes | AssetModuleTypes | WebpackModuleTypes | UnknownModuleTypes;
export declare const JAVASCRIPT_MODULE_TYPE_AUTO = "javascript/auto";
export declare const JAVASCRIPT_MODULE_TYPE_DYNAMIC = "javascript/dynamic";
/**
* @type {Readonly<"asset">}
* This is the module type used for automatically choosing between `asset/inline`, `asset/resource` based on asset size limit (8096).
*/
export const ASSET_MODULE_TYPE: Readonly<"asset">;
/**
* @type {Readonly<"asset/raw-data-url">}
* TODO: Document what this asset type is for. See css-loader tests for its usage.
*/
export const ASSET_MODULE_TYPE_RAW_DATA_URL: Readonly<"asset/raw-data-url">;
/**
* @type {Readonly<"asset/source">}
* This is the module type used for assets that are imported as source code. This is the equivalent of `raw-loader`.
*/
export const ASSET_MODULE_TYPE_SOURCE: Readonly<"asset/source">;
/**
* @type {Readonly<"asset/resource">}
* This is the module type used for assets that are copied to the output directory. This is the equivalent of `file-loader`.
*/
export const ASSET_MODULE_TYPE_RESOURCE: Readonly<"asset/resource">;
/**
* @type {Readonly<"asset/inline">}
* This is the module type used for assets that are inlined as a data URI. This is the equivalent of `url-loader`.
*/
export const ASSET_MODULE_TYPE_INLINE: Readonly<"asset/inline">;
/**
* @type {Readonly<"javascript/auto">}
*/
export const JAVASCRIPT_MODULE_TYPE_AUTO: Readonly<"javascript/auto">;
/**
* @type {Readonly<"javascript/dynamic">}
*/
export const JAVASCRIPT_MODULE_TYPE_DYNAMIC: Readonly<"javascript/dynamic">;
/**
* @type {Readonly<"javascript/esm">}
* This is the module type used for _strict_ ES Module syntax. This means that all legacy formats
* that webpack supports (CommonJS, AMD, SystemJS) are not supported.
*/
export const JAVASCRIPT_MODULE_TYPE_ESM: Readonly<"javascript/esm">;
export declare const JAVASCRIPT_MODULE_TYPE_ESM = "javascript/esm";
/**
* @type {Readonly<"json">}
* This is the module type used for JSON files. JSON files are always parsed as ES Module.
*/
export const JSON_MODULE_TYPE: Readonly<"json">;
export declare const JSON_MODULE_TYPE = "json";
/**
* @type {Readonly<"webassembly/async">}
* This is the module type used for WebAssembly modules. In webpack 5 they are always treated as async modules.
*
*/
export const WEBASSEMBLY_MODULE_TYPE_ASYNC: Readonly<"webassembly/async">;
export declare const WEBASSEMBLY_MODULE_TYPE_ASYNC = "webassembly/async";
/**
* @type {Readonly<"webassembly/sync">}
* This is the module type used for WebAssembly modules. In webpack 4 they are always treated as sync modules.
* There is a legacy option to support this usage in webpack 5 and up.
*/
export const WEBASSEMBLY_MODULE_TYPE_SYNC: Readonly<"webassembly/sync">;
export declare const WEBASSEMBLY_MODULE_TYPE_SYNC = "webassembly/sync";
/**
* @type {Readonly<"css">}
* This is the module type used for CSS files.
*/
export const CSS_MODULE_TYPE: Readonly<"css">;
export declare const CSS_MODULE_TYPE = "css";
/**
* @type {Readonly<"css/global">}
* This is the module type used for CSS modules files where you need to use `:local` in selector list to hash classes.
*/
export const CSS_MODULE_TYPE_GLOBAL: Readonly<"css/global">;
export declare const CSS_MODULE_TYPE_GLOBAL = "css/global";
/**
* @type {Readonly<"css/module">}
* This is the module type used for CSS modules files, by default all classes are hashed.
*/
export const CSS_MODULE_TYPE_MODULE: Readonly<"css/module">;
export declare const CSS_MODULE_TYPE_MODULE = "css/module";
/**
* @type {Readonly<"css/auto">}
* This is the module type used for CSS files, the module will be parsed as CSS modules if it's filename contains `.module.` or `.modules.`.
*/
export const CSS_MODULE_TYPE_AUTO: Readonly<"css/auto">;
export declare const CSS_MODULE_TYPE_AUTO = "css/auto";
/**
* @type {Readonly<"runtime">}
* This is the module type used for automatically choosing between `asset/inline`, `asset/resource` based on asset size limit (8096).
*/
export declare const ASSET_MODULE_TYPE = "asset";
/**
* This is the module type used for assets that are inlined as a data URI. This is the equivalent of `url-loader`.
*/
export declare const ASSET_MODULE_TYPE_INLINE = "asset/inline";
/**
* This is the module type used for assets that are copied to the output directory. This is the equivalent of `file-loader`.
*/
export declare const ASSET_MODULE_TYPE_RESOURCE = "asset/resource";
/**
* @type {Readonly<"asset/source">}
* This is the module type used for assets that are imported as source code. This is the equivalent of `raw-loader`.
*/
export declare const ASSET_MODULE_TYPE_SOURCE = "asset/source";
/**
* TODO: Document what this asset type is for. See css-loader tests for its usage.
*/
export declare const ASSET_MODULE_TYPE_RAW_DATA_URL = "asset/raw-data-url";
/**
* This is the module type used for the webpack runtime abstractions.
*/
export const WEBPACK_MODULE_TYPE_RUNTIME: Readonly<"runtime">;
export declare const WEBPACK_MODULE_TYPE_RUNTIME = "runtime";
/**
* @type {Readonly<"fallback-module">}
* This is the module type used for the ModuleFederation feature's FallbackModule class.
* TODO: Document this better.
*/
export const WEBPACK_MODULE_TYPE_FALLBACK: Readonly<"fallback-module">;
export declare const WEBPACK_MODULE_TYPE_FALLBACK = "fallback-module";
/**
* @type {Readonly<"remote-module">}
* This is the module type used for the ModuleFederation feature's RemoteModule class.
* TODO: Document this better.
*/
export const WEBPACK_MODULE_TYPE_REMOTE: Readonly<"remote-module">;
export declare const WEBPACK_MODULE_TYPE_REMOTE = "remote-module";
/**
* @type {Readonly<"provide-module">}
* This is the module type used for the ModuleFederation feature's ProvideModule class.
* TODO: Document this better.
*/
export const WEBPACK_MODULE_TYPE_PROVIDE: Readonly<"provide-module">;
export declare const WEBPACK_MODULE_TYPE_PROVIDE = "provide-module";
/**
* @type {Readonly<"consume-shared-module">}
* This is the module type used for the ModuleFederation feature's ConsumeSharedModule class.
*/
export const WEBPACK_MODULE_TYPE_CONSUME_SHARED_MODULE: Readonly<"consume-shared-module">;
export declare const WEBPACK_MODULE_TYPE_CONSUME_SHARED_MODULE = "consume-shared-module";
/**
* @type {Readonly<"lazy-compilation-proxy">}
* Module type used for `experiments.lazyCompilation` feature. See `LazyCompilationPlugin` for more information.
*/
export const WEBPACK_MODULE_TYPE_LAZY_COMPILATION_PROXY: Readonly<"lazy-compilation-proxy">;
export declare const WEBPACK_MODULE_TYPE_LAZY_COMPILATION_PROXY = "lazy-compilation-proxy";
export type JavaScriptModuleTypes = "javascript/auto" | "javascript/dynamic" | "javascript/esm";
export type JSONModuleType = "json";