@ms-cloudpack/bundler-rspack 0.4.4 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/getRspackConfiguration.d.ts.map +1 -1
- package/lib/getRspackConfiguration.js +2 -5
- package/lib/getRspackConfiguration.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/rspack.d.ts +2 -0
- package/lib/rspack.d.ts.map +1 -1
- package/lib/rspack.js.map +1 -1
- package/package.json +15 -15
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getRspackConfiguration.d.ts","sourceRoot":"","sources":["../src/getRspackConfiguration.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC/E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"getRspackConfiguration.d.ts","sourceRoot":"","sources":["../src/getRspackConfiguration.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC/E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,KAAK,EAAE,aAAa,EAA+C,MAAM,cAAc,CAAC;AAK/F,wBAAgB,sBAAsB,CACpC,MAAM,EAAE;IACN,OAAO,EAAE,IAAI,CAAC,aAAa,EAAE,SAAS,GAAG,YAAY,CAAC,CAAC;IACvD,UAAU,EAAE,MAAM,CAAC;CACpB,GAAG,IAAI,CAAC,mBAAmB,EAAE,YAAY,CAAC,EAC3C,OAAO,EAAE,aAAa,GACrB,aAAa,CAoLf"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { defaultTargetSyntax, getCssRule, getModuleSearchPaths, getSwcConfig, shouldExternalizePackage, } from '@ms-cloudpack/bundler-utilities';
|
|
2
|
-
import { isExternalPackage } from '@ms-cloudpack/path-utilities';
|
|
3
2
|
import rspack from '@rspack/core';
|
|
4
3
|
import semver from 'semver';
|
|
5
4
|
import { merge } from 'webpack-merge';
|
|
@@ -8,13 +7,11 @@ export function getRspackConfiguration(params, context) {
|
|
|
8
7
|
const { targetEnvironment, dedupeAliases } = options;
|
|
9
8
|
const { unsafeDisableInlineSvg: _, ...bundlerOptions } = options.bundlerOptions || {};
|
|
10
9
|
const outputScriptExtension = targetEnvironment === 'node' ? 'mjs' : 'js';
|
|
11
|
-
const isExternal = isExternalPackage(options.inputPath);
|
|
12
10
|
// If targeting node and full SSR isn't enabled, treat it like production mode.
|
|
13
11
|
const effectiveMode = targetEnvironment === 'node' && !context.config.features?.enableSSR ? 'production' : context.config.mode;
|
|
14
12
|
const isLibraryMode = effectiveMode === 'library';
|
|
15
|
-
// Only get the SWC config and transform code
|
|
16
|
-
|
|
17
|
-
const swcConfig = !isExternal || context.requiresTranspile || options.bundlerCapabilities?.relay
|
|
13
|
+
// Only get the SWC config and transform code if needed
|
|
14
|
+
const swcConfig = context.requiresTranspile
|
|
18
15
|
? getSwcConfig({ packagePath: options.inputPath, sourcemap: options.sourcemap })
|
|
19
16
|
: undefined;
|
|
20
17
|
const config = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getRspackConfiguration.js","sourceRoot":"","sources":["../src/getRspackConfiguration.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,UAAU,EACV,oBAAoB,EACpB,YAAY,EACZ,wBAAwB,GACzB,MAAM,iCAAiC,CAAC;AAGzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEjE,OAAO,MAAM,MAAM,cAAc,CAAC;AAClC,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEtC,MAAM,UAAU,sBAAsB,CACpC,MAG2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aACF;SACF;KACF,CAAC;IAEF,IAAI,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,MAAM,EAAE,CAAC;QACvC,OAAO,KAAK,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IACvC,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import {\n defaultTargetSyntax,\n getCssRule,\n getModuleSearchPaths,\n getSwcConfig,\n shouldExternalizePackage,\n} from '@ms-cloudpack/bundler-utilities';\nimport type { BundleContext, BundleOptions } from '@ms-cloudpack/common-types';\nimport type { WriteESMStubsResult } from '@ms-cloudpack/esm-stub-utilities';\nimport { isExternalPackage } from '@ms-cloudpack/path-utilities';\nimport type { Configuration, ExternalItemFunctionData, ExternalItemValue } from '@rspack/core';\nimport rspack from '@rspack/core';\nimport semver from 'semver';\nimport { merge } from 'webpack-merge';\n\nexport function getRspackConfiguration(\n params: {\n options: Omit<BundleOptions, 'entries' | 'outputPath'>;\n outputPath: string;\n } & Pick<WriteESMStubsResult, 'newEntries'>,\n context: BundleContext,\n): Configuration {\n const { options, outputPath, newEntries } = params;\n const { targetEnvironment, dedupeAliases } = options;\n const { unsafeDisableInlineSvg: _, ...bundlerOptions } = options.bundlerOptions || {};\n const outputScriptExtension = targetEnvironment === 'node' ? 'mjs' : 'js';\n const isExternal = isExternalPackage(options.inputPath);\n\n // If targeting node and full SSR isn't enabled, treat it like production mode.\n const effectiveMode =\n targetEnvironment === 'node' && !context.config.features?.enableSSR ? 'production' : context.config.mode;\n const isLibraryMode = effectiveMode === 'library';\n\n // Only get the SWC config and transform code from internal packages, or if there are explicit\n // typescript or jsx entries\n const swcConfig =\n !isExternal || context.requiresTranspile || options.bundlerCapabilities?.relay\n ? getSwcConfig({ packagePath: options.inputPath, sourcemap: options.sourcemap })\n : undefined;\n\n const config: Configuration = {\n mode: options.minify ? 'production' : 'development',\n // For Rspack, it looks like this following is still needed as unit tests fail without removing the './'.\n // Webpack (at least older versions) expects entry keys without a leading `./`.\n // (The leading `./` seems to be okay with the latest version, but in older versions, it appears\n // to cause the runtime chunk runtime.js to be generated with an incorrect relative path?)\n entry: Object.fromEntries(Object.entries(newEntries).map(([key, value]) => [key.replace(/^\\.\\//, ''), value])),\n context: options.inputPath,\n resolve: {\n modules: context.config.resolve?.modules ?? ['node_modules'],\n extensions: ['.ts', '.tsx', '.mjs', '.js', '.jsx', '.json'],\n extensionAlias: {\n '.js': ['.ts', '.js', '.tsx', '.jsx'],\n '.mjs': ['.mts', '.mjs'],\n },\n alias: dedupeAliases,\n },\n resolveLoader: {\n modules: [\n // Resolve loaders from the package's node_modules\n 'node_modules',\n\n // Cloudpack provided loaders\n ...getModuleSearchPaths(['css-loader', 'style-loader', 'sass-loader'], import.meta.url),\n ],\n },\n externals:\n // In production mode for browser bundles, we don't externalize anything.\n // (For Node bundles, built-ins are always externalized with enableSSR feature.)\n !isLibraryMode && targetEnvironment === 'browser'\n ? [] // These types can't be inferred due to use of zod types (which may be slightly incorrect too,\n : // since they don't allow returning undefined from the async version).\n // Issue: https://github.com/web-infra-dev/rspack/issues/7979\n // There's discussion here of moving away from zod types: https://github.com/web-infra-dev/rspack/issues/4241\n // eslint-disable-next-line @typescript-eslint/require-await -- API signature uses a promise\n async (data: ExternalItemFunctionData): Promise<ExternalItemValue | undefined> => {\n const { request } = data;\n // ! is a webpack loader prefix.\n if (!request || request.includes('!')) {\n return;\n }\n\n if (\n shouldExternalizePackage({\n packageName: options.packageName,\n inputPath: options.inputPath,\n id: request,\n parent: data.context,\n inlined: options.inlined,\n external: options.external,\n shouldInlineNodeBuiltins: false,\n targetEnvironment,\n mode: effectiveMode,\n })\n ) {\n // Manually force externals to use `externalsType: 'module-import'` to ensure that\n // async import() statements are preserved (otherwise they'll be hoisted).\n return `module-import ${request}`;\n }\n },\n target: [targetEnvironment === 'node' ? 'node18' : 'web', defaultTargetSyntax],\n //plugins: [new rspack.CssExtractRspackPlugin({})],\n module: {\n rules: [\n getCssRule('css'),\n {\n test: /\\.(json|resjson)$/,\n type: 'json',\n sideEffects: false,\n },\n {\n test: /\\.ejs$/,\n loader: 'ejs-loader',\n options: {\n variable: 'data',\n esModule: true,\n },\n resolve: {\n fullySpecified: false,\n },\n },\n ...(swcConfig\n ? [\n {\n // transform jsx files\n test: /\\.[cm]?jsx$/,\n loader: 'builtin:swc-loader',\n options: swcConfig.jsx,\n type: 'javascript/auto',\n },\n {\n // transform ts files\n test: /\\.[cm]?tsx?$/,\n loader: 'builtin:swc-loader',\n options: swcConfig.tsx,\n type: 'javascript/auto',\n },\n ]\n : []),\n getCssRule('sass'),\n {\n test: /\\.worker\\.js$/,\n use: { loader: 'worker-rspack-loader' },\n },\n {\n test: /\\.wasm$/i,\n type: 'asset/resource',\n },\n {\n test: /\\.glsl$/,\n type: 'asset/source',\n },\n ],\n },\n output: {\n library: {\n type: 'module',\n },\n chunkFormat: 'module',\n chunkLoading: 'import',\n path: outputPath,\n module: true,\n filename: `[name].${outputScriptExtension}`,\n chunkFilename: `[id].chunk.${outputScriptExtension}`,\n },\n experiments: {\n outputModule: true,\n css: false,\n },\n devtool: options.sourcemap ? (isLibraryMode ? 'cheap-module-source-map' : 'source-map') : false,\n optimization: {\n runtimeChunk: 'single',\n minimize: options.minify,\n mangleExports: false,\n splitChunks: {\n // Prevents exposing path info when creating names for parts splitted by maxSize.\n hidePathInfo: true,\n\n // Figure out which exports are used by modules to mangle export names, omit unused\n // exports and generate more efficient code.\n // This option was added in 1.0.0-beta.4\n ...(semver.gte(rspack.rspackVersion, '1.0.0-beta.4') && { usedExports: !isLibraryMode }),\n\n chunks: 'all',\n\n //name: '[id].chunk', //TODO: is this needed?\n // webpack version:\n // filename: `[id].chunk.${outputScriptExtension}`,\n\n // Production chunks should be at least 1000 bytes to prevent large numbers of file requests\n minSize: isLibraryMode ? 0 : 1000,\n\n cacheGroups: {\n defaultVendors: false,\n },\n },\n },\n };\n\n if (Object.keys(bundlerOptions).length) {\n return merge(config, bundlerOptions);\n }\n\n return config;\n}\n"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AExF,MAAM,EAAE,KAAK;gBAEb,6CAA6C;gBAC7C,mBAAmB;gBACnB,mDAAmD;gBAEnD,4FAA4F;gBAC5F,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI;gBAEjC,WAAW,EAAE;oBACX,cAAc,EAAE,KAAK;iBACtB;aACF;SACF;KACF,CAAC;IAEF,IAAI,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,MAAM,EAAE,CAAC;QACvC,OAAO,KAAK,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IACvC,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import {\n defaultTargetSyntax,\n getCssRule,\n getModuleSearchPaths,\n getSwcConfig,\n shouldExternalizePackage,\n} from '@ms-cloudpack/bundler-utilities';\nimport type { BundleContext, BundleOptions } from '@ms-cloudpack/common-types';\nimport type { WriteESMStubsResult } from '@ms-cloudpack/esm-stub-utilities';\nimport type { Configuration, ExternalItemFunctionData, ExternalItemValue } from '@rspack/core';\nimport rspack from '@rspack/core';\nimport semver from 'semver';\nimport { merge } from 'webpack-merge';\n\nexport function getRspackConfiguration(\n params: {\n options: Omit<BundleOptions, 'entries' | 'outputPath'>;\n outputPath: string;\n } & Pick<WriteESMStubsResult, 'newEntries'>,\n context: BundleContext,\n): Configuration {\n const { options, outputPath, newEntries } = params;\n const { targetEnvironment, dedupeAliases } = options;\n const { unsafeDisableInlineSvg: _, ...bundlerOptions } = options.bundlerOptions || {};\n const outputScriptExtension = targetEnvironment === 'node' ? 'mjs' : 'js';\n\n // If targeting node and full SSR isn't enabled, treat it like production mode.\n const effectiveMode =\n targetEnvironment === 'node' && !context.config.features?.enableSSR ? 'production' : context.config.mode;\n const isLibraryMode = effectiveMode === 'library';\n\n // Only get the SWC config and transform code if needed\n const swcConfig = context.requiresTranspile\n ? getSwcConfig({ packagePath: options.inputPath, sourcemap: options.sourcemap })\n : undefined;\n\n const config: Configuration = {\n mode: options.minify ? 'production' : 'development',\n // For Rspack, it looks like this following is still needed as unit tests fail without removing the './'.\n // Webpack (at least older versions) expects entry keys without a leading `./`.\n // (The leading `./` seems to be okay with the latest version, but in older versions, it appears\n // to cause the runtime chunk runtime.js to be generated with an incorrect relative path?)\n entry: Object.fromEntries(Object.entries(newEntries).map(([key, value]) => [key.replace(/^\\.\\//, ''), value])),\n context: options.inputPath,\n resolve: {\n modules: context.config.resolve?.modules ?? ['node_modules'],\n extensions: ['.ts', '.tsx', '.mjs', '.js', '.jsx', '.json'],\n extensionAlias: {\n '.js': ['.ts', '.js', '.tsx', '.jsx'],\n '.mjs': ['.mts', '.mjs'],\n },\n alias: dedupeAliases,\n },\n resolveLoader: {\n modules: [\n // Resolve loaders from the package's node_modules\n 'node_modules',\n\n // Cloudpack provided loaders\n ...getModuleSearchPaths(['css-loader', 'style-loader', 'sass-loader'], import.meta.url),\n ],\n },\n externals:\n // In production mode for browser bundles, we don't externalize anything.\n // (For Node bundles, built-ins are always externalized with enableSSR feature.)\n !isLibraryMode && targetEnvironment === 'browser'\n ? [] // These types can't be inferred due to use of zod types (which may be slightly incorrect too,\n : // since they don't allow returning undefined from the async version).\n // Issue: https://github.com/web-infra-dev/rspack/issues/7979\n // There's discussion here of moving away from zod types: https://github.com/web-infra-dev/rspack/issues/4241\n // eslint-disable-next-line @typescript-eslint/require-await -- API signature uses a promise\n async (data: ExternalItemFunctionData): Promise<ExternalItemValue | undefined> => {\n const { request } = data;\n // ! is a webpack loader prefix.\n if (!request || request.includes('!')) {\n return;\n }\n\n if (\n shouldExternalizePackage({\n packageName: options.packageName,\n inputPath: options.inputPath,\n id: request,\n parent: data.context,\n inlined: options.inlined,\n external: options.external,\n shouldInlineNodeBuiltins: false,\n targetEnvironment,\n mode: effectiveMode,\n })\n ) {\n // Manually force externals to use `externalsType: 'module-import'` to ensure that\n // async import() statements are preserved (otherwise they'll be hoisted).\n return `module-import ${request}`;\n }\n },\n target: [targetEnvironment === 'node' ? 'node18' : 'web', defaultTargetSyntax],\n //plugins: [new rspack.CssExtractRspackPlugin({})],\n module: {\n rules: [\n getCssRule('css'),\n {\n test: /\\.(json|resjson)$/,\n type: 'json',\n sideEffects: false,\n },\n {\n test: /\\.ejs$/,\n loader: 'ejs-loader',\n options: {\n variable: 'data',\n esModule: true,\n },\n resolve: {\n fullySpecified: false,\n },\n },\n ...(swcConfig\n ? [\n {\n // transform jsx files\n test: /\\.[cm]?jsx$/,\n loader: 'builtin:swc-loader',\n options: swcConfig.jsx,\n type: 'javascript/auto',\n },\n {\n // transform ts files\n test: /\\.[cm]?tsx?$/,\n loader: 'builtin:swc-loader',\n options: swcConfig.tsx,\n type: 'javascript/auto',\n },\n ]\n : []),\n getCssRule('sass'),\n {\n test: /\\.worker\\.js$/,\n use: { loader: 'worker-rspack-loader' },\n },\n {\n test: /\\.wasm$/i,\n type: 'asset/resource',\n },\n {\n test: /\\.glsl$/,\n type: 'asset/source',\n },\n ],\n },\n output: {\n library: {\n type: 'module',\n },\n chunkFormat: 'module',\n chunkLoading: 'import',\n path: outputPath,\n module: true,\n filename: `[name].${outputScriptExtension}`,\n chunkFilename: `[id].chunk.${outputScriptExtension}`,\n },\n experiments: {\n outputModule: true,\n css: false,\n },\n devtool: options.sourcemap ? (isLibraryMode ? 'cheap-module-source-map' : 'source-map') : false,\n optimization: {\n runtimeChunk: 'single',\n minimize: options.minify,\n mangleExports: false,\n splitChunks: {\n // Prevents exposing path info when creating names for parts splitted by maxSize.\n hidePathInfo: true,\n\n // Figure out which exports are used by modules to mangle export names, omit unused\n // exports and generate more efficient code.\n // This option was added in 1.0.0-beta.4\n ...(semver.gte(rspack.rspackVersion, '1.0.0-beta.4') && { usedExports: !isLibraryMode }),\n\n chunks: 'all',\n\n //name: '[id].chunk', //TODO: is this needed?\n // webpack version:\n // filename: `[id].chunk.${outputScriptExtension}`,\n\n // Production chunks should be at least 1000 bytes to prevent large numbers of file requests\n minSize: isLibraryMode ? 0 : 1000,\n\n cacheGroups: {\n defaultVendors: false,\n },\n },\n },\n };\n\n if (Object.keys(bundlerOptions).length) {\n return merge(config, bundlerOptions);\n }\n\n return config;\n}\n"]}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { rspack as default } from './rspack.js';
|
|
1
|
+
export { rspack as default, type RspackCapabilityConfig } from './rspack.js';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,OAAO,EAAE,MAAM,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,aAAa,CAAC"}
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,OAAO,EAA+B,MAAM,aAAa,CAAC","sourcesContent":["export { rspack as default, type RspackCapabilityConfig } from './rspack.js';\n"]}
|
package/lib/rspack.d.ts
CHANGED
package/lib/rspack.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rspack.d.ts","sourceRoot":"","sources":["../src/rspack.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"rspack.d.ts","sourceRoot":"","sources":["../src/rspack.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAGV,OAAO,EAER,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAA6D,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAS7G,MAAM,MAAM,sBAAsB,GAAG,aAAa,CAAC;AAEnD,eAAO,MAAM,MAAM,EAAE,OA4CpB,CAAC"}
|
package/lib/rspack.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rspack.js","sourceRoot":"","sources":["../src/rspack.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"rspack.js","sourceRoot":"","sources":["../src/rspack.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAOzE,2FAA2F;AAC3F,OAAO,EAAE,MAAM,IAAI,SAAS,EAAyB,aAAa,EAAsB,MAAM,cAAc,CAAC;AAC7G,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAExE,MAAM,WAAW,GAAG,QAAQ,CAAC;AAI7B,MAAM,CAAC,MAAM,MAAM,GAAY;IAC7B,IAAI,EAAE,WAAW;IACjB,OAAO,EAAE,aAAa;IACtB,MAAM,EAAE,KAAK,WAAW,OAAO,EAAE,OAAO;QACtC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,qBAAqB,CAAC,OAAO,CAAC,CAAC;QACpE,IAAI,MAAM,EAAE,MAAM,EAAE,CAAC;YACnB,OAAO,EAAE,MAAM,EAAE,CAAC;QACpB,CAAC;QAED,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,OAAO,CAAC,SAAS,CAAC;QAE3D,MAA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CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC;YACjH,CAAC;YACD,OAAO;gBACL,MAAM,EAAE,CAAC,YAAY,CAAC;gBACtB,QAAQ,EAAE,MAAiC;aAC5C,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import { processCapabilities } from '@ms-cloudpack/bundler-capabilities';\nimport type {\n BundleMessage,\n BundlerCapabilitiesOptions,\n Bundler,\n InternalBundlerCapabilitiesOptions,\n} from '@ms-cloudpack/common-types';\n// With rspack, `version` is actually the webpack version! We need `rspackVersion` instead.\nimport { rspack as runRspack, type StatsCompilation, rspackVersion, type RspackOptions } from '@rspack/core';\nimport { rspackCapabilities } from './rspackCapabilities.js';\nimport { getRspackConfiguration } from './getRspackConfiguration.js';\nimport { writeESMStubsInWorker } from '@ms-cloudpack/esm-stub-utilities';\nimport { normalizeRspackOutput } from './normalizeRspackOutput.js';\nimport { base64AssetExtensions } from '@ms-cloudpack/bundler-utilities';\n\nconst bundlerName = 'rspack';\n\nexport type RspackCapabilityConfig = RspackOptions;\n\nexport const rspack: Bundler = {\n name: bundlerName,\n version: rspackVersion,\n bundle: async function (options, context) {\n const { errors, newEntries } = await writeESMStubsInWorker(options);\n if (errors?.length) {\n return { errors };\n }\n\n const outputPath = options.outputPath ?? options.inputPath;\n\n const bundlerCapabilitiesOptions: BundlerCapabilitiesOptions = {\n // Enable asset-inline by default for common image types\n 'asset-inline': { extensions: base64AssetExtensions },\n ...(options.bundlerCapabilities || {}),\n } satisfies InternalBundlerCapabilitiesOptions;\n\n const config = await processCapabilities<RspackCapabilityConfig>({\n bundlerName,\n baseConfig: getRspackConfiguration({ options, outputPath, newEntries }, context),\n bundlerCapabilitiesOptions,\n internalCapabilities: rspackCapabilities,\n bundlerCapabilitiesRegistry: context.config.bundlerCapabilitiesRegistry,\n });\n\n try {\n const stats = await new Promise<StatsCompilation | undefined>((resolve, reject) => {\n runRspack(config, (err, statsResult) => (err ? reject(err) : resolve(statsResult?.toJson())));\n });\n\n // Normalize the output outside the callback, so if there's an exception it's not swallowed\n return normalizeRspackOutput({ stats, config, outputPath, options });\n } catch (err) {\n const errorMessage: BundleMessage = { text: (err as Error).message || String(err), source: bundlerName };\n if (err instanceof Error && err.stack) {\n // remove the message from the stack\n errorMessage.notes = [{ text: err.stack.includes(err.message) ? err.stack.split(err.message)[1] : err.stack }];\n }\n return {\n errors: [errorMessage],\n rawInput: config as Record<string, unknown>,\n };\n }\n },\n};\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ms-cloudpack/bundler-rspack",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Cloudpack's wrapper for the Rspack bundler",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -13,13 +13,23 @@
|
|
|
13
13
|
"import": "./lib/index.js"
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
|
+
"scripts": {
|
|
17
|
+
"api": "cloudpack-scripts api",
|
|
18
|
+
"build:watch": "cloudpack-scripts build-watch",
|
|
19
|
+
"build": "cloudpack-scripts build",
|
|
20
|
+
"lint:update": "cloudpack-scripts lint-update",
|
|
21
|
+
"lint": "cloudpack-scripts lint",
|
|
22
|
+
"test:update": "cloudpack-scripts test-update",
|
|
23
|
+
"test:watch": "cloudpack-scripts test-watch",
|
|
24
|
+
"test": "cloudpack-scripts test"
|
|
25
|
+
},
|
|
16
26
|
"dependencies": {
|
|
17
27
|
"@ms-cloudpack/bundler-capabilities": "^0.4.8",
|
|
18
|
-
"@ms-cloudpack/bundler-utilities": "^0.7.
|
|
19
|
-
"@ms-cloudpack/common-types": "^0.
|
|
20
|
-
"@ms-cloudpack/esm-stub-utilities": "^0.15.
|
|
28
|
+
"@ms-cloudpack/bundler-utilities": "^0.7.4",
|
|
29
|
+
"@ms-cloudpack/common-types": "^0.33.0",
|
|
30
|
+
"@ms-cloudpack/esm-stub-utilities": "^0.15.33",
|
|
21
31
|
"@ms-cloudpack/path-string-parsing": "^1.2.7",
|
|
22
|
-
"@ms-cloudpack/path-utilities": "^3.
|
|
32
|
+
"@ms-cloudpack/path-utilities": "^3.2.0",
|
|
23
33
|
"@rspack/core": "^1.1.8 || ^1.1.8-beta.0",
|
|
24
34
|
"@swc/core": "^1.3.0",
|
|
25
35
|
"@swc/plugin-relay": "^6.0.0 || ^7.0.0 || ^8.0.0 || ^9.0.0",
|
|
@@ -39,16 +49,6 @@
|
|
|
39
49
|
"@ms-cloudpack/scripts": "^0.0.1",
|
|
40
50
|
"@ms-cloudpack/test-utilities": "^0.5.0"
|
|
41
51
|
},
|
|
42
|
-
"scripts": {
|
|
43
|
-
"api": "cloudpack-scripts api",
|
|
44
|
-
"build:watch": "cloudpack-scripts build-watch",
|
|
45
|
-
"build": "cloudpack-scripts build",
|
|
46
|
-
"lint:update": "cloudpack-scripts lint-update",
|
|
47
|
-
"lint": "cloudpack-scripts lint",
|
|
48
|
-
"test:update": "cloudpack-scripts test-update",
|
|
49
|
-
"test:watch": "cloudpack-scripts test-watch",
|
|
50
|
-
"test": "cloudpack-scripts test"
|
|
51
|
-
},
|
|
52
52
|
"files": [
|
|
53
53
|
"lib/**/!(*.test.*)"
|
|
54
54
|
]
|