@atlaspack/resolver-tesseract 2.15.3-canary.3963 → 2.15.3-canary.3965
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/TesseractResolver.js +19 -8
- package/package.json +5 -5
- package/src/TesseractResolver.ts +26 -10
package/lib/TesseractResolver.js
CHANGED
|
@@ -38,7 +38,7 @@ const STATIC_FALLBACK_MODULES = ['buffer', 'stream', 'events', 'util'];
|
|
|
38
38
|
const STATIC_FALLBACK_ALIAS = {};
|
|
39
39
|
const getIgnoreModules = (env, ignoreModules) => {
|
|
40
40
|
if (env.PILLAR_LOCAL_DEVELOPMENT === 'true') {
|
|
41
|
-
ignoreModules
|
|
41
|
+
return [...ignoreModules, '@atlassiansox/analytics-web-client'];
|
|
42
42
|
}
|
|
43
43
|
return ignoreModules;
|
|
44
44
|
};
|
|
@@ -76,7 +76,7 @@ var _default = exports.default = new (_plugin().Resolver)({
|
|
|
76
76
|
packageKey: '@atlaspack/resolver-tesseract'
|
|
77
77
|
});
|
|
78
78
|
const userConfig = (conf === null || conf === void 0 ? void 0 : conf.contents) || {};
|
|
79
|
-
const preResolved = userConfig.preResolved
|
|
79
|
+
const preResolved = userConfig.preResolved ? new Map(Object.entries(userConfig.preResolved)) : new Map();
|
|
80
80
|
const builtinAliases = userConfig.builtinAliases || {};
|
|
81
81
|
const serverSuffixes = userConfig.serverSuffixes || [];
|
|
82
82
|
const ignoreModules = userConfig.ignoreModules || [];
|
|
@@ -115,10 +115,6 @@ var _default = exports.default = new (_plugin().Resolver)({
|
|
|
115
115
|
config,
|
|
116
116
|
options
|
|
117
117
|
}) {
|
|
118
|
-
// Only resolve for Tesseract environment
|
|
119
|
-
if (!dependency.env.isTesseract()) {
|
|
120
|
-
return null;
|
|
121
|
-
}
|
|
122
118
|
const {
|
|
123
119
|
nodeResolver,
|
|
124
120
|
browserResolver,
|
|
@@ -153,8 +149,11 @@ var _default = exports.default = new (_plugin().Resolver)({
|
|
|
153
149
|
}
|
|
154
150
|
let preResolvedValue = preResolved.get(specifier);
|
|
155
151
|
if (preResolvedValue) {
|
|
152
|
+
const resolvedPath = preResolvedValue.startsWith('./') || preResolvedValue.startsWith('../') ? require.resolve((0, _path().join)(options.projectRoot, preResolvedValue)) : require.resolve(preResolvedValue, {
|
|
153
|
+
paths: [options.projectRoot]
|
|
154
|
+
});
|
|
156
155
|
return {
|
|
157
|
-
filePath:
|
|
156
|
+
filePath: resolvedPath,
|
|
158
157
|
code: undefined,
|
|
159
158
|
sideEffects: false
|
|
160
159
|
};
|
|
@@ -166,7 +165,19 @@ var _default = exports.default = new (_plugin().Resolver)({
|
|
|
166
165
|
parent: dependency.resolveFrom,
|
|
167
166
|
filename: aliasSpecifier || specifier,
|
|
168
167
|
specifierType: dependency.specifierType,
|
|
169
|
-
env: dependency.env,
|
|
168
|
+
env: new Proxy(dependency.env, {
|
|
169
|
+
get(target, property) {
|
|
170
|
+
if (property === 'isLibrary') {
|
|
171
|
+
return false;
|
|
172
|
+
}
|
|
173
|
+
if (typeof property === 'string') {
|
|
174
|
+
const value = target[property];
|
|
175
|
+
const ret = typeof value === 'function' ? value.bind(target) : value;
|
|
176
|
+
return ret;
|
|
177
|
+
}
|
|
178
|
+
return Reflect.get(target, property);
|
|
179
|
+
}
|
|
180
|
+
}),
|
|
170
181
|
packageConditions: ['ssr', 'require']
|
|
171
182
|
}) : nodeResolver.resolve({
|
|
172
183
|
sourcePath: dependency.sourcePath,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaspack/resolver-tesseract",
|
|
3
|
-
"version": "2.15.3-canary.
|
|
3
|
+
"version": "2.15.3-canary.3965+f6532d7a4",
|
|
4
4
|
"license": "(MIT OR Apache-2.0)",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -16,14 +16,14 @@
|
|
|
16
16
|
"node": ">= 16.0.0"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@atlaspack/node-resolver-core": "3.5.5-canary.
|
|
20
|
-
"@atlaspack/plugin": "2.14.5-canary.
|
|
21
|
-
"@atlaspack/types-internal": "2.14.1-canary.
|
|
19
|
+
"@atlaspack/node-resolver-core": "3.5.5-canary.186+f6532d7a4",
|
|
20
|
+
"@atlaspack/plugin": "2.14.5-canary.186+f6532d7a4",
|
|
21
|
+
"@atlaspack/types-internal": "2.14.1-canary.254+f6532d7a4"
|
|
22
22
|
},
|
|
23
23
|
"type": "commonjs",
|
|
24
24
|
"scripts": {
|
|
25
25
|
"check-ts": "tsc --emitDeclarationOnly --rootDir src",
|
|
26
26
|
"build:lib": "gulp build --gulpfile ../../../gulpfile.js --cwd ."
|
|
27
27
|
},
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "f6532d7a4f7f007bd4e5e36af04dd466f0b9f572"
|
|
29
29
|
}
|
package/src/TesseractResolver.ts
CHANGED
|
@@ -11,7 +11,7 @@ interface TesseractResolverConfig {
|
|
|
11
11
|
browserResolvedNodeBuiltins?: Array<string>;
|
|
12
12
|
|
|
13
13
|
/** Module mappings that bypass normal resolution (e.g., for SSR compatibility). */
|
|
14
|
-
preResolved?:
|
|
14
|
+
preResolved?: Record<string, string>;
|
|
15
15
|
|
|
16
16
|
/** Node.js built-in aliases for Tesseract-specific implementations. */
|
|
17
17
|
builtinAliases?: Record<string, string>;
|
|
@@ -37,7 +37,7 @@ const getIgnoreModules = (
|
|
|
37
37
|
ignoreModules: Array<string>,
|
|
38
38
|
) => {
|
|
39
39
|
if (env.PILLAR_LOCAL_DEVELOPMENT === 'true') {
|
|
40
|
-
ignoreModules
|
|
40
|
+
return [...ignoreModules, '@atlassiansox/analytics-web-client'];
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
return ignoreModules;
|
|
@@ -91,7 +91,9 @@ export default new Resolver({
|
|
|
91
91
|
});
|
|
92
92
|
const userConfig: TesseractResolverConfig = conf?.contents || {};
|
|
93
93
|
|
|
94
|
-
const preResolved = userConfig.preResolved
|
|
94
|
+
const preResolved = userConfig.preResolved
|
|
95
|
+
? new Map(Object.entries(userConfig.preResolved))
|
|
96
|
+
: new Map<string, string>();
|
|
95
97
|
const builtinAliases = userConfig.builtinAliases || {};
|
|
96
98
|
const serverSuffixes = userConfig.serverSuffixes || [];
|
|
97
99
|
const ignoreModules = userConfig.ignoreModules || [];
|
|
@@ -129,11 +131,6 @@ export default new Resolver({
|
|
|
129
131
|
};
|
|
130
132
|
},
|
|
131
133
|
resolve({dependency, specifier, config, options}) {
|
|
132
|
-
// Only resolve for Tesseract environment
|
|
133
|
-
if (!dependency.env.isTesseract()) {
|
|
134
|
-
return null;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
134
|
const {
|
|
138
135
|
nodeResolver,
|
|
139
136
|
browserResolver,
|
|
@@ -175,8 +172,12 @@ export default new Resolver({
|
|
|
175
172
|
|
|
176
173
|
let preResolvedValue = preResolved.get(specifier);
|
|
177
174
|
if (preResolvedValue) {
|
|
175
|
+
const resolvedPath =
|
|
176
|
+
preResolvedValue.startsWith('./') || preResolvedValue.startsWith('../')
|
|
177
|
+
? require.resolve(join(options.projectRoot, preResolvedValue))
|
|
178
|
+
: require.resolve(preResolvedValue, {paths: [options.projectRoot]});
|
|
178
179
|
return {
|
|
179
|
-
filePath:
|
|
180
|
+
filePath: resolvedPath,
|
|
180
181
|
code: undefined,
|
|
181
182
|
sideEffects: false,
|
|
182
183
|
};
|
|
@@ -197,7 +198,22 @@ export default new Resolver({
|
|
|
197
198
|
parent: dependency.resolveFrom,
|
|
198
199
|
filename: aliasSpecifier || specifier,
|
|
199
200
|
specifierType: dependency.specifierType,
|
|
200
|
-
env: dependency.env,
|
|
201
|
+
env: new Proxy(dependency.env, {
|
|
202
|
+
get(target, property) {
|
|
203
|
+
if (property === 'isLibrary') {
|
|
204
|
+
return false;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
if (typeof property === 'string') {
|
|
208
|
+
const value = target[property as keyof typeof target];
|
|
209
|
+
const ret =
|
|
210
|
+
typeof value === 'function' ? value.bind(target) : value;
|
|
211
|
+
return ret;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
return Reflect.get(target, property);
|
|
215
|
+
},
|
|
216
|
+
}),
|
|
201
217
|
packageConditions: ['ssr', 'require'],
|
|
202
218
|
})
|
|
203
219
|
: nodeResolver.resolve({
|