@utoo/pack-shared 1.5.40-alpha.1 → 1.5.40-alpha.2

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/cjs/config.d.ts CHANGED
@@ -88,6 +88,30 @@ export type TurbopackRuleConfigItem = {
88
88
  export type TurbopackRuleConfigCollection = TurbopackRuleConfigItem | (TurbopackLoaderItem | TurbopackRuleConfigItem)[];
89
89
  export interface ModuleOptions {
90
90
  rules?: Record<string, TurbopackRuleConfigCollection>;
91
+ /** Replace exact source modules in browser builds before parsing their implementation. */
92
+ references?: ModuleReferenceConfig[];
93
+ }
94
+ export type ModuleReferenceData = null | boolean | number | string | ModuleReferenceData[] | {
95
+ [key: string]: ModuleReferenceData;
96
+ };
97
+ export interface ModuleReferenceConfig {
98
+ /** Exact project-relative path, or absolute path within the project. */
99
+ resource: string;
100
+ references: {
101
+ /** Local identity, shared by every export that refers to this id. */
102
+ id: string;
103
+ factory: {
104
+ /** Module specifier resolved from the replaced resource's directory. */
105
+ module: string;
106
+ export: string;
107
+ };
108
+ /** Browser-visible JSON passed unchanged to the factory. */
109
+ data: ModuleReferenceData;
110
+ }[];
111
+ exports: {
112
+ name: string;
113
+ reference: string;
114
+ }[];
91
115
  }
92
116
  /**
93
117
  * Path rewrite: object form applies first matching regex→replacement;
package/esm/config.d.ts CHANGED
@@ -88,6 +88,30 @@ export type TurbopackRuleConfigItem = {
88
88
  export type TurbopackRuleConfigCollection = TurbopackRuleConfigItem | (TurbopackLoaderItem | TurbopackRuleConfigItem)[];
89
89
  export interface ModuleOptions {
90
90
  rules?: Record<string, TurbopackRuleConfigCollection>;
91
+ /** Replace exact source modules in browser builds before parsing their implementation. */
92
+ references?: ModuleReferenceConfig[];
93
+ }
94
+ export type ModuleReferenceData = null | boolean | number | string | ModuleReferenceData[] | {
95
+ [key: string]: ModuleReferenceData;
96
+ };
97
+ export interface ModuleReferenceConfig {
98
+ /** Exact project-relative path, or absolute path within the project. */
99
+ resource: string;
100
+ references: {
101
+ /** Local identity, shared by every export that refers to this id. */
102
+ id: string;
103
+ factory: {
104
+ /** Module specifier resolved from the replaced resource's directory. */
105
+ module: string;
106
+ export: string;
107
+ };
108
+ /** Browser-visible JSON passed unchanged to the factory. */
109
+ data: ModuleReferenceData;
110
+ }[];
111
+ exports: {
112
+ name: string;
113
+ reference: string;
114
+ }[];
91
115
  }
92
116
  /**
93
117
  * Path rewrite: object form applies first matching regex→replacement;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@utoo/pack-shared",
3
- "version": "1.5.40-alpha.1",
3
+ "version": "1.5.40-alpha.2",
4
4
  "main": "cjs/index.js",
5
5
  "module": "esm/index.js",
6
6
  "types": "esm/index.d.ts",