@ohos-ports/rspack-core 2.3.2-beta.0 → 2.3.4-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.
@@ -0,0 +1,47 @@
1
+ export type RawSourceMap = import("../Source").RawSourceMap;
2
+ /**
3
+ * Where a generated position came from: `line` counts from one, `column`
4
+ * from zero, as in a stack trace.
5
+ */
6
+ export type OriginalPosition = {
7
+ /**
8
+ * source, joined with the map's `sourceRoot`
9
+ */
10
+ source: string;
11
+ /**
12
+ * line
13
+ */
14
+ line: number;
15
+ /**
16
+ * column
17
+ */
18
+ column: number;
19
+ /**
20
+ * name, if the mapping carries one
21
+ */
22
+ name: string | null;
23
+ };
24
+ /** @typedef {import("../Source").RawSourceMap} RawSourceMap */
25
+ /**
26
+ * Where a generated position came from: `line` counts from one, `column`
27
+ * from zero, as in a stack trace.
28
+ * @typedef {object} OriginalPosition
29
+ * @property {string} source source, joined with the map's `sourceRoot`
30
+ * @property {number} line line
31
+ * @property {number} column column
32
+ * @property {string | null} name name, if the mapping carries one
33
+ */
34
+ /**
35
+ * Finds the original position of a generated one: the closest mapping at or
36
+ * before `column` on `line`. Decodes the whole map, so it suits a one-off
37
+ * lookup (an error location), not a loop over many positions.
38
+ * @param {RawSourceMap | string | Buffer} sourceMap source map, or its JSON
39
+ * @param {number} line generated line, counting from one
40
+ * @param {number} column generated column, counting from zero
41
+ * @returns {OriginalPosition | null} original position, or `null` when nothing maps there
42
+ */
43
+ export function originalPositionFor(
44
+ sourceMap: RawSourceMap | string | Buffer,
45
+ line: number,
46
+ column: number,
47
+ ): OriginalPosition | null;
@@ -29,6 +29,7 @@ declare namespace _exports {
29
29
  const CompatSource: typeof import("./CompatSource");
30
30
  namespace util {
31
31
  const scopes: typeof import("./helpers/scopes");
32
+ const sourceMap: typeof import("./helpers/sourceMap");
32
33
  const stringBufferUtils: typeof import("./helpers/stringBufferUtils");
33
34
  }
34
35
  }
@@ -356,6 +356,7 @@ export declare enum RuntimeVariable {
356
356
  StartupExec = 6
357
357
  }
358
358
  export declare function renderRuntimeVariables(variable: RuntimeVariable, compilerOptions?: RspackOptionsNormalized): string;
359
+ export declare function renderRuntimeGlobalProperty(runtimeGlobal: RuntimeGlobals, compilerOptions?: RspackOptionsNormalized): string;
359
360
  export declare function createCompilerRuntimeGlobals(compilerOptions?: RspackOptionsNormalized): Record<keyof typeof RuntimeGlobals, string>;
360
361
  declare const DefaultRuntimeGlobals: Record<"amdDefine" | "amdOptions" | "asyncModule" | "asyncModuleExportSymbol" | "baseURI" | "chunkCallback" | "chunkName" | "compatGetDefaultExport" | "compileWasm" | "createFakeNamespaceObject" | "createScript" | "createScriptUrl" | "currentRemoteGetScope" | "deferredModuleExports" | "definePropertyGetters" | "ensureChunk" | "ensureChunkHandlers" | "ensureChunkIncludeEntries" | "entryModuleId" | "exports" | "externalInstallChunk" | "getChunkCssFilename" | "getChunkScriptFilename" | "getChunkUpdateCssFilename" | "getChunkUpdateScriptFilename" | "getFullHash" | "getTrustedTypesPolicy" | "getUpdateManifestFilename" | "global" | "harmonyModuleDecorator" | "hasCssModules" | "hasFetchPriority" | "hasOwnProperty" | "hmrDownloadManifest" | "hmrDownloadUpdateHandlers" | "hmrInvalidateModuleHandlers" | "hmrModuleData" | "hmrRuntimeStatePrefix" | "initializeSharing" | "instantiateWasm" | "interceptModuleExecution" | "loadScript" | "makeDeferredNamespaceObject" | "makeDeferredNamespaceObjectSymbol" | "makeNamespaceObject" | "module" | "moduleCache" | "moduleFactories" | "moduleFactoriesAddOnly" | "moduleId" | "moduleLoaded" | "nodeModuleDecorator" | "onChunksLoaded" | "prefetchChunk" | "prefetchChunkHandlers" | "preloadChunk" | "preloadChunkHandlers" | "publicPath" | "relativeUrl" | "require" | "requireScope" | "returnExportsFromRuntime" | "rspackUniqueId" | "rspackVersion" | "runtimeId" | "scriptNonce" | "shareScopeMap" | "startup" | "startupChunkDependencies" | "startupEntrypoint" | "startupNoDefault" | "startupOnlyAfter" | "startupOnlyBefore" | "system" | "systemContext" | "thisAsExports" | "uncaughtErrorHandler" | "wasmInstances", string>;
361
- export { DefaultRuntimeGlobals as RuntimeGlobals };
362
+ export { RuntimeGlobals as RuntimeGlobal, DefaultRuntimeGlobals as RuntimeGlobals, };
@@ -51,6 +51,7 @@ export declare class RuntimeTemplate {
51
51
  supportsOptionalChaining(): boolean;
52
52
  supportsForOf(): boolean;
53
53
  supportsDestructuring(): boolean;
54
+ supportsSpread(): boolean;
54
55
  supportsBigIntLiteral(): boolean;
55
56
  supportsDynamicImport(): boolean;
56
57
  supportsEcmaScriptModuleSyntax(): boolean;
@@ -45,9 +45,10 @@ export declare enum Features {
45
45
  DoublePositionGradients = 131072,
46
46
  VendorPrefixes = 262144,
47
47
  LogicalProperties = 524288,
48
+ LightDark = 1048576,
48
49
  Selectors = 31,
49
50
  MediaQueries = 448,
50
- Color = 64512
51
+ Color = 1113088
51
52
  }
52
53
  export interface Targets {
53
54
  android?: string;
@@ -63,6 +64,8 @@ export interface Targets {
63
64
  export interface Drafts {
64
65
  /** Whether to enable @custom-media rules. */
65
66
  customMedia?: boolean;
67
+ /** Whether to enable scroll navigation pseudo-classes. */
68
+ scrollNavigationControls?: boolean;
66
69
  }
67
70
  export interface NonStandard {
68
71
  /** Whether to enable the non-standard >>> and /deep/ selector combinators used by Angular and Vue. */
@@ -96,6 +99,7 @@ export type FeatureOptions = {
96
99
  doublePositionGradients?: boolean;
97
100
  vendorPrefixes?: boolean;
98
101
  logicalProperties?: boolean;
102
+ lightDark?: boolean;
99
103
  selectors?: boolean;
100
104
  mediaQueries?: boolean;
101
105
  color?: boolean;
@@ -2,6 +2,7 @@ import { type BuiltinPlugin, BuiltinPluginName } from '@rspack/binding';
2
2
  import { RspackBuiltinPlugin } from './base.js';
3
3
  export interface CompactHashedChunkIdsPluginOptions {
4
4
  minLength?: number;
5
+ salt?: number;
5
6
  }
6
7
  export declare class CompactHashedChunkIdsPlugin extends RspackBuiltinPlugin {
7
8
  private options;
@@ -2,6 +2,7 @@ import { type BuiltinPlugin, BuiltinPluginName } from '@rspack/binding';
2
2
  import { RspackBuiltinPlugin } from './base.js';
3
3
  export interface CompactHashedModuleIdsPluginOptions {
4
4
  minLength?: number;
5
+ salt?: number;
5
6
  }
6
7
  export declare class CompactHashedModuleIdsPlugin extends RspackBuiltinPlugin {
7
8
  private options;
@@ -1,7 +1,12 @@
1
1
  import { type BuiltinPlugin, BuiltinPluginName } from '@rspack/binding';
2
2
  import { RspackBuiltinPlugin } from './base.js';
3
+ export interface DeterministicChunkIdsPluginOptions {
4
+ salt?: number;
5
+ }
3
6
  export declare class DeterministicChunkIdsPlugin extends RspackBuiltinPlugin {
7
+ private options;
4
8
  name: BuiltinPluginName;
5
9
  affectedHooks: 'compilation';
10
+ constructor(options?: DeterministicChunkIdsPluginOptions);
6
11
  raw(): BuiltinPlugin;
7
12
  }
@@ -421,5 +421,6 @@ export type LoaderDefinition<OptionsType = {}, ContextAdditions = {}> = LoaderDe
421
421
  };
422
422
  export declare function createRawModuleRuleUses(uses: RuleSetUseItem | RuleSetUseItem[], path: string, options: ComposeJsUseOptions): RawModuleRuleUse[];
423
423
  export type GetLoaderOptions = (o: RuleSetLoaderWithOptions['options'], options: ComposeJsUseOptions) => RuleSetLoaderWithOptions['options'];
424
+ export declare function serializeLoaderOptionsForCache(options: unknown): string | undefined;
424
425
  export declare function isUseSourceMap(devtool: RspackOptionsNormalized['devtool']): boolean;
425
426
  export declare function isUseSimpleSourceMap(devtool: RspackOptionsNormalized['devtool']): boolean;
@@ -81,6 +81,10 @@ export type EcmaTargetProperties = {
81
81
  optionalChaining: boolean | null;
82
82
  /** logical assignment is available */
83
83
  logicalAssignment: boolean | null;
84
+ /** spread and rest in array/object literals and calls is available */
85
+ spread: boolean | null;
86
+ /** Symbol and well-known symbols are available */
87
+ symbol: boolean | null;
84
88
  /** template literal is available */
85
89
  templateLiteral: boolean | null;
86
90
  /** async functions and await are available */
@@ -299,6 +299,10 @@ export type Environment = {
299
299
  optionalChaining?: boolean;
300
300
  /** The environment supports logical assignment ('a ||= b'). */
301
301
  logicalAssignment?: boolean;
302
+ /** The environment supports spread and rest in array/object literals and calls ('{ ...obj }'). */
303
+ spread?: boolean;
304
+ /** The environment supports 'Symbol' (and well-known symbols like 'Symbol.toStringTag'). */
305
+ symbol?: boolean;
302
306
  /** The environment supports template literals. */
303
307
  templateLiteral?: boolean;
304
308
  /** The environment supports top-level await ('await x' at the top level of a module). */
@@ -1341,6 +1345,8 @@ export type Target = false | AllowTarget | AllowTarget[];
1341
1345
  * @default 'var'
1342
1346
  */
1343
1347
  export type ExternalsType = 'var' | 'module' | 'assign' | 'this' | 'window' | 'self' | 'global' | 'commonjs' | 'commonjs2' | 'commonjs-module' | 'commonjs-static' | 'amd' | 'amd-require' | 'umd' | 'umd2' | 'jsonp' | 'system' | 'promise' | 'import' | 'module-import' | 'modern-module' | 'script' | 'node-commonjs' | 'commonjs-import' | 'asset' | 'asset-url' | 'css-import';
1348
+ /** How an external's exports interoperate with ES module imports. */
1349
+ export type ExternalItemInterop = 'default' | 'esModule';
1344
1350
  /**
1345
1351
  * External item object when both library.type and externalsType is 'umd'
1346
1352
  */
@@ -1349,11 +1355,16 @@ export type ExternalItemUmdValue = {
1349
1355
  commonjs: string | string[];
1350
1356
  commonjs2: string | string[];
1351
1357
  amd: string | string[];
1358
+ /** Overrides default-export interop independently of the importing module. */
1359
+ interop?: ExternalItemInterop;
1352
1360
  };
1353
1361
  /**
1354
1362
  * External item object when not umd
1355
1363
  */
1356
- export type ExternalItemObjectValue = Record<string, string | string[]>;
1364
+ export type ExternalItemObjectValue = Record<string, string | string[]> & {
1365
+ /** Overrides default-export interop independently of the importing module. */
1366
+ interop?: ExternalItemInterop;
1367
+ };
1357
1368
  /**
1358
1369
  * The dependency used for the external.
1359
1370
  */
@@ -57,7 +57,7 @@ let pitch = function(request) {
57
57
  let locals, namedExport, esModule = void 0 === options.esModule || options.esModule, dependencies = [];
58
58
  try {
59
59
  let exports = originalExports.__esModule ? originalExports.default : originalExports;
60
- if (namedExport = originalExports.__esModule && (!originalExports.default || !('locals' in originalExports.default))) for (let key of Object.keys(originalExports))'default' !== key && (locals || (locals = {}), locals[key] = originalExports[key]);
60
+ if (namedExport = originalExports.__esModule && (!originalExports.default || !('locals' in originalExports.default))) for (let key of Object.keys(originalExports))'default' !== key && ((locals ??= {})[key] = originalExports[key]);
61
61
  else locals = exports?.locals;
62
62
  if (Array.isArray(exports) && emit) {
63
63
  let identifierCountMap = new Map();
package/dist/exports.d.ts CHANGED
@@ -83,7 +83,7 @@ interface Electron {
83
83
  ElectronTargetPlugin: typeof ElectronTargetPlugin;
84
84
  }
85
85
  export declare const electron: Electron;
86
- import { CompactHashedChunkIdsPlugin, CompactHashedModuleIdsPlugin, DeterministicModuleIdsPlugin, HashedModuleIdsPlugin, SyncModuleIdsPlugin } from './builtin-plugin/index.js';
86
+ import { CompactHashedChunkIdsPlugin, CompactHashedModuleIdsPlugin, DeterministicChunkIdsPlugin, DeterministicModuleIdsPlugin, HashedModuleIdsPlugin, SyncModuleIdsPlugin } from './builtin-plugin/index.js';
87
87
  interface Ids {
88
88
  CompactHashedChunkIdsPlugin: typeof CompactHashedChunkIdsPlugin;
89
89
  CompactHashedModuleIdsPlugin: typeof CompactHashedModuleIdsPlugin;
@@ -91,6 +91,7 @@ interface Ids {
91
91
  CompatHashedChunkIdsPlugin: typeof CompactHashedChunkIdsPlugin;
92
92
  /** @deprecated Use `CompactHashedModuleIdsPlugin` instead. */
93
93
  CompatHashedModuleIdsPlugin: typeof CompactHashedModuleIdsPlugin;
94
+ DeterministicChunkIdsPlugin: typeof DeterministicChunkIdsPlugin;
94
95
  DeterministicModuleIdsPlugin: typeof DeterministicModuleIdsPlugin;
95
96
  HashedModuleIdsPlugin: typeof HashedModuleIdsPlugin;
96
97
  }