@atlaspack/transformer-css 2.14.5-canary.137 → 2.14.5-canary.139
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/CHANGELOG.md +8 -0
- package/lib/CSSTransformer.d.ts +3 -0
- package/lib/CSSTransformer.js +38 -8
- package/package.json +12 -8
- package/src/{CSSTransformer.js → CSSTransformer.ts} +44 -20
- package/tsconfig.json +4 -0
package/CHANGELOG.md
CHANGED
package/lib/CSSTransformer.js
CHANGED
|
@@ -78,15 +78,27 @@ var _default = exports.default = new (_plugin().Transformer)({
|
|
|
78
78
|
packageKey: '@atlaspack/transformer-css'
|
|
79
79
|
});
|
|
80
80
|
let contents = conf === null || conf === void 0 ? void 0 : conf.contents;
|
|
81
|
+
// @ts-expect-error TS2339
|
|
81
82
|
if (typeof (contents === null || contents === void 0 || (_contents$cssModules = contents.cssModules) === null || _contents$cssModules === void 0 ? void 0 : _contents$cssModules.include) === 'string') {
|
|
83
|
+
// @ts-expect-error TS2339
|
|
82
84
|
contents.cssModules.include = [(0, _utils().globToRegex)(contents.cssModules.include)];
|
|
85
|
+
// @ts-expect-error TS2339
|
|
83
86
|
} else if (Array.isArray(contents === null || contents === void 0 || (_contents$cssModules2 = contents.cssModules) === null || _contents$cssModules2 === void 0 ? void 0 : _contents$cssModules2.include)) {
|
|
84
|
-
|
|
87
|
+
// @ts-expect-error TS2339
|
|
88
|
+
contents.cssModules.include = contents.cssModules.include.map(
|
|
89
|
+
// @ts-expect-error TS7006
|
|
90
|
+
include => typeof include === 'string' ? (0, _utils().globToRegex)(include) : include);
|
|
85
91
|
}
|
|
92
|
+
// @ts-expect-error TS2339
|
|
86
93
|
if (typeof (contents === null || contents === void 0 || (_contents$cssModules3 = contents.cssModules) === null || _contents$cssModules3 === void 0 ? void 0 : _contents$cssModules3.exclude) === 'string') {
|
|
94
|
+
// @ts-expect-error TS2339
|
|
87
95
|
contents.cssModules.exclude = [(0, _utils().globToRegex)(contents.cssModules.exclude)];
|
|
96
|
+
// @ts-expect-error TS2339
|
|
88
97
|
} else if (Array.isArray(contents === null || contents === void 0 || (_contents$cssModules4 = contents.cssModules) === null || _contents$cssModules4 === void 0 ? void 0 : _contents$cssModules4.exclude)) {
|
|
89
|
-
|
|
98
|
+
// @ts-expect-error TS2339
|
|
99
|
+
contents.cssModules.exclude = contents.cssModules.exclude.map(
|
|
100
|
+
// @ts-expect-error TS7006
|
|
101
|
+
exclude => typeof exclude === 'string' ? (0, _utils().globToRegex)(exclude) : exclude);
|
|
90
102
|
}
|
|
91
103
|
return contents;
|
|
92
104
|
},
|
|
@@ -109,7 +121,7 @@ var _default = exports.default = new (_plugin().Transformer)({
|
|
|
109
121
|
sourceMap: asset.env.sourceMap
|
|
110
122
|
});
|
|
111
123
|
let [code, originalMap] = await Promise.all([asset.getBuffer(), asset.getMap(),
|
|
112
|
-
//
|
|
124
|
+
// @ts-expect-error TS2339
|
|
113
125
|
process.browser && native().default()]);
|
|
114
126
|
let targets = getTargets(asset.env.engines.browsers);
|
|
115
127
|
let res;
|
|
@@ -118,14 +130,14 @@ var _default = exports.default = new (_plugin().Transformer)({
|
|
|
118
130
|
res = transformStyleAttribute({
|
|
119
131
|
code,
|
|
120
132
|
analyzeDependencies: true,
|
|
121
|
-
//
|
|
133
|
+
// @ts-expect-error TS2339
|
|
122
134
|
errorRecovery: (config === null || config === void 0 ? void 0 : config.errorRecovery) || false,
|
|
123
135
|
targets
|
|
124
136
|
});
|
|
125
137
|
} else {
|
|
126
138
|
let cssModules = false;
|
|
127
139
|
if (asset.meta.type !== 'tag' && asset.meta.cssModulesCompiled == null) {
|
|
128
|
-
//
|
|
140
|
+
// @ts-expect-error TS2339
|
|
129
141
|
let cssModulesConfig = config === null || config === void 0 ? void 0 : config.cssModules;
|
|
130
142
|
let isCSSModule = /\.module\./.test(asset.filePath);
|
|
131
143
|
if (asset.isSource) {
|
|
@@ -134,6 +146,7 @@ var _default = exports.default = new (_plugin().Transformer)({
|
|
|
134
146
|
if (typeof cssModulesConfig === 'boolean') {
|
|
135
147
|
isCSSModule = true;
|
|
136
148
|
} else if (cssModulesConfig !== null && cssModulesConfig !== void 0 && cssModulesConfig.include) {
|
|
149
|
+
// @ts-expect-error TS7006
|
|
137
150
|
isCSSModule = cssModulesConfig.include.some(include => include.test(projectRootPath));
|
|
138
151
|
} else if (cssModulesConfig !== null && cssModulesConfig !== void 0 && cssModulesConfig.global) {
|
|
139
152
|
isCSSModule = true;
|
|
@@ -157,11 +170,11 @@ var _default = exports.default = new (_plugin().Transformer)({
|
|
|
157
170
|
preserveImports: true
|
|
158
171
|
} : false,
|
|
159
172
|
sourceMap: !!asset.env.sourceMap,
|
|
160
|
-
//
|
|
173
|
+
// @ts-expect-error TS2339
|
|
161
174
|
drafts: config === null || config === void 0 ? void 0 : config.drafts,
|
|
162
|
-
//
|
|
175
|
+
// @ts-expect-error TS2339
|
|
163
176
|
pseudoClasses: config === null || config === void 0 ? void 0 : config.pseudoClasses,
|
|
164
|
-
//
|
|
177
|
+
// @ts-expect-error TS2339
|
|
165
178
|
errorRecovery: (config === null || config === void 0 ? void 0 : config.errorRecovery) || false,
|
|
166
179
|
targets
|
|
167
180
|
});
|
|
@@ -201,7 +214,10 @@ var _default = exports.default = new (_plugin().Transformer)({
|
|
|
201
214
|
});
|
|
202
215
|
}
|
|
203
216
|
}
|
|
217
|
+
|
|
218
|
+
// @ts-expect-error TS2339
|
|
204
219
|
if (res.map != null) {
|
|
220
|
+
// @ts-expect-error TS2339
|
|
205
221
|
let vlqMap = JSON.parse(Buffer.from(res.map).toString());
|
|
206
222
|
let map = new (_sourceMap().default)(options.projectRoot);
|
|
207
223
|
map.addVLQMap(vlqMap);
|
|
@@ -216,6 +232,8 @@ var _default = exports.default = new (_plugin().Transformer)({
|
|
|
216
232
|
if (originalMap) {
|
|
217
233
|
loc = (0, _utils().remapSourceLocation)(loc, originalMap);
|
|
218
234
|
}
|
|
235
|
+
|
|
236
|
+
// @ts-expect-error TS2339
|
|
219
237
|
if (dep.type === 'import' && !res.exports) {
|
|
220
238
|
asset.addDependency({
|
|
221
239
|
specifier: dep.url,
|
|
@@ -241,9 +259,13 @@ var _default = exports.default = new (_plugin().Transformer)({
|
|
|
241
259
|
}
|
|
242
260
|
let assets = [asset];
|
|
243
261
|
let buffer = Buffer.from(res.code);
|
|
262
|
+
|
|
263
|
+
// @ts-expect-error TS2339
|
|
244
264
|
if (res.exports != null) {
|
|
265
|
+
// @ts-expect-error TS2339
|
|
245
266
|
let exports = res.exports;
|
|
246
267
|
asset.symbols.ensure();
|
|
268
|
+
// @ts-expect-error TS2345
|
|
247
269
|
asset.symbols.set('default', 'default');
|
|
248
270
|
let dependencies = new Map();
|
|
249
271
|
let locals = new Map();
|
|
@@ -306,6 +328,7 @@ var _default = exports.default = new (_plugin().Transformer)({
|
|
|
306
328
|
asset.addDependency({
|
|
307
329
|
specifier: (0, _nullthrows().default)(asset.uniqueKey),
|
|
308
330
|
specifierType: 'esm',
|
|
331
|
+
// @ts-expect-error TS2322
|
|
309
332
|
symbols: new Map([[key, {
|
|
310
333
|
local: exports[key].name,
|
|
311
334
|
isWeak: false,
|
|
@@ -319,6 +342,7 @@ var _default = exports.default = new (_plugin().Transformer)({
|
|
|
319
342
|
// It's possible that the exports can be ordered differently between builds.
|
|
320
343
|
// Sorting by key is safe as the order is irrelevant but needs to be deterministic.
|
|
321
344
|
for (let key of Object.keys(exports).sort()) {
|
|
345
|
+
// @ts-expect-error TS2345
|
|
322
346
|
asset.symbols.set(key, exports[key].name);
|
|
323
347
|
add(key);
|
|
324
348
|
}
|
|
@@ -329,11 +353,15 @@ var _default = exports.default = new (_plugin().Transformer)({
|
|
|
329
353
|
let d = `dep_$${c++}`;
|
|
330
354
|
depjs += `import * as ${d} from ${JSON.stringify(dep.url)};\n`;
|
|
331
355
|
js += `for (let key in ${d}) { if (key in module.exports) module.exports[key] += ' ' + ${d}[key]; else module.exports[key] = ${d}[key]; }\n`;
|
|
356
|
+
// @ts-expect-error TS2345
|
|
332
357
|
asset.symbols.set('*', '*');
|
|
333
358
|
}
|
|
334
359
|
}
|
|
335
360
|
}
|
|
361
|
+
|
|
362
|
+
// @ts-expect-error TS2339
|
|
336
363
|
if (res.references != null) {
|
|
364
|
+
// @ts-expect-error TS2339
|
|
337
365
|
let references = res.references;
|
|
338
366
|
for (let symbol in references) {
|
|
339
367
|
let reference = references[symbol];
|
|
@@ -341,6 +369,7 @@ var _default = exports.default = new (_plugin().Transformer)({
|
|
|
341
369
|
specifier: reference.specifier,
|
|
342
370
|
specifierType: 'esm',
|
|
343
371
|
packageConditions: ['style'],
|
|
372
|
+
// @ts-expect-error TS2322
|
|
344
373
|
symbols: new Map([[reference.name, {
|
|
345
374
|
local: symbol,
|
|
346
375
|
isWeak: false,
|
|
@@ -353,6 +382,7 @@ var _default = exports.default = new (_plugin().Transformer)({
|
|
|
353
382
|
}
|
|
354
383
|
assets.push({
|
|
355
384
|
type: 'js',
|
|
385
|
+
// @ts-expect-error TS2353
|
|
356
386
|
content: depjs + js,
|
|
357
387
|
dependencies: jsDeps,
|
|
358
388
|
env
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaspack/transformer-css",
|
|
3
|
-
"version": "2.14.5-canary.
|
|
3
|
+
"version": "2.14.5-canary.139+d2fd84977",
|
|
4
4
|
"license": "(MIT OR Apache-2.0)",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -9,15 +9,16 @@
|
|
|
9
9
|
"type": "git",
|
|
10
10
|
"url": "https://github.com/atlassian-labs/atlaspack.git"
|
|
11
11
|
},
|
|
12
|
-
"main": "lib/CSSTransformer.js",
|
|
13
|
-
"source": "src/CSSTransformer.
|
|
12
|
+
"main": "./lib/CSSTransformer.js",
|
|
13
|
+
"source": "./src/CSSTransformer.ts",
|
|
14
|
+
"types": "./lib/CSSTransformer.d.ts",
|
|
14
15
|
"engines": {
|
|
15
16
|
"node": ">= 16.0.0"
|
|
16
17
|
},
|
|
17
18
|
"dependencies": {
|
|
18
|
-
"@atlaspack/diagnostic": "2.14.1-canary.
|
|
19
|
-
"@atlaspack/plugin": "2.14.5-canary.
|
|
20
|
-
"@atlaspack/utils": "2.14.5-canary.
|
|
19
|
+
"@atlaspack/diagnostic": "2.14.1-canary.207+d2fd84977",
|
|
20
|
+
"@atlaspack/plugin": "2.14.5-canary.139+d2fd84977",
|
|
21
|
+
"@atlaspack/utils": "2.14.5-canary.139+d2fd84977",
|
|
21
22
|
"@parcel/source-map": "^2.1.1",
|
|
22
23
|
"browserslist": "^4.6.6",
|
|
23
24
|
"lightningcss": "^1.28.2",
|
|
@@ -30,5 +31,8 @@
|
|
|
30
31
|
"lightningcss": "lightningcss-wasm"
|
|
31
32
|
},
|
|
32
33
|
"type": "commonjs",
|
|
33
|
-
"
|
|
34
|
-
|
|
34
|
+
"scripts": {
|
|
35
|
+
"check-ts": "tsc --emitDeclarationOnly --rootDir src"
|
|
36
|
+
},
|
|
37
|
+
"gitHead": "d2fd849770fe6305e9c694bd97b1bd905abd9d94"
|
|
38
|
+
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
// @flow strict-local
|
|
2
|
-
|
|
3
1
|
import type {SourceLocation} from '@atlaspack/types';
|
|
4
2
|
|
|
5
3
|
import path from 'path';
|
|
@@ -11,7 +9,7 @@ import {
|
|
|
11
9
|
globToRegex,
|
|
12
10
|
normalizeSeparators,
|
|
13
11
|
} from '@atlaspack/utils';
|
|
14
|
-
import {
|
|
12
|
+
import {SourceLocation as LightningSourceLocation} from 'lightningcss';
|
|
15
13
|
import * as native from 'lightningcss';
|
|
16
14
|
import browserslist from 'browserslist';
|
|
17
15
|
import nullthrows from 'nullthrows';
|
|
@@ -19,24 +17,36 @@ import ThrowableDiagnostic, {errorToDiagnostic} from '@atlaspack/diagnostic';
|
|
|
19
17
|
|
|
20
18
|
const {transform, transformStyleAttribute, browserslistToTargets} = native;
|
|
21
19
|
|
|
22
|
-
export default
|
|
20
|
+
export default new Transformer({
|
|
23
21
|
async loadConfig({config, options}) {
|
|
24
22
|
let conf = await config.getConfigFrom(options.projectRoot + '/index', [], {
|
|
25
23
|
packageKey: '@atlaspack/transformer-css',
|
|
26
24
|
});
|
|
27
25
|
let contents = conf?.contents;
|
|
26
|
+
// @ts-expect-error TS2339
|
|
28
27
|
if (typeof contents?.cssModules?.include === 'string') {
|
|
28
|
+
// @ts-expect-error TS2339
|
|
29
29
|
contents.cssModules.include = [globToRegex(contents.cssModules.include)];
|
|
30
|
+
// @ts-expect-error TS2339
|
|
30
31
|
} else if (Array.isArray(contents?.cssModules?.include)) {
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
// @ts-expect-error TS2339
|
|
33
|
+
contents.cssModules.include = contents.cssModules.include.map(
|
|
34
|
+
// @ts-expect-error TS7006
|
|
35
|
+
(include) =>
|
|
36
|
+
typeof include === 'string' ? globToRegex(include) : include,
|
|
33
37
|
);
|
|
34
38
|
}
|
|
39
|
+
// @ts-expect-error TS2339
|
|
35
40
|
if (typeof contents?.cssModules?.exclude === 'string') {
|
|
41
|
+
// @ts-expect-error TS2339
|
|
36
42
|
contents.cssModules.exclude = [globToRegex(contents.cssModules.exclude)];
|
|
43
|
+
// @ts-expect-error TS2339
|
|
37
44
|
} else if (Array.isArray(contents?.cssModules?.exclude)) {
|
|
38
|
-
|
|
39
|
-
|
|
45
|
+
// @ts-expect-error TS2339
|
|
46
|
+
contents.cssModules.exclude = contents.cssModules.exclude.map(
|
|
47
|
+
// @ts-expect-error TS7006
|
|
48
|
+
(exclude) =>
|
|
49
|
+
typeof exclude === 'string' ? globToRegex(exclude) : exclude,
|
|
40
50
|
);
|
|
41
51
|
}
|
|
42
52
|
return contents;
|
|
@@ -58,7 +68,7 @@ export default (new Transformer({
|
|
|
58
68
|
let [code, originalMap] = await Promise.all([
|
|
59
69
|
asset.getBuffer(),
|
|
60
70
|
asset.getMap(),
|
|
61
|
-
//
|
|
71
|
+
// @ts-expect-error TS2339
|
|
62
72
|
process.browser && native.default(),
|
|
63
73
|
]);
|
|
64
74
|
|
|
@@ -69,7 +79,7 @@ export default (new Transformer({
|
|
|
69
79
|
res = transformStyleAttribute({
|
|
70
80
|
code,
|
|
71
81
|
analyzeDependencies: true,
|
|
72
|
-
//
|
|
82
|
+
// @ts-expect-error TS2339
|
|
73
83
|
errorRecovery: config?.errorRecovery || false,
|
|
74
84
|
targets,
|
|
75
85
|
});
|
|
@@ -79,7 +89,7 @@ export default (new Transformer({
|
|
|
79
89
|
asset.meta.type !== 'tag' &&
|
|
80
90
|
asset.meta.cssModulesCompiled == null
|
|
81
91
|
) {
|
|
82
|
-
//
|
|
92
|
+
// @ts-expect-error TS2339
|
|
83
93
|
let cssModulesConfig = config?.cssModules;
|
|
84
94
|
let isCSSModule = /\.module\./.test(asset.filePath);
|
|
85
95
|
if (asset.isSource) {
|
|
@@ -90,6 +100,7 @@ export default (new Transformer({
|
|
|
90
100
|
if (typeof cssModulesConfig === 'boolean') {
|
|
91
101
|
isCSSModule = true;
|
|
92
102
|
} else if (cssModulesConfig?.include) {
|
|
103
|
+
// @ts-expect-error TS7006
|
|
93
104
|
isCSSModule = cssModulesConfig.include.some((include) =>
|
|
94
105
|
include.test(projectRootPath),
|
|
95
106
|
);
|
|
@@ -98,7 +109,7 @@ export default (new Transformer({
|
|
|
98
109
|
}
|
|
99
110
|
|
|
100
111
|
if (
|
|
101
|
-
cssModulesConfig?.exclude?.some((exclude) =>
|
|
112
|
+
cssModulesConfig?.exclude?.some((exclude: any) =>
|
|
102
113
|
exclude.test(projectRootPath),
|
|
103
114
|
)
|
|
104
115
|
) {
|
|
@@ -128,16 +139,16 @@ export default (new Transformer({
|
|
|
128
139
|
}
|
|
129
140
|
: false,
|
|
130
141
|
sourceMap: !!asset.env.sourceMap,
|
|
131
|
-
//
|
|
142
|
+
// @ts-expect-error TS2339
|
|
132
143
|
drafts: config?.drafts,
|
|
133
|
-
//
|
|
144
|
+
// @ts-expect-error TS2339
|
|
134
145
|
pseudoClasses: config?.pseudoClasses,
|
|
135
|
-
//
|
|
146
|
+
// @ts-expect-error TS2339
|
|
136
147
|
errorRecovery: config?.errorRecovery || false,
|
|
137
148
|
targets,
|
|
138
149
|
});
|
|
139
150
|
}
|
|
140
|
-
} catch (err) {
|
|
151
|
+
} catch (err: any) {
|
|
141
152
|
err.filePath = asset.filePath;
|
|
142
153
|
let diagnostic = errorToDiagnostic(err, {
|
|
143
154
|
origin: '@atlaspack/transformer-css',
|
|
@@ -185,7 +196,9 @@ export default (new Transformer({
|
|
|
185
196
|
}
|
|
186
197
|
}
|
|
187
198
|
|
|
199
|
+
// @ts-expect-error TS2339
|
|
188
200
|
if (res.map != null) {
|
|
201
|
+
// @ts-expect-error TS2339
|
|
189
202
|
let vlqMap = JSON.parse(Buffer.from(res.map).toString());
|
|
190
203
|
let map = new SourceMap(options.projectRoot);
|
|
191
204
|
map.addVLQMap(vlqMap);
|
|
@@ -204,6 +217,7 @@ export default (new Transformer({
|
|
|
204
217
|
loc = remapSourceLocation(loc, originalMap);
|
|
205
218
|
}
|
|
206
219
|
|
|
220
|
+
// @ts-expect-error TS2339
|
|
207
221
|
if (dep.type === 'import' && !res.exports) {
|
|
208
222
|
asset.addDependency({
|
|
209
223
|
specifier: dep.url,
|
|
@@ -231,9 +245,12 @@ export default (new Transformer({
|
|
|
231
245
|
let assets = [asset];
|
|
232
246
|
let buffer = Buffer.from(res.code);
|
|
233
247
|
|
|
248
|
+
// @ts-expect-error TS2339
|
|
234
249
|
if (res.exports != null) {
|
|
250
|
+
// @ts-expect-error TS2339
|
|
235
251
|
let exports = res.exports;
|
|
236
252
|
asset.symbols.ensure();
|
|
253
|
+
// @ts-expect-error TS2345
|
|
237
254
|
asset.symbols.set('default', 'default');
|
|
238
255
|
|
|
239
256
|
let dependencies = new Map();
|
|
@@ -243,7 +260,7 @@ export default (new Transformer({
|
|
|
243
260
|
let js = '';
|
|
244
261
|
let cssImports = '';
|
|
245
262
|
|
|
246
|
-
let jsDeps = [];
|
|
263
|
+
let jsDeps: Array<never> = [];
|
|
247
264
|
|
|
248
265
|
for (let key in exports) {
|
|
249
266
|
locals.set(exports[key].name, key);
|
|
@@ -252,7 +269,7 @@ export default (new Transformer({
|
|
|
252
269
|
asset.uniqueKey ??= asset.id;
|
|
253
270
|
|
|
254
271
|
let seen = new Set();
|
|
255
|
-
let add = (key) => {
|
|
272
|
+
let add = (key: string) => {
|
|
256
273
|
if (seen.has(key)) {
|
|
257
274
|
return;
|
|
258
275
|
}
|
|
@@ -304,6 +321,7 @@ export default (new Transformer({
|
|
|
304
321
|
asset.addDependency({
|
|
305
322
|
specifier: nullthrows(asset.uniqueKey),
|
|
306
323
|
specifierType: 'esm',
|
|
324
|
+
// @ts-expect-error TS2322
|
|
307
325
|
symbols: new Map([
|
|
308
326
|
[key, {local: exports[key].name, isWeak: false, loc: null}],
|
|
309
327
|
]),
|
|
@@ -316,6 +334,7 @@ export default (new Transformer({
|
|
|
316
334
|
// It's possible that the exports can be ordered differently between builds.
|
|
317
335
|
// Sorting by key is safe as the order is irrelevant but needs to be deterministic.
|
|
318
336
|
for (let key of Object.keys(exports).sort()) {
|
|
337
|
+
// @ts-expect-error TS2345
|
|
319
338
|
asset.symbols.set(key, exports[key].name);
|
|
320
339
|
add(key);
|
|
321
340
|
}
|
|
@@ -327,12 +346,15 @@ export default (new Transformer({
|
|
|
327
346
|
let d = `dep_$${c++}`;
|
|
328
347
|
depjs += `import * as ${d} from ${JSON.stringify(dep.url)};\n`;
|
|
329
348
|
js += `for (let key in ${d}) { if (key in module.exports) module.exports[key] += ' ' + ${d}[key]; else module.exports[key] = ${d}[key]; }\n`;
|
|
349
|
+
// @ts-expect-error TS2345
|
|
330
350
|
asset.symbols.set('*', '*');
|
|
331
351
|
}
|
|
332
352
|
}
|
|
333
353
|
}
|
|
334
354
|
|
|
355
|
+
// @ts-expect-error TS2339
|
|
335
356
|
if (res.references != null) {
|
|
357
|
+
// @ts-expect-error TS2339
|
|
336
358
|
let references = res.references;
|
|
337
359
|
for (let symbol in references) {
|
|
338
360
|
let reference = references[symbol];
|
|
@@ -340,6 +362,7 @@ export default (new Transformer({
|
|
|
340
362
|
specifier: reference.specifier,
|
|
341
363
|
specifierType: 'esm',
|
|
342
364
|
packageConditions: ['style'],
|
|
365
|
+
// @ts-expect-error TS2322
|
|
343
366
|
symbols: new Map([
|
|
344
367
|
[reference.name, {local: symbol, isWeak: false, loc: null}],
|
|
345
368
|
]),
|
|
@@ -352,6 +375,7 @@ export default (new Transformer({
|
|
|
352
375
|
|
|
353
376
|
assets.push({
|
|
354
377
|
type: 'js',
|
|
378
|
+
// @ts-expect-error TS2353
|
|
355
379
|
content: depjs + js,
|
|
356
380
|
dependencies: jsDeps,
|
|
357
381
|
env,
|
|
@@ -366,11 +390,11 @@ export default (new Transformer({
|
|
|
366
390
|
asset.setBuffer(buffer);
|
|
367
391
|
return assets;
|
|
368
392
|
},
|
|
369
|
-
})
|
|
393
|
+
}) as Transformer<unknown>;
|
|
370
394
|
|
|
371
395
|
let cache = new Map();
|
|
372
396
|
|
|
373
|
-
function getTargets(browsers) {
|
|
397
|
+
function getTargets(browsers: undefined | string | Array<string>) {
|
|
374
398
|
if (browsers == null) {
|
|
375
399
|
return undefined;
|
|
376
400
|
}
|
package/tsconfig.json
ADDED