@ohos-ports/rspack-core 2.2.2-beta.0 → 2.2.9-beta.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/README.md +10 -0
- package/compiled/@rspack/lite-tapable/dist/index.d.ts +20 -6
- package/compiled/@rspack/lite-tapable/package.json +1 -1
- package/compiled/open/package.json +1 -1
- package/compiled/tinypool/README.md +4 -4
- package/compiled/tinypool/dist/index.d.ts +3 -2
- package/compiled/tinypool/dist/index.js +3 -3
- package/compiled/tinypool/package.json +1 -1
- package/compiled/webpack-sources/index.d.ts +61 -0
- package/compiled/webpack-sources/index.js +858 -224
- package/compiled/webpack-sources/package.json +8 -1
- package/compiled/webpack-sources/types/CachedSource.d.ts +192 -0
- package/compiled/webpack-sources/types/CompatSource.d.ts +87 -0
- package/compiled/webpack-sources/types/ConcatSource.d.ts +75 -0
- package/compiled/webpack-sources/types/OriginalSource.d.ts +87 -0
- package/compiled/webpack-sources/types/PrefixSource.d.ts +59 -0
- package/compiled/webpack-sources/types/RawSource.d.ts +75 -0
- package/compiled/webpack-sources/types/ReplaceSource.d.ts +107 -0
- package/compiled/webpack-sources/types/SizeOnlySource.d.ts +24 -0
- package/compiled/webpack-sources/types/Source.d.ts +189 -0
- package/compiled/webpack-sources/types/SourceMapSource.d.ts +136 -0
- package/compiled/webpack-sources/types/helpers/createMappingsSerializer.d.ts +60 -0
- package/compiled/webpack-sources/types/helpers/getFromStreamChunks.d.ts +16 -0
- package/compiled/webpack-sources/types/helpers/getGeneratedSourceInfo.d.ts +31 -0
- package/compiled/webpack-sources/types/helpers/getName.d.ts +15 -0
- package/compiled/webpack-sources/types/helpers/getSource.d.ts +15 -0
- package/compiled/webpack-sources/types/helpers/readMappings.d.ts +19 -0
- package/compiled/webpack-sources/types/helpers/scopes.d.ts +119 -0
- package/compiled/webpack-sources/types/helpers/splitIntoLines.d.ts +6 -0
- package/compiled/webpack-sources/types/helpers/splitIntoPotentialTokens.d.ts +37 -0
- package/compiled/webpack-sources/types/helpers/streamAndGetSourceAndMap.d.ts +39 -0
- package/compiled/webpack-sources/types/helpers/streamChunks.d.ts +56 -0
- package/compiled/webpack-sources/types/helpers/streamChunksOfCombinedSourceMap.d.ts +42 -0
- package/compiled/webpack-sources/types/helpers/streamChunksOfRawSource.d.ts +16 -0
- package/compiled/webpack-sources/types/helpers/streamChunksOfSourceMap.d.ts +19 -0
- package/compiled/webpack-sources/types/helpers/stringBufferUtils.d.ts +55 -0
- package/compiled/webpack-sources/types/index.d.ts +50 -0
- package/dist/BuildInfo.d.ts +6 -4
- package/dist/Chunk.d.ts +3 -3
- package/dist/ChunkGraph.d.ts +2 -2
- package/dist/Chunks.d.ts +2 -2
- package/dist/CodeGenerationResults.d.ts +6 -1
- package/dist/Compilation.d.ts +13 -52
- package/dist/Compiler.d.ts +5 -5
- package/dist/ConcatenatedModule.d.ts +1 -1
- package/dist/ContextModule.d.ts +1 -1
- package/dist/Diagnostics.d.ts +2 -6
- package/dist/Entrypoint.d.ts +1 -1
- package/dist/ExportsInfo.d.ts +1 -1
- package/dist/ExternalModule.d.ts +1 -1
- package/dist/FileSystem.d.ts +3 -1
- package/dist/FileSystemDependencies.d.ts +15 -0
- package/dist/Module.d.ts +10 -6
- package/dist/ModuleGraph.d.ts +6 -6
- package/dist/ModuleGraphConnection.d.ts +1 -1
- package/dist/Modules.d.ts +3 -0
- package/dist/NativeWatchFileSystem.d.ts +1 -1
- package/dist/NormalModule.d.ts +2 -2
- package/dist/NormalModuleFactory.d.ts +2 -1
- package/dist/Resolver.d.ts +10 -2
- package/dist/ResolverFactory.d.ts +1 -1
- package/dist/RspackError.d.ts +2 -2
- package/dist/RuntimeGlobals.d.ts +4 -3
- package/dist/RuntimeModule.d.ts +1 -1
- package/dist/builtin-loader/lightningcss/target.d.ts +1 -1
- package/dist/builtin-plugin/APIPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ArrayPushCallbackChunkFormatPlugin.d.ts +1 -1
- package/dist/builtin-plugin/AssetModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/AsyncWebAssemblyModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/BannerPlugin.d.ts +2 -2
- package/dist/builtin-plugin/BundlerInfoRspackPlugin.d.ts +1 -1
- package/dist/builtin-plugin/CaseSensitivePlugin.d.ts +1 -1
- package/dist/builtin-plugin/ChunkPrefetchPreloadPlugin.d.ts +1 -1
- package/dist/builtin-plugin/CircularCheckRspackPlugin.d.ts +1 -1
- package/dist/builtin-plugin/CircularDependencyRspackPlugin.d.ts +1 -1
- package/dist/builtin-plugin/CircularModulesInfoPlugin.d.ts +1 -1
- package/dist/builtin-plugin/CommonJsChunkFormatPlugin.d.ts +1 -1
- package/dist/builtin-plugin/CompactHashedChunkIdsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/CompactHashedModuleIdsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ContextReplacementPlugin.d.ts +1 -1
- package/dist/builtin-plugin/CopyRspackPlugin.d.ts +2 -2
- package/dist/builtin-plugin/CssChunkingPlugin.d.ts +1 -1
- package/dist/builtin-plugin/CssHttpExternalsRspackPlugin.d.ts +1 -1
- package/dist/builtin-plugin/CssModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/DataUriPlugin.d.ts +1 -1
- package/dist/builtin-plugin/DefinePlugin.d.ts +1 -1
- package/dist/builtin-plugin/DeterministicChunkIdsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/DeterministicModuleIdsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/DllEntryPlugin.d.ts +1 -1
- package/dist/builtin-plugin/DllReferenceAgencyPlugin.d.ts +2 -2
- package/dist/builtin-plugin/DynamicEntryPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ElectronTargetPlugin.d.ts +1 -1
- package/dist/builtin-plugin/EnableChunkLoadingPlugin.d.ts +1 -1
- package/dist/builtin-plugin/EnableLibraryPlugin.d.ts +1 -1
- package/dist/builtin-plugin/EnableWasmLoadingPlugin.d.ts +1 -1
- package/dist/builtin-plugin/EnsureChunkConditionsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/EntryPlugin.d.ts +2 -2
- package/dist/builtin-plugin/EsmNodeTargetPlugin.d.ts +1 -1
- package/dist/builtin-plugin/EvalDevToolModulePlugin.d.ts +2 -2
- package/dist/builtin-plugin/EvalSourceMapDevToolPlugin.d.ts +2 -2
- package/dist/builtin-plugin/ExternalsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/FetchCompileAsyncWasmPlugin.d.ts +1 -1
- package/dist/builtin-plugin/FileUriPlugin.d.ts +1 -1
- package/dist/builtin-plugin/FlagAllModulesAsUsedPlugin.d.ts +1 -1
- package/dist/builtin-plugin/FlagDependencyExportsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/FlagDependencyUsagePlugin.d.ts +1 -1
- package/dist/builtin-plugin/HashedModuleIdsPlugin.d.ts +2 -2
- package/dist/builtin-plugin/HotModuleReplacementPlugin.d.ts +1 -1
- package/dist/builtin-plugin/HttpExternalsRspackPlugin.d.ts +1 -1
- package/dist/builtin-plugin/HttpUriPlugin.d.ts +5 -1
- package/dist/builtin-plugin/IgnorePlugin.d.ts +2 -2
- package/dist/builtin-plugin/InferAsyncModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/InlineExportsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/JavascriptModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/JsLoaderRspackPlugin.d.ts +1 -1
- package/dist/builtin-plugin/JsonModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/LibManifestPlugin.d.ts +1 -1
- package/dist/builtin-plugin/LightningCssMinimizerRspackPlugin.d.ts +1 -1
- package/dist/builtin-plugin/LimitChunkCountPlugin.d.ts +1 -1
- package/dist/builtin-plugin/MangleExportsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/MergeDuplicateChunksPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ModuleChunkFormatPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ModuleConcatenationPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ModuleInfoHeaderPlugin.d.ts +1 -1
- package/dist/builtin-plugin/NamedChunkIdsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/NamedModuleIdsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/NaturalChunkIdsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/NaturalModuleIdsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/NoEmitOnErrorsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/NodeTargetPlugin.d.ts +1 -1
- package/dist/builtin-plugin/NormalModuleReplacementPlugin.d.ts +1 -1
- package/dist/builtin-plugin/OccurrenceChunkIdsPlugin.d.ts +2 -2
- package/dist/builtin-plugin/ProgressPlugin.d.ts +2 -2
- package/dist/builtin-plugin/ProvidePlugin.d.ts +1 -1
- package/dist/builtin-plugin/RealContentHashPlugin.d.ts +1 -1
- package/dist/builtin-plugin/RemoveDuplicateModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/RemoveEmptyChunksPlugin.d.ts +1 -1
- package/dist/builtin-plugin/RsdoctorPlugin.d.ts +2 -2
- package/dist/builtin-plugin/RslibPlugin.d.ts +4 -4
- package/dist/builtin-plugin/RstestPlugin.d.ts +2 -2
- package/dist/builtin-plugin/RuntimeChunkPlugin.d.ts +2 -2
- package/dist/builtin-plugin/RuntimePlugin.d.ts +1 -1
- package/dist/builtin-plugin/SideEffectsFlagPlugin.d.ts +1 -1
- package/dist/builtin-plugin/SizeLimitsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/SourceMapDevToolPlugin.d.ts +2 -2
- package/dist/builtin-plugin/SplitChunksPlugin.d.ts +1 -1
- package/dist/builtin-plugin/SubresourceIntegrityPlugin.d.ts +2 -2
- package/dist/builtin-plugin/SwcJsMinimizerPlugin.d.ts +1 -1
- package/dist/builtin-plugin/SyncModuleIdsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/URLPlugin.d.ts +1 -1
- package/dist/builtin-plugin/WorkerPlugin.d.ts +1 -1
- package/dist/builtin-plugin/base.d.ts +1 -1
- package/dist/builtin-plugin/css-extract/index.d.ts +1 -1
- package/dist/builtin-plugin/css-extract/utils.d.ts +4 -1
- package/dist/builtin-plugin/html-plugin/hooks.d.ts +1 -1
- package/dist/builtin-plugin/html-plugin/plugin.d.ts +2 -2
- package/dist/builtin-plugin/lazy-compilation/lazyCompilation.d.ts +3 -3
- package/dist/builtin-plugin/rsc/RscClientPlugin.d.ts +1 -1
- package/dist/builtin-plugin/rsc/RscServerPlugin.d.ts +1 -1
- package/dist/config/adapter.d.ts +1 -1
- package/dist/config/adapterRuleUse.d.ts +3 -2
- package/dist/config/normalization.d.ts +6 -9
- package/dist/config/types.d.ts +79 -16
- package/dist/container/ContainerPlugin.d.ts +1 -1
- package/dist/container/ContainerReferencePlugin.d.ts +1 -1
- package/dist/container/ModuleFederationManifestPlugin.d.ts +1 -1
- package/dist/container/ModuleFederationPluginV1.d.ts +5 -1
- package/dist/container/ModuleFederationRuntimePlugin.d.ts +1 -1
- package/dist/cssExtractLoader.js +7 -5
- package/dist/exports.d.ts +5 -5
- package/dist/index.js +885 -408
- package/dist/lib/Cache.d.ts +3 -0
- package/dist/lib/DllReferencePlugin.d.ts +1 -1
- package/dist/lib/WebpackError.d.ts +1 -1
- package/dist/loader-runner/cache.d.ts +11 -2
- package/dist/loader-runner/dependencies.d.ts +4 -3
- package/dist/loader-runner/index.d.ts +1 -1
- package/dist/loader-runner/service.d.ts +6 -1
- package/dist/loader-runner/worker.d.ts +1 -1
- package/dist/l~0.js +34 -0
- package/dist/l~3.js +34 -0
- package/dist/sharing/CollectSharedEntryPlugin.d.ts +1 -1
- package/dist/sharing/ConsumeSharedPlugin.d.ts +1 -1
- package/dist/sharing/ProvideSharedPlugin.d.ts +1 -1
- package/dist/sharing/SharePlugin.d.ts +13 -1
- package/dist/sharing/ShareRuntimePlugin.d.ts +1 -1
- package/dist/sharing/SharedContainerPlugin.d.ts +1 -1
- package/dist/sharing/SharedUsedExportsOptimizerPlugin.d.ts +2 -2
- package/dist/stats/StatsFactory.d.ts +4 -2
- package/dist/stats/StatsPrinter.d.ts +5 -5
- package/dist/stats/statsFactoryUtils.d.ts +5 -6
- package/dist/swc.d.ts +1 -1
- package/dist/taps/compilation.d.ts +1 -1
- package/dist/taps/types.d.ts +1 -1
- package/dist/util/SplitChunkSize.d.ts +1 -1
- package/dist/util/bindingHelpers.d.ts +7 -0
- package/dist/util/fs.d.ts +9 -9
- package/dist/util/source.d.ts +3 -3
- package/dist/util/watchTimeInfo.d.ts +7 -0
- package/dist/worker.js +78 -43
- package/package.json +8 -32
- package/compiled/webpack-sources/types.d.ts +0 -500
- package/dist/612~0.js +0 -32
- package/dist/612~3.js +0 -32
- package/dist/util/MergeCaller.d.ts +0 -10
- package/dist/util/fake.d.ts +0 -11
package/dist/worker.js
CHANGED
|
@@ -1,32 +1,29 @@
|
|
|
1
1
|
let createMd4, createXxhash64, url;
|
|
2
|
+
import { rspackRequire, moduleFactories, definePropertyGetters, makeNamespaceObject, compatGetDefaultExport } from "./l~3.js";
|
|
2
3
|
import node_fs from "node:fs";
|
|
3
4
|
import node_querystring from "node:querystring";
|
|
4
5
|
import { inspect, promisify } from "node:util";
|
|
5
6
|
import { receiveMessageOnPort } from "node:worker_threads";
|
|
6
7
|
import { createRequire, createRequire as __rspack_createRequire } from "node:module";
|
|
7
8
|
import node_path from "node:path";
|
|
8
|
-
import { __webpack_require__ } from "./612~3.js";
|
|
9
9
|
let __rspack_createRequire_require = __rspack_createRequire(import.meta.url);
|
|
10
|
-
|
|
10
|
+
moduleFactories.add({
|
|
11
11
|
"node:crypto" (module) {
|
|
12
12
|
module.exports = __rspack_createRequire_require("node:crypto");
|
|
13
13
|
},
|
|
14
|
-
"node:os" (module) {
|
|
15
|
-
module.exports = __rspack_createRequire_require("node:os");
|
|
16
|
-
},
|
|
17
14
|
"node:url" (module) {
|
|
18
15
|
module.exports = __rspack_createRequire_require("node:url");
|
|
19
16
|
}
|
|
20
17
|
});
|
|
21
18
|
var swc_namespaceObject = {};
|
|
22
|
-
|
|
19
|
+
makeNamespaceObject(swc_namespaceObject), definePropertyGetters(swc_namespaceObject, {
|
|
23
20
|
minify: ()=>minify,
|
|
24
21
|
minifySync: ()=>minifySync,
|
|
25
22
|
transform: ()=>transform,
|
|
26
23
|
transformSync: ()=>transformSync
|
|
27
24
|
});
|
|
28
|
-
let binding_namespaceObject = __rspack_createRequire_require(process.env.RSPACK_BINDING || "@
|
|
29
|
-
var binding_default =
|
|
25
|
+
let binding_namespaceObject = __rspack_createRequire_require(process.env.RSPACK_BINDING || "@rspack/binding");
|
|
26
|
+
var binding_default = compatGetDefaultExport(binding_namespaceObject);
|
|
30
27
|
async function minify(source, options) {
|
|
31
28
|
let _options = JSON.stringify(options || {});
|
|
32
29
|
return binding_default().minify(source, _options);
|
|
@@ -263,7 +260,6 @@ class Hash {
|
|
|
263
260
|
throw new AbstractMethodError();
|
|
264
261
|
}
|
|
265
262
|
}
|
|
266
|
-
let MAX_SHORT_STRING = -4 & Math.floor(16368);
|
|
267
263
|
class WasmHash {
|
|
268
264
|
exports;
|
|
269
265
|
instancesPool;
|
|
@@ -281,7 +277,7 @@ class WasmHash {
|
|
|
281
277
|
update(data, encoding) {
|
|
282
278
|
if ('string' == typeof data) {
|
|
283
279
|
let normalizedData = data;
|
|
284
|
-
for(; normalizedData.length >
|
|
280
|
+
for(; normalizedData.length > 16368;)this._updateWithShortString(normalizedData.slice(0, 16368), encoding), normalizedData = normalizedData.slice(16368);
|
|
285
281
|
return this._updateWithShortString(normalizedData, encoding), this;
|
|
286
282
|
}
|
|
287
283
|
return this._updateWithBuffer(data), this;
|
|
@@ -404,24 +400,30 @@ let createHash_createHash = (algorithm)=>{
|
|
|
404
400
|
})());
|
|
405
401
|
case 'native-md4':
|
|
406
402
|
return new BulkUpdateDecorator(()=>{
|
|
407
|
-
let { createHash } =
|
|
403
|
+
let { createHash } = rspackRequire("node:crypto");
|
|
408
404
|
return createHash('md4');
|
|
409
405
|
}, 'md4');
|
|
410
406
|
default:
|
|
411
407
|
return new BulkUpdateDecorator(()=>{
|
|
412
|
-
let { createHash } =
|
|
408
|
+
let { createHash } = rspackRequire("node:crypto");
|
|
413
409
|
return createHash(algorithm);
|
|
414
410
|
}, algorithm);
|
|
415
411
|
}
|
|
416
|
-
}, WINDOWS_ABS_PATH_REGEXP = /^[a-zA-Z]:[\\/]/, SEGMENTS_SPLIT_REGEXP = /([|!])/, WINDOWS_PATH_SEPARATOR_REGEXP = /\\/g,
|
|
412
|
+
}, WINDOWS_ABS_PATH_REGEXP = /^[a-zA-Z]:[\\/]/, SEGMENTS_SPLIT_REGEXP = /([|!])/, WINDOWS_PATH_SEPARATOR_REGEXP = /\\/g, getWindowsDosDevicePathPrefixLength = (identifier)=>{
|
|
413
|
+
if (identifier.length >= 4 && 92 === identifier.charCodeAt(0) && 92 === identifier.charCodeAt(1) && 92 === identifier.charCodeAt(3)) {
|
|
414
|
+
let namespace = identifier.charCodeAt(2);
|
|
415
|
+
if (63 === namespace || 46 === namespace) return 4;
|
|
416
|
+
}
|
|
417
|
+
return 0;
|
|
418
|
+
}, isWindowsAbsolutePath = (identifier)=>WINDOWS_ABS_PATH_REGEXP.test(identifier) || 0 !== getWindowsDosDevicePathPrefixLength(identifier), getQuerySplitPosition = (identifier)=>identifier.indexOf('?', getWindowsDosDevicePathPrefixLength(identifier)), relativePathToRequest = (relativePath)=>'' === relativePath ? './.' : '..' === relativePath ? '../.' : relativePath.startsWith('../') ? relativePath : `./${relativePath}`, absoluteToRequest = (context, maybeAbsolutePath)=>{
|
|
417
419
|
if ('/' === maybeAbsolutePath[0]) {
|
|
418
420
|
if (maybeAbsolutePath.length > 1 && '/' === maybeAbsolutePath[maybeAbsolutePath.length - 1]) return maybeAbsolutePath;
|
|
419
|
-
let querySplitPos = maybeAbsolutePath
|
|
421
|
+
let querySplitPos = getQuerySplitPosition(maybeAbsolutePath), resource = -1 === querySplitPos ? maybeAbsolutePath : maybeAbsolutePath.slice(0, querySplitPos);
|
|
420
422
|
return resource = relativePathToRequest(node_path.posix.relative(context, resource)), -1 === querySplitPos ? resource : resource + maybeAbsolutePath.slice(querySplitPos);
|
|
421
423
|
}
|
|
422
|
-
if (
|
|
423
|
-
let querySplitPos = maybeAbsolutePath
|
|
424
|
-
return resource = node_path.win32.relative(context, resource)
|
|
424
|
+
if (isWindowsAbsolutePath(maybeAbsolutePath)) {
|
|
425
|
+
let querySplitPos = getQuerySplitPosition(maybeAbsolutePath), resource = -1 === querySplitPos ? maybeAbsolutePath : maybeAbsolutePath.slice(0, querySplitPos);
|
|
426
|
+
return isWindowsAbsolutePath(resource = node_path.win32.relative(context, resource)) || (resource = relativePathToRequest(resource.replace(WINDOWS_PATH_SEPARATOR_REGEXP, '/'))), -1 === querySplitPos ? resource : resource + maybeAbsolutePath.slice(querySplitPos);
|
|
425
427
|
}
|
|
426
428
|
return maybeAbsolutePath;
|
|
427
429
|
}, makeCacheable = (realFn)=>{
|
|
@@ -482,14 +484,15 @@ let createHash_createHash = (algorithm)=>{
|
|
|
482
484
|
makeCacheableWithContext((context, identifier)=>identifier.split(SEGMENTS_SPLIT_REGEXP).map((str)=>absoluteToRequest(context, str)).join(''));
|
|
483
485
|
let contextify = makeCacheableWithContext((context, request)=>request.split('!').map((r)=>absoluteToRequest(context, r)).join('!')), absolutify = makeCacheableWithContext((context, request)=>request.split('!').map((r)=>r.startsWith('./') || r.startsWith('../') ? node_path.join(context, r) : r).join('!')), PATH_QUERY_FRAGMENT_REGEXP = /^((?:\u200b.|[^?#\u200b])*)(\?(?:\u200b.|[^#\u200b])*)?(#.*)?$/, PATH_QUERY_REGEXP = /^((?:\u200b.|[^?\u200b])*)(\?.*)?$/;
|
|
484
486
|
makeCacheable(function(str) {
|
|
485
|
-
|
|
487
|
+
let prefixLength = getWindowsDosDevicePathPrefixLength(str), resource = str.slice(prefixLength);
|
|
488
|
+
if (!resource.includes('?') && !resource.includes('#') && !resource.includes('\u200b')) return {
|
|
486
489
|
path: str,
|
|
487
490
|
query: '',
|
|
488
491
|
fragment: ''
|
|
489
492
|
};
|
|
490
|
-
let match = PATH_QUERY_FRAGMENT_REGEXP.exec(
|
|
493
|
+
let match = PATH_QUERY_FRAGMENT_REGEXP.exec(resource);
|
|
491
494
|
return match ? {
|
|
492
|
-
path: match[1].replace(/\u200b(.)/g, '$1'),
|
|
495
|
+
path: str.slice(0, prefixLength) + match[1].replace(/\u200b(.)/g, '$1'),
|
|
493
496
|
query: match[2] ? match[2].replace(/\u200b(.)/g, '$1') : '',
|
|
494
497
|
fragment: match[3] || ''
|
|
495
498
|
} : {
|
|
@@ -498,9 +501,9 @@ makeCacheable(function(str) {
|
|
|
498
501
|
fragment: ''
|
|
499
502
|
};
|
|
500
503
|
}), makeCacheable((str)=>{
|
|
501
|
-
let match = PATH_QUERY_REGEXP.exec(str);
|
|
504
|
+
let prefixLength = getWindowsDosDevicePathPrefixLength(str), match = PATH_QUERY_REGEXP.exec(str.slice(prefixLength));
|
|
502
505
|
return {
|
|
503
|
-
path: match[1].replace(/\u200b(.)/g, '$1'),
|
|
506
|
+
path: str.slice(0, prefixLength) + match[1].replace(/\u200b(.)/g, '$1'),
|
|
504
507
|
query: match[2] ? match[2].replace(/\u200b(.)/g, '$1') : ''
|
|
505
508
|
};
|
|
506
509
|
});
|
|
@@ -511,16 +514,16 @@ let memoize = (fn)=>{
|
|
|
511
514
|
constructor(message){
|
|
512
515
|
super(message), this.name = 'LoaderRunnerError', Error.captureStackTrace(this, this.constructor);
|
|
513
516
|
}
|
|
514
|
-
}, loadLoader_require = createRequire(import.meta.url),
|
|
517
|
+
}, loadLoader_require = createRequire(import.meta.url), loadLoader_moduleCache = new Map(), modulePromiseCache = new Map(), loaderUrlCache = new Map();
|
|
515
518
|
function loadLoader(loader, compiler, callback) {
|
|
516
|
-
let cacheKey = `${loader.type ?? 'commonjs'}\0${loader.path}`, cachedModule =
|
|
519
|
+
let cacheKey = `${loader.type ?? 'commonjs'}\0${loader.path}`, cachedModule = loadLoader_moduleCache.get(cacheKey);
|
|
517
520
|
if (void 0 !== cachedModule) return handleResult(loader, cachedModule, callback);
|
|
518
521
|
if ('module' === loader.type) try {
|
|
519
522
|
let modulePromise = modulePromiseCache.get(cacheKey);
|
|
520
523
|
if (void 0 === modulePromise) {
|
|
521
|
-
void 0 === url && (url =
|
|
524
|
+
void 0 === url && (url = rspackRequire("node:url"));
|
|
522
525
|
let loaderUrl = loaderUrlCache.get(loader.path);
|
|
523
|
-
void 0 === loaderUrl && (loaderUrl = url.pathToFileURL(loader.path).toString(), loaderUrlCache.set(loader.path, loaderUrl)), modulePromise = import(loaderUrl).then((module)=>(
|
|
526
|
+
void 0 === loaderUrl && (loaderUrl = url.pathToFileURL(loader.path).toString(), loaderUrlCache.set(loader.path, loaderUrl)), modulePromise = import(loaderUrl).then((module)=>(loadLoader_moduleCache.set(cacheKey, module), modulePromiseCache.delete(cacheKey), module), (err)=>{
|
|
524
527
|
throw modulePromiseCache.delete(cacheKey), err;
|
|
525
528
|
}), modulePromiseCache.set(cacheKey, modulePromise);
|
|
526
529
|
}
|
|
@@ -548,19 +551,47 @@ function handleResult(loader, module, callback) {
|
|
|
548
551
|
function isWorkerResponseMessage(message) {
|
|
549
552
|
return 'response' === message.type;
|
|
550
553
|
}
|
|
551
|
-
function
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
554
|
+
function serializeAggregateErrorMember(value) {
|
|
555
|
+
return value instanceof Error ? {
|
|
556
|
+
__internal__type: 'error',
|
|
557
|
+
value: serializeErrorWithoutCloneCheck(value)
|
|
558
|
+
} : {
|
|
559
|
+
__internal__type: 'value',
|
|
560
|
+
value
|
|
557
561
|
};
|
|
562
|
+
}
|
|
563
|
+
function serializeErrorWithoutCloneCheck(error) {
|
|
564
|
+
if (error instanceof Error || error && 'object' == typeof error && 'message' in error) {
|
|
565
|
+
let serializedError = {
|
|
566
|
+
...error,
|
|
567
|
+
name: error.name,
|
|
568
|
+
stack: error.stack,
|
|
569
|
+
message: error.message
|
|
570
|
+
};
|
|
571
|
+
return error instanceof AggregateError ? (serializedError.__internal__isAggregateError = !0, serializedError.errors = error.errors.map(serializeAggregateErrorMember)) : delete serializedError.__internal__isAggregateError, serializedError;
|
|
572
|
+
}
|
|
558
573
|
if ('string' == typeof error) return {
|
|
559
574
|
name: 'Error',
|
|
560
575
|
message: error
|
|
561
576
|
};
|
|
562
577
|
throw Error('Failed to serialize error, only string, Error instances and objects with a message property are supported');
|
|
563
578
|
}
|
|
579
|
+
function serializeError(error) {
|
|
580
|
+
try {
|
|
581
|
+
let serializedError = serializeErrorWithoutCloneCheck(error);
|
|
582
|
+
return structuredClone(serializedError), serializedError;
|
|
583
|
+
} catch (serializationError) {
|
|
584
|
+
let reason = serializationError instanceof Error ? serializationError.message : 'unknown reason';
|
|
585
|
+
return serializeErrorWithoutCloneCheck(Error(`Failed to serialize error: ${reason}`));
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
function deserializeAggregateErrorMember(member) {
|
|
589
|
+
return 'error' === member.__internal__type ? deserializeError(member.value) : member.value;
|
|
590
|
+
}
|
|
591
|
+
function deserializeError(error) {
|
|
592
|
+
let { __internal__isAggregateError, errors, ...properties } = error, shouldDeserializeAsAggregate = !0 === __internal__isAggregateError && Array.isArray(errors), deserializedError = shouldDeserializeAsAggregate ? AggregateError(errors.map(deserializeAggregateErrorMember), error.message) : Error(error.message);
|
|
593
|
+
return Object.assign(deserializedError, properties), shouldDeserializeAsAggregate || void 0 === errors || (deserializedError.errors = errors), deserializedError;
|
|
594
|
+
}
|
|
564
595
|
let utils_decoder = new TextDecoder();
|
|
565
596
|
promisify(loadLoader);
|
|
566
597
|
let utils_runSyncOrAsync = promisify(function(fn, context, args, callback) {
|
|
@@ -784,14 +815,17 @@ async function loaderImpl({ args, loaderContext, loaderState }, sendRequest, wai
|
|
|
784
815
|
};
|
|
785
816
|
}
|
|
786
817
|
};
|
|
787
|
-
let _module = loaderContext._module
|
|
818
|
+
let _module = loaderContext._module, buildInfo = {
|
|
819
|
+
..._module.buildInfo ?? {}
|
|
820
|
+
};
|
|
788
821
|
loaderContext._module = {
|
|
789
822
|
type: _module.type,
|
|
790
823
|
identifier: ()=>_module.identifier,
|
|
791
824
|
matchResource: _module.matchResource,
|
|
792
825
|
request: _module.request,
|
|
793
826
|
userRequest: _module.userRequest,
|
|
794
|
-
rawRequest: _module.rawRequest
|
|
827
|
+
rawRequest: _module.rawRequest,
|
|
828
|
+
buildInfo
|
|
795
829
|
}, loaderContext.importModule = function(request, options, callback) {
|
|
796
830
|
if (!callback) return new Promise((resolve, reject)=>{
|
|
797
831
|
sendRequest("ImportModule", request, options).then((result)=>{
|
|
@@ -864,7 +898,7 @@ async function loaderImpl({ args, loaderContext, loaderState }, sendRequest, wai
|
|
|
864
898
|
break;
|
|
865
899
|
case binding_namespaceObject.JsLoaderState.Normal:
|
|
866
900
|
for(; loaderContext.loaderIndex >= 0;){
|
|
867
|
-
let currentLoaderObject = loaderContext.loaders[loaderContext.loaderIndex];
|
|
901
|
+
let cacheResult, currentLoaderObject = loaderContext.loaders[loaderContext.loaderIndex];
|
|
868
902
|
if (shouldYieldToMainThread(currentLoaderObject)) break;
|
|
869
903
|
if (currentLoaderObject.normalExecuted) {
|
|
870
904
|
loaderContext.loaderIndex--;
|
|
@@ -875,11 +909,12 @@ async function loaderImpl({ args, loaderContext, loaderState }, sendRequest, wai
|
|
|
875
909
|
try {
|
|
876
910
|
if (currentLoaderObject.loaderItem.cache) {
|
|
877
911
|
waitForPendingRequest(pendingDependencyRequest);
|
|
878
|
-
let
|
|
879
|
-
if (hit) {
|
|
912
|
+
let result = await sendRequest("LoaderCacheGet", loaderContext.loaderIndex, args[0], args[2]);
|
|
913
|
+
if (cacheResult = result, 'hit' === result.type) {
|
|
914
|
+
let { entry } = result;
|
|
880
915
|
currentLoaderObject.normalExecuted = !0, args = [
|
|
881
|
-
'string' == typeof
|
|
882
|
-
|
|
916
|
+
'string' == typeof entry.content ? entry.content : entry.content && Buffer.from(entry.content),
|
|
917
|
+
entry.sourceMap ? toObject(Buffer.from(entry.sourceMap)) : void 0,
|
|
883
918
|
void 0
|
|
884
919
|
];
|
|
885
920
|
continue;
|
|
@@ -895,7 +930,7 @@ async function loaderImpl({ args, loaderContext, loaderState }, sendRequest, wai
|
|
|
895
930
|
args[0] = (isShared = (buf = args[0]).buffer instanceof SharedArrayBuffer || buf.buffer.constructor?.name === 'SharedArrayBuffer', str = utils_decoder.decode(isShared ? Buffer.from(buf) : buf), 0xfeff === str.charCodeAt(0) ? str.slice(1) : str);
|
|
896
931
|
} else raw && 'string' == typeof args[0] && (args[0] = Buffer.from(args[0], 'utf-8'));
|
|
897
932
|
raw && args[0] instanceof Uint8Array && !Buffer.isBuffer(args[0]) && (args[0] = Buffer.from(args[0].buffer, args[0].byteOffset, args[0].byteLength));
|
|
898
|
-
}(args, !!currentLoaderObject.raw), args = await utils_runSyncOrAsync(fn, loaderContext, args) || [],
|
|
933
|
+
}(args, !!currentLoaderObject.raw), args = await utils_runSyncOrAsync(fn, loaderContext, args) || [], cacheResult?.type === 'miss' && (waitForPendingRequest(pendingDependencyRequest), await sendRequest("LoaderCacheStore", loaderContext.loaderIndex, args[0], function(map) {
|
|
899
934
|
if (null != map) return 'string' == typeof map ? map ? Buffer.from(map) : void 0 : Buffer.from(JSON.stringify(map));
|
|
900
935
|
}(args[1]), args[2]));
|
|
901
936
|
} finally{
|
|
@@ -907,7 +942,7 @@ async function loaderImpl({ args, loaderContext, loaderState }, sendRequest, wai
|
|
|
907
942
|
data: item.loaderItem.data,
|
|
908
943
|
normalExecuted: item.normalExecuted,
|
|
909
944
|
pitchExecuted: item.pitchExecuted
|
|
910
|
-
}))), args;
|
|
945
|
+
}))), sendRequest("UpdateBuildInfo", buildInfo), args;
|
|
911
946
|
}
|
|
912
947
|
let nextId = 0, responseCallbacks = {};
|
|
913
948
|
function handleIncomingResponses(workerMessage) {
|
|
@@ -917,7 +952,7 @@ function handleIncomingResponses(workerMessage) {
|
|
|
917
952
|
else throw Error(`No callback found for response with id ${id}`);
|
|
918
953
|
} else if ('response-error' === workerMessage.type) {
|
|
919
954
|
let { id, error } = workerMessage, callback = responseCallbacks[id];
|
|
920
|
-
if (callback) delete responseCallbacks[id], callback(error, void 0);
|
|
955
|
+
if (callback) delete responseCallbacks[id], callback(deserializeError(error), void 0);
|
|
921
956
|
else throw Error(`No callback found for response with id ${id}`);
|
|
922
957
|
}
|
|
923
958
|
}
|
|
@@ -953,7 +988,7 @@ export default function(workerOptions) {
|
|
|
953
988
|
let { message } = receiveMessageOnPort(workerSyncPort1);
|
|
954
989
|
if (id !== message.id) throw Error(`Unexpected response id: ${message.id}, expected: ${id}`);
|
|
955
990
|
if (isWorkerResponseMessage(message)) return message.data;
|
|
956
|
-
throw message.error;
|
|
991
|
+
throw deserializeError(message.error);
|
|
957
992
|
}), sendRequest), waitFor = (requests)=>sendRequest1.sync("WaitForPendingRequest", (Array.isArray(requests) ? requests : [
|
|
958
993
|
requests
|
|
959
994
|
]).map((request)=>request.id));
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ohos-ports/rspack-core",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.9-beta.0",
|
|
4
4
|
"webpackVersion": "5.75.0",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"description": "Fast Rust-based bundler for the web with a modernized webpack API",
|
|
6
|
+
"description": "Fast Rust-based bundler for the web with a modernized webpack API (OpenHarmony port: uses @ohos-ports/rspack-binding with the aarch64-unknown-linux-ohos native binary)",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
8
8
|
"publishConfig": {
|
|
9
9
|
"access": "public"
|
|
@@ -28,36 +28,17 @@
|
|
|
28
28
|
"engines": {
|
|
29
29
|
"node": "^20.19.0 || >=22.12.0"
|
|
30
30
|
},
|
|
31
|
-
"homepage": "https://
|
|
32
|
-
"bugs":
|
|
31
|
+
"homepage": "https://rspack.rs",
|
|
32
|
+
"bugs": {
|
|
33
|
+
"url": "https://github.com/ohos-ports/ohos-ports/issues"
|
|
34
|
+
},
|
|
33
35
|
"repository": {
|
|
34
36
|
"type": "git",
|
|
35
37
|
"url": "https://github.com/ohos-ports/ohos-ports.git",
|
|
36
|
-
"directory": "ports/
|
|
37
|
-
},
|
|
38
|
-
"devDependencies": {
|
|
39
|
-
"@ast-grep/napi": "^0.45.2",
|
|
40
|
-
"@napi-rs/wasm-runtime": "1.1.6",
|
|
41
|
-
"@rsbuild/plugin-node-polyfill": "^1.4.6",
|
|
42
|
-
"@rspack/lite-tapable": "1.1.5",
|
|
43
|
-
"@swc/types": "0.1.28",
|
|
44
|
-
"@types/node": "^20.19.43",
|
|
45
|
-
"browserslist-load-config": "^1.0.3",
|
|
46
|
-
"browserslist-to-es-version": "^1.4.2",
|
|
47
|
-
"connect-next": "^5.0.0",
|
|
48
|
-
"enhanced-resolve": "5.24.5",
|
|
49
|
-
"http-proxy-middleware": "^4.2.0",
|
|
50
|
-
"memfs": "4.68.1",
|
|
51
|
-
"open": "^11.0.1",
|
|
52
|
-
"prebundle": "^1.6.5",
|
|
53
|
-
"rstack": "^0.6.4",
|
|
54
|
-
"tinypool": "^2.1.2",
|
|
55
|
-
"typescript": "^6.0.3",
|
|
56
|
-
"watchpack": "2.5.2",
|
|
57
|
-
"webpack-sources": "3.5.1"
|
|
38
|
+
"directory": "ports/@rspack/core/2.2.9"
|
|
58
39
|
},
|
|
59
40
|
"dependencies": {
|
|
60
|
-
"@ohos-ports/rspack-binding
|
|
41
|
+
"@rspack/binding": "npm:@ohos-ports/rspack-binding@2.2.9-beta.0"
|
|
61
42
|
},
|
|
62
43
|
"peerDependencies": {
|
|
63
44
|
"@module-federation/runtime-tools": "^0.24.1 || ^2.0.0",
|
|
@@ -70,10 +51,5 @@
|
|
|
70
51
|
"@swc/helpers": {
|
|
71
52
|
"optional": true
|
|
72
53
|
}
|
|
73
|
-
},
|
|
74
|
-
"scripts": {
|
|
75
|
-
"build": "rs lib",
|
|
76
|
-
"build:browser": "rs lib -c rstack.browser.config.ts",
|
|
77
|
-
"dev": "rs lib --watch"
|
|
78
54
|
}
|
|
79
55
|
}
|