weapp-tailwindcss 4.4.0 → 4.5.0-alpha.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.
Files changed (46) hide show
  1. package/dist/chunk-34T2BFTJ.mjs +59 -0
  2. package/dist/{chunk-D25XJJMP.mjs → chunk-3KKB4FSY.mjs} +341 -10
  3. package/dist/{chunk-D2AKCBDU.mjs → chunk-6L7B4COX.mjs} +75 -2
  4. package/dist/{chunk-QXCC745G.js → chunk-AMP5MSHS.js} +99 -28
  5. package/dist/{chunk-GQAB52GE.js → chunk-BMXULECQ.js} +344 -13
  6. package/dist/{chunk-FBGUUXQV.mjs → chunk-FWIGQ4RY.mjs} +1 -1
  7. package/dist/{chunk-NDHL3P32.mjs → chunk-JLKUUNWL.mjs} +156 -55
  8. package/dist/{chunk-RBRSMHFS.js → chunk-NHB7NFQC.js} +1 -1
  9. package/dist/{chunk-VN2BU7ON.js → chunk-RELKXSH6.js} +160 -59
  10. package/dist/{chunk-L3HOZDIV.mjs → chunk-RWW76EBW.mjs} +98 -27
  11. package/dist/chunk-V4SEPP3F.js +195 -0
  12. package/dist/chunk-WVKK6TBL.js +59 -0
  13. package/dist/cli.js +3 -3
  14. package/dist/cli.mjs +2 -2
  15. package/dist/core.js +3 -3
  16. package/dist/core.mjs +2 -2
  17. package/dist/css-macro/postcss.js +1 -1
  18. package/dist/css-macro/postcss.mjs +1 -1
  19. package/dist/css-macro.js +1 -1
  20. package/dist/css-macro.mjs +1 -1
  21. package/dist/defaults.js +1 -1
  22. package/dist/defaults.mjs +1 -1
  23. package/dist/escape.js +1 -1
  24. package/dist/escape.mjs +1 -1
  25. package/dist/gulp.js +4 -4
  26. package/dist/gulp.mjs +3 -3
  27. package/dist/index.d.mts +1 -1
  28. package/dist/index.d.ts +1 -1
  29. package/dist/index.js +7 -6
  30. package/dist/index.mjs +6 -5
  31. package/dist/postcss-html-transform.js +1 -1
  32. package/dist/postcss-html-transform.mjs +1 -1
  33. package/dist/presets.js +1 -1
  34. package/dist/presets.mjs +1 -1
  35. package/dist/types.d.mts +48 -2
  36. package/dist/types.d.ts +48 -2
  37. package/dist/types.js +1 -1
  38. package/dist/types.mjs +1 -1
  39. package/dist/vite.js +5 -4
  40. package/dist/vite.mjs +4 -3
  41. package/dist/webpack.js +5 -4
  42. package/dist/webpack.mjs +4 -3
  43. package/dist/webpack4.js +99 -29
  44. package/dist/webpack4.mjs +97 -27
  45. package/package.json +5 -5
  46. package/dist/chunk-H2Y5VNOJ.js +0 -122
@@ -1,3 +1,7 @@
1
+ import {
2
+ resolveOutputSpecifier,
3
+ toAbsoluteOutputPath
4
+ } from "./chunk-34T2BFTJ.mjs";
1
5
  import {
2
6
  createDebug,
3
7
  processCachedTask
@@ -8,7 +12,7 @@ import {
8
12
  import {
9
13
  generateCode,
10
14
  getCompilerContext
11
- } from "./chunk-D25XJJMP.mjs";
15
+ } from "./chunk-3KKB4FSY.mjs";
12
16
  import {
13
17
  replaceWxml
14
18
  } from "./chunk-Q67IXIAH.mjs";
@@ -17,6 +21,9 @@ import {
17
21
  } from "./chunk-ZNKIYZRQ.mjs";
18
22
 
19
23
  // src/bundlers/vite/index.ts
24
+ import { Buffer } from "buffer";
25
+ import path2 from "path";
26
+ import process2 from "process";
20
27
  import postcssHtmlTransform from "@weapp-tailwindcss/postcss/html-transform";
21
28
 
22
29
  // src/uni-app-x/index.ts
@@ -164,6 +171,70 @@ async function formatPostcssSourceMap(rawMap, file) {
164
171
 
165
172
  // src/bundlers/vite/index.ts
166
173
  var debug = createDebug();
174
+ function readOutputEntry(entry) {
175
+ if (entry.output.type === "chunk") {
176
+ return entry.output.code;
177
+ }
178
+ const source = entry.output.source;
179
+ if (typeof source === "string") {
180
+ return source;
181
+ }
182
+ if (source instanceof Uint8Array) {
183
+ return Buffer.from(source).toString();
184
+ }
185
+ const fallbackSource = source;
186
+ if (fallbackSource == null) {
187
+ return void 0;
188
+ }
189
+ if (typeof fallbackSource.toString === "function") {
190
+ return fallbackSource.toString();
191
+ }
192
+ return void 0;
193
+ }
194
+ function isJavaScriptEntry(entry) {
195
+ if (entry.output.type === "chunk") {
196
+ return true;
197
+ }
198
+ return entry.fileName.endsWith(".js");
199
+ }
200
+ function createBundleModuleGraphOptions(outputDir, entries) {
201
+ return {
202
+ resolve(specifier, importer) {
203
+ return resolveOutputSpecifier(specifier, importer, outputDir, (candidate) => entries.has(candidate));
204
+ },
205
+ load(id) {
206
+ const entry = entries.get(id);
207
+ if (!entry) {
208
+ return void 0;
209
+ }
210
+ return readOutputEntry(entry);
211
+ },
212
+ filter(id) {
213
+ return entries.has(id);
214
+ }
215
+ };
216
+ }
217
+ function applyLinkedResults(linked, entries, onLinkedUpdate) {
218
+ if (!linked) {
219
+ return;
220
+ }
221
+ for (const [id, { code }] of Object.entries(linked)) {
222
+ const entry = entries.get(id);
223
+ if (!entry) {
224
+ continue;
225
+ }
226
+ const previous = readOutputEntry(entry);
227
+ if (previous == null || previous === code) {
228
+ continue;
229
+ }
230
+ if (entry.output.type === "chunk") {
231
+ entry.output.code = code;
232
+ } else {
233
+ entry.output.source = code;
234
+ }
235
+ onLinkedUpdate(entry.fileName, previous, code);
236
+ }
237
+ }
167
238
  function UnifiedViteWeappTailwindcssPlugin(options = {}) {
168
239
  const opts = getCompilerContext(options);
169
240
  const {
@@ -187,12 +258,14 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
187
258
  }
188
259
  twPatcher.patch();
189
260
  let runtimeSet;
261
+ let resolvedConfig;
190
262
  onLoad();
191
263
  const plugins = [
192
264
  {
193
265
  name: `${vitePluginName}:post`,
194
266
  enforce: "post",
195
267
  configResolved(config) {
268
+ resolvedConfig = config;
196
269
  if (typeof config.css.postcss === "object" && Array.isArray(config.css.postcss.plugins)) {
197
270
  const idx = config.css.postcss.plugins.findIndex((x) => (
198
271
  // @ts-ignore
@@ -208,10 +281,34 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
208
281
  debug("start");
209
282
  onStart();
210
283
  const entries = Object.entries(bundle);
284
+ const rootDir = resolvedConfig?.root ? path2.resolve(resolvedConfig.root) : process2.cwd();
285
+ const outDir = resolvedConfig?.build?.outDir ? path2.resolve(rootDir, resolvedConfig.build.outDir) : rootDir;
286
+ const jsEntries = /* @__PURE__ */ new Map();
287
+ for (const [fileName, output] of entries) {
288
+ const entry = { fileName, output };
289
+ if (isJavaScriptEntry(entry)) {
290
+ const absolute = toAbsoluteOutputPath(fileName, outDir);
291
+ jsEntries.set(absolute, entry);
292
+ }
293
+ }
294
+ const moduleGraphOptions = createBundleModuleGraphOptions(outDir, jsEntries);
211
295
  const groupedEntries = getGroupedEntries(entries, opts);
212
296
  runtimeSet = await twPatcher.getClassSet();
213
297
  setMangleRuntimeSet(runtimeSet);
214
298
  debug("get runtimeSet, class count: %d", runtimeSet.size);
299
+ const handleLinkedUpdate = (fileName, previous, next) => {
300
+ onUpdate(fileName, previous, next);
301
+ debug("js linked handle: %s", fileName);
302
+ };
303
+ const createHandlerOptions = (absoluteFilename, extra) => ({
304
+ ...extra,
305
+ filename: absoluteFilename,
306
+ moduleGraph: moduleGraphOptions,
307
+ babelParserOptions: {
308
+ ...extra?.babelParserOptions ?? {},
309
+ sourceFilename: absoluteFilename
310
+ }
311
+ });
215
312
  const tasks = [];
216
313
  if (Array.isArray(groupedEntries.html)) {
217
314
  for (const [file, originalSource] of groupedEntries.html) {
@@ -243,65 +340,69 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
243
340
  }
244
341
  if (Array.isArray(groupedEntries.js)) {
245
342
  for (const [file, originalSource] of groupedEntries.js) {
246
- if (originalSource.type === "chunk") {
247
- const rawSource = originalSource.code;
248
- tasks.push(
249
- processCachedTask({
250
- cache,
251
- cacheKey: file,
252
- rawSource,
253
- applyResult(source) {
254
- originalSource.code = source;
255
- },
256
- onCacheHit() {
257
- debug("js cache hit: %s", file);
258
- },
259
- async transform() {
260
- const { code } = await jsHandler(rawSource, runtimeSet);
261
- onUpdate(file, rawSource, code);
262
- debug("js handle: %s", file);
263
- return {
264
- result: code
265
- };
266
- }
267
- })
268
- );
343
+ if (originalSource.type !== "chunk") {
344
+ continue;
269
345
  }
346
+ const absoluteFile = toAbsoluteOutputPath(file, outDir);
347
+ const initialRawSource = originalSource.code;
348
+ await processCachedTask({
349
+ cache,
350
+ cacheKey: file,
351
+ rawSource: initialRawSource,
352
+ applyResult(source) {
353
+ originalSource.code = source;
354
+ },
355
+ onCacheHit() {
356
+ debug("js cache hit: %s", file);
357
+ },
358
+ async transform() {
359
+ const rawSource = originalSource.code;
360
+ const { code, linked } = await jsHandler(rawSource, runtimeSet, createHandlerOptions(absoluteFile));
361
+ onUpdate(file, rawSource, code);
362
+ debug("js handle: %s", file);
363
+ applyLinkedResults(linked, jsEntries, handleLinkedUpdate);
364
+ return {
365
+ result: code
366
+ };
367
+ }
368
+ });
270
369
  }
271
370
  if (uniAppX) {
272
371
  for (const [file, originalSource] of groupedEntries.js) {
273
- if (originalSource.type === "asset") {
274
- const rawSource = originalSource.source.toString();
275
- tasks.push(
276
- processCachedTask({
277
- cache,
278
- cacheKey: file,
279
- rawSource,
280
- applyResult(source) {
281
- originalSource.source = source;
282
- },
283
- onCacheHit() {
284
- debug("js cache hit: %s", file);
285
- },
286
- async transform() {
287
- const { code } = await jsHandler(rawSource, runtimeSet, {
288
- uniAppX,
289
- babelParserOptions: {
290
- plugins: [
291
- "typescript"
292
- ],
293
- sourceType: "unambiguous"
294
- }
295
- });
296
- onUpdate(file, rawSource, code);
297
- debug("js handle: %s", file);
298
- return {
299
- result: code
300
- };
301
- }
302
- })
303
- );
372
+ if (originalSource.type !== "asset") {
373
+ continue;
304
374
  }
375
+ const absoluteFile = toAbsoluteOutputPath(file, outDir);
376
+ const rawSource = originalSource.source.toString();
377
+ await processCachedTask({
378
+ cache,
379
+ cacheKey: file,
380
+ rawSource,
381
+ applyResult(source) {
382
+ originalSource.source = source;
383
+ },
384
+ onCacheHit() {
385
+ debug("js cache hit: %s", file);
386
+ },
387
+ async transform() {
388
+ const currentSource = originalSource.source.toString();
389
+ const { code, linked } = await jsHandler(currentSource, runtimeSet, createHandlerOptions(absoluteFile, {
390
+ uniAppX,
391
+ babelParserOptions: {
392
+ plugins: [
393
+ "typescript"
394
+ ],
395
+ sourceType: "unambiguous"
396
+ }
397
+ }));
398
+ onUpdate(file, currentSource, code);
399
+ debug("js handle: %s", file);
400
+ applyLinkedResults(linked, jsEntries, handleLinkedUpdate);
401
+ return {
402
+ result: code
403
+ };
404
+ }
405
+ });
305
406
  }
306
407
  }
307
408
  }
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});// ../../node_modules/.pnpm/tsup@8.5.0_@swc+core@1.13.5_jiti@2.6.1_postcss@8.5.6_tsx@4.20.6_typescript@5.9.3_yaml@2.8.1/node_modules/tsup/assets/cjs_shims.js
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});// ../../node_modules/.pnpm/tsup@8.5.0_@microsoft+api-extractor@7.53.1_@types+node@24.8.1__@swc+core@1.13.5_jiti@2._cec5ee635e8b2932d274eae561437dbd/node_modules/tsup/assets/cjs_shims.js
2
2
  var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
3
3
  var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
4
4
 
@@ -1,6 +1,10 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
3
 
4
+ var _chunkWVKK6TBLjs = require('./chunk-WVKK6TBL.js');
5
+
6
+
7
+
4
8
  var _chunk2NRTWL47js = require('./chunk-2NRTWL47.js');
5
9
 
6
10
 
@@ -8,7 +12,7 @@ var _chunkOGROHM4Ljs = require('./chunk-OGROHM4L.js');
8
12
 
9
13
 
10
14
 
11
- var _chunkGQAB52GEjs = require('./chunk-GQAB52GE.js');
15
+ var _chunkBMXULECQjs = require('./chunk-BMXULECQ.js');
12
16
 
13
17
 
14
18
  var _chunkPLMJW644js = require('./chunk-PLMJW644.js');
@@ -17,6 +21,9 @@ var _chunkPLMJW644js = require('./chunk-PLMJW644.js');
17
21
  var _chunkUW3WHSZ5js = require('./chunk-UW3WHSZ5.js');
18
22
 
19
23
  // src/bundlers/vite/index.ts
24
+ var _buffer = require('buffer');
25
+ var _path = require('path'); var _path2 = _interopRequireDefault(_path);
26
+ var _process = require('process'); var _process2 = _interopRequireDefault(_process);
20
27
  var _htmltransform = require('@weapp-tailwindcss/postcss/html-transform'); var _htmltransform2 = _interopRequireDefault(_htmltransform);
21
28
 
22
29
  // src/uni-app-x/index.ts
@@ -43,7 +50,7 @@ function createClassAttributeUpdater(ms) {
43
50
  function createClassDirectiveUpdater(ms, jsHandler, runtimeSet) {
44
51
  return (prop) => {
45
52
  if (_optionalChain([prop, 'access', _ => _.arg, 'optionalAccess', _2 => _2.type]) === _compilerdom.NodeTypes.SIMPLE_EXPRESSION && prop.arg.content === "class" && _optionalChain([prop, 'access', _3 => _3.exp, 'optionalAccess', _4 => _4.type]) === _compilerdom.NodeTypes.SIMPLE_EXPRESSION) {
46
- const generated = _chunkGQAB52GEjs.generateCode.call(void 0, prop.exp.content, {
53
+ const generated = _chunkBMXULECQjs.generateCode.call(void 0, prop.exp.content, {
47
54
  jsHandler,
48
55
  runtimeSet
49
56
  });
@@ -125,8 +132,8 @@ function parseVueRequest(id) {
125
132
  }
126
133
 
127
134
  // src/bundlers/vite/utils.ts
128
- var _path = require('path'); var _path2 = _interopRequireDefault(_path);
129
- var _process = require('process'); var _process2 = _interopRequireDefault(_process);
135
+
136
+
130
137
  function slash(p) {
131
138
  return p.replace(/\\/g, "/");
132
139
  }
@@ -164,8 +171,72 @@ async function formatPostcssSourceMap(rawMap, file) {
164
171
 
165
172
  // src/bundlers/vite/index.ts
166
173
  var debug = _chunk2NRTWL47js.createDebug.call(void 0, );
174
+ function readOutputEntry(entry) {
175
+ if (entry.output.type === "chunk") {
176
+ return entry.output.code;
177
+ }
178
+ const source = entry.output.source;
179
+ if (typeof source === "string") {
180
+ return source;
181
+ }
182
+ if (source instanceof Uint8Array) {
183
+ return _buffer.Buffer.from(source).toString();
184
+ }
185
+ const fallbackSource = source;
186
+ if (fallbackSource == null) {
187
+ return void 0;
188
+ }
189
+ if (typeof fallbackSource.toString === "function") {
190
+ return fallbackSource.toString();
191
+ }
192
+ return void 0;
193
+ }
194
+ function isJavaScriptEntry(entry) {
195
+ if (entry.output.type === "chunk") {
196
+ return true;
197
+ }
198
+ return entry.fileName.endsWith(".js");
199
+ }
200
+ function createBundleModuleGraphOptions(outputDir, entries) {
201
+ return {
202
+ resolve(specifier, importer) {
203
+ return _chunkWVKK6TBLjs.resolveOutputSpecifier.call(void 0, specifier, importer, outputDir, (candidate) => entries.has(candidate));
204
+ },
205
+ load(id) {
206
+ const entry = entries.get(id);
207
+ if (!entry) {
208
+ return void 0;
209
+ }
210
+ return readOutputEntry(entry);
211
+ },
212
+ filter(id) {
213
+ return entries.has(id);
214
+ }
215
+ };
216
+ }
217
+ function applyLinkedResults(linked, entries, onLinkedUpdate) {
218
+ if (!linked) {
219
+ return;
220
+ }
221
+ for (const [id, { code }] of Object.entries(linked)) {
222
+ const entry = entries.get(id);
223
+ if (!entry) {
224
+ continue;
225
+ }
226
+ const previous = readOutputEntry(entry);
227
+ if (previous == null || previous === code) {
228
+ continue;
229
+ }
230
+ if (entry.output.type === "chunk") {
231
+ entry.output.code = code;
232
+ } else {
233
+ entry.output.source = code;
234
+ }
235
+ onLinkedUpdate(entry.fileName, previous, code);
236
+ }
237
+ }
167
238
  function UnifiedViteWeappTailwindcssPlugin(options = {}) {
168
- const opts = _chunkGQAB52GEjs.getCompilerContext.call(void 0, options);
239
+ const opts = _chunkBMXULECQjs.getCompilerContext.call(void 0, options);
169
240
  const {
170
241
  disabled,
171
242
  onEnd,
@@ -187,12 +258,14 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
187
258
  }
188
259
  twPatcher.patch();
189
260
  let runtimeSet;
261
+ let resolvedConfig;
190
262
  onLoad();
191
263
  const plugins = [
192
264
  {
193
265
  name: `${_chunkOGROHM4Ljs.vitePluginName}:post`,
194
266
  enforce: "post",
195
267
  configResolved(config) {
268
+ resolvedConfig = config;
196
269
  if (typeof config.css.postcss === "object" && Array.isArray(config.css.postcss.plugins)) {
197
270
  const idx = config.css.postcss.plugins.findIndex((x) => (
198
271
  // @ts-ignore
@@ -208,10 +281,34 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
208
281
  debug("start");
209
282
  onStart();
210
283
  const entries = Object.entries(bundle);
284
+ const rootDir = _optionalChain([resolvedConfig, 'optionalAccess', _7 => _7.root]) ? _path2.default.resolve(resolvedConfig.root) : _process2.default.cwd();
285
+ const outDir = _optionalChain([resolvedConfig, 'optionalAccess', _8 => _8.build, 'optionalAccess', _9 => _9.outDir]) ? _path2.default.resolve(rootDir, resolvedConfig.build.outDir) : rootDir;
286
+ const jsEntries = /* @__PURE__ */ new Map();
287
+ for (const [fileName, output] of entries) {
288
+ const entry = { fileName, output };
289
+ if (isJavaScriptEntry(entry)) {
290
+ const absolute = _chunkWVKK6TBLjs.toAbsoluteOutputPath.call(void 0, fileName, outDir);
291
+ jsEntries.set(absolute, entry);
292
+ }
293
+ }
294
+ const moduleGraphOptions = createBundleModuleGraphOptions(outDir, jsEntries);
211
295
  const groupedEntries = _chunkUW3WHSZ5js.getGroupedEntries.call(void 0, entries, opts);
212
296
  runtimeSet = await twPatcher.getClassSet();
213
297
  setMangleRuntimeSet(runtimeSet);
214
298
  debug("get runtimeSet, class count: %d", runtimeSet.size);
299
+ const handleLinkedUpdate = (fileName, previous, next) => {
300
+ onUpdate(fileName, previous, next);
301
+ debug("js linked handle: %s", fileName);
302
+ };
303
+ const createHandlerOptions = (absoluteFilename, extra) => ({
304
+ ...extra,
305
+ filename: absoluteFilename,
306
+ moduleGraph: moduleGraphOptions,
307
+ babelParserOptions: {
308
+ ..._nullishCoalesce(_optionalChain([extra, 'optionalAccess', _10 => _10.babelParserOptions]), () => ( {})),
309
+ sourceFilename: absoluteFilename
310
+ }
311
+ });
215
312
  const tasks = [];
216
313
  if (Array.isArray(groupedEntries.html)) {
217
314
  for (const [file, originalSource] of groupedEntries.html) {
@@ -243,65 +340,69 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
243
340
  }
244
341
  if (Array.isArray(groupedEntries.js)) {
245
342
  for (const [file, originalSource] of groupedEntries.js) {
246
- if (originalSource.type === "chunk") {
247
- const rawSource = originalSource.code;
248
- tasks.push(
249
- _chunk2NRTWL47js.processCachedTask.call(void 0, {
250
- cache,
251
- cacheKey: file,
252
- rawSource,
253
- applyResult(source) {
254
- originalSource.code = source;
255
- },
256
- onCacheHit() {
257
- debug("js cache hit: %s", file);
258
- },
259
- async transform() {
260
- const { code } = await jsHandler(rawSource, runtimeSet);
261
- onUpdate(file, rawSource, code);
262
- debug("js handle: %s", file);
263
- return {
264
- result: code
265
- };
266
- }
267
- })
268
- );
343
+ if (originalSource.type !== "chunk") {
344
+ continue;
269
345
  }
346
+ const absoluteFile = _chunkWVKK6TBLjs.toAbsoluteOutputPath.call(void 0, file, outDir);
347
+ const initialRawSource = originalSource.code;
348
+ await _chunk2NRTWL47js.processCachedTask.call(void 0, {
349
+ cache,
350
+ cacheKey: file,
351
+ rawSource: initialRawSource,
352
+ applyResult(source) {
353
+ originalSource.code = source;
354
+ },
355
+ onCacheHit() {
356
+ debug("js cache hit: %s", file);
357
+ },
358
+ async transform() {
359
+ const rawSource = originalSource.code;
360
+ const { code, linked } = await jsHandler(rawSource, runtimeSet, createHandlerOptions(absoluteFile));
361
+ onUpdate(file, rawSource, code);
362
+ debug("js handle: %s", file);
363
+ applyLinkedResults(linked, jsEntries, handleLinkedUpdate);
364
+ return {
365
+ result: code
366
+ };
367
+ }
368
+ });
270
369
  }
271
370
  if (uniAppX) {
272
371
  for (const [file, originalSource] of groupedEntries.js) {
273
- if (originalSource.type === "asset") {
274
- const rawSource = originalSource.source.toString();
275
- tasks.push(
276
- _chunk2NRTWL47js.processCachedTask.call(void 0, {
277
- cache,
278
- cacheKey: file,
279
- rawSource,
280
- applyResult(source) {
281
- originalSource.source = source;
282
- },
283
- onCacheHit() {
284
- debug("js cache hit: %s", file);
285
- },
286
- async transform() {
287
- const { code } = await jsHandler(rawSource, runtimeSet, {
288
- uniAppX,
289
- babelParserOptions: {
290
- plugins: [
291
- "typescript"
292
- ],
293
- sourceType: "unambiguous"
294
- }
295
- });
296
- onUpdate(file, rawSource, code);
297
- debug("js handle: %s", file);
298
- return {
299
- result: code
300
- };
301
- }
302
- })
303
- );
372
+ if (originalSource.type !== "asset") {
373
+ continue;
304
374
  }
375
+ const absoluteFile = _chunkWVKK6TBLjs.toAbsoluteOutputPath.call(void 0, file, outDir);
376
+ const rawSource = originalSource.source.toString();
377
+ await _chunk2NRTWL47js.processCachedTask.call(void 0, {
378
+ cache,
379
+ cacheKey: file,
380
+ rawSource,
381
+ applyResult(source) {
382
+ originalSource.source = source;
383
+ },
384
+ onCacheHit() {
385
+ debug("js cache hit: %s", file);
386
+ },
387
+ async transform() {
388
+ const currentSource = originalSource.source.toString();
389
+ const { code, linked } = await jsHandler(currentSource, runtimeSet, createHandlerOptions(absoluteFile, {
390
+ uniAppX,
391
+ babelParserOptions: {
392
+ plugins: [
393
+ "typescript"
394
+ ],
395
+ sourceType: "unambiguous"
396
+ }
397
+ }));
398
+ onUpdate(file, currentSource, code);
399
+ debug("js handle: %s", file);
400
+ applyLinkedResults(linked, jsEntries, handleLinkedUpdate);
401
+ return {
402
+ result: code
403
+ };
404
+ }
405
+ });
305
406
  }
306
407
  }
307
408
  }