weapp-tailwindcss 2.9.1 → 2.9.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/dist/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var options = require('./options-b96f6338.js');
3
+ var options = require('./options-9dd8de2e.js');
4
4
  require('micromatch');
5
5
  require('magic-string');
6
6
  require('./replace.js');
package/dist/cli.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { g as getOptions, c as createPatch } from './options-f70d1c6f.mjs';
1
+ import { g as getOptions, c as createPatch } from './options-e1a9fdd3.mjs';
2
2
  import 'micromatch';
3
3
  import 'magic-string';
4
4
  import './replace.mjs';
package/dist/gulp.js CHANGED
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var stream = require('node:stream');
6
- var options = require('./options-b96f6338.js');
6
+ var options = require('./options-9dd8de2e.js');
7
7
  require('micromatch');
8
8
  require('magic-string');
9
9
  require('./replace.js');
package/dist/gulp.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import stream from 'node:stream';
2
- import { g as getOptions, a as createTailwindcssPatcher } from './options-f70d1c6f.mjs';
2
+ import { g as getOptions, a as createTailwindcssPatcher } from './options-e1a9fdd3.mjs';
3
3
  import 'micromatch';
4
4
  import 'magic-string';
5
5
  import './replace.mjs';
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@ var vite = require('./vite.js');
7
7
  var gulp = require('./gulp.js');
8
8
  require('node:path');
9
9
  require('node:fs');
10
- require('./options-b96f6338.js');
10
+ require('./options-9dd8de2e.js');
11
11
  require('micromatch');
12
12
  require('magic-string');
13
13
  require('./replace.js');
package/dist/index.mjs CHANGED
@@ -3,7 +3,7 @@ export { UnifiedViteWeappTailwindcssPlugin } from './vite.mjs';
3
3
  export { createPlugins } from './gulp.mjs';
4
4
  import 'node:path';
5
5
  import 'node:fs';
6
- import './options-f70d1c6f.mjs';
6
+ import './options-e1a9fdd3.mjs';
7
7
  import 'micromatch';
8
8
  import 'magic-string';
9
9
  import './replace.mjs';
@@ -326,6 +326,10 @@ function createJsHandler(options) {
326
326
  };
327
327
  }
328
328
 
329
+ function getQuotes(quote) {
330
+ const quotes = quote === "'" ? 'double' : 'single';
331
+ return quotes;
332
+ }
329
333
  function generateCode(match, options = {}) {
330
334
  const ast = parser.parseExpression(match);
331
335
  traverse__default["default"](ast, {
@@ -345,7 +349,7 @@ function generateCode(match, options = {}) {
345
349
  compact: true,
346
350
  minified: true,
347
351
  jsescOption: {
348
- quotes: 'single',
352
+ quotes: getQuotes(options.quote),
349
353
  minimal: true
350
354
  }
351
355
  });
@@ -443,12 +447,8 @@ function customTemplateHandler(rawSource, options) {
443
447
  },
444
448
  onattribute(name, value, quote) {
445
449
  if (value) {
446
- if (quote === "'") {
447
- s.update(parser.startIndex + name.length + 1, parser.startIndex + name.length + 2, '"');
448
- s.update(parser.startIndex + name.length + value.length + 2, parser.startIndex + name.length + value.length + 3, '"');
449
- }
450
450
  function update() {
451
- s.update(parser.startIndex + name.length + 2, parser.endIndex, templateReplacer(value, options));
451
+ s.update(parser.startIndex + name.length + 2, parser.endIndex, templateReplacer(value, Object.assign(Object.assign({}, options), { quote })));
452
452
  }
453
453
  if (!disabledDefaultTemplateHandler && (name === 'class' || name === 'hover-class' || name === 'virtualhostclass')) {
454
454
  update();
@@ -294,6 +294,10 @@ function createJsHandler(options) {
294
294
  };
295
295
  }
296
296
 
297
+ function getQuotes(quote) {
298
+ const quotes = quote === "'" ? 'double' : 'single';
299
+ return quotes;
300
+ }
297
301
  function generateCode(match, options = {}) {
298
302
  const ast = parseExpression(match);
299
303
  traverse(ast, {
@@ -313,7 +317,7 @@ function generateCode(match, options = {}) {
313
317
  compact: true,
314
318
  minified: true,
315
319
  jsescOption: {
316
- quotes: 'single',
320
+ quotes: getQuotes(options.quote),
317
321
  minimal: true
318
322
  }
319
323
  });
@@ -411,12 +415,8 @@ function customTemplateHandler(rawSource, options) {
411
415
  },
412
416
  onattribute(name, value, quote) {
413
417
  if (value) {
414
- if (quote === "'") {
415
- s.update(parser.startIndex + name.length + 1, parser.startIndex + name.length + 2, '"');
416
- s.update(parser.startIndex + name.length + value.length + 2, parser.startIndex + name.length + value.length + 3, '"');
417
- }
418
418
  function update() {
419
- s.update(parser.startIndex + name.length + 2, parser.endIndex, templateReplacer(value, options));
419
+ s.update(parser.startIndex + name.length + 2, parser.endIndex, templateReplacer(value, Object.assign(Object.assign({}, options), { quote })));
420
420
  }
421
421
  if (!disabledDefaultTemplateHandler && (name === 'class' || name === 'hover-class' || name === 'virtualhostclass')) {
422
422
  update();
package/dist/types.d.ts CHANGED
@@ -129,6 +129,7 @@ export interface ITemplateHandlerOptions extends ICommonReplaceOptions {
129
129
  jsHandler?: JsHandler;
130
130
  runtimeSet?: Set<string>;
131
131
  disabledDefaultTemplateHandler?: boolean;
132
+ quote?: string | null;
132
133
  }
133
134
  export type GlobOrFunctionMatchers = 'htmlMatcher' | 'cssMatcher' | 'jsMatcher' | 'mainCssChunkMatcher' | 'wxsMatcher';
134
135
  export type InternalUserDefinedOptions = Required<Omit<UserDefinedOptions, GlobOrFunctionMatchers | 'supportCustomLengthUnitsPatch' | 'customReplaceDictionary'> & {
package/dist/vite.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var options = require('./options-b96f6338.js');
5
+ var options = require('./options-9dd8de2e.js');
6
6
  var postcss = require('./postcss-8d7f67b4.js');
7
7
  var defaults = require('./defaults-b7341550.js');
8
8
  var index = require('./index-aede98ce.js');
package/dist/vite.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { g as getOptions, a as createTailwindcssPatcher } from './options-f70d1c6f.mjs';
1
+ import { g as getOptions, a as createTailwindcssPatcher } from './options-e1a9fdd3.mjs';
2
2
  import { v as vitePluginName } from './postcss-55ed4d42.mjs';
3
3
  import { g as getGroupedEntries } from './defaults-d2c66d23.mjs';
4
4
  import { c as createDebug } from './index-84c7aa87.mjs';
package/dist/webpack.js CHANGED
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var path = require('node:path');
6
6
  var fs = require('node:fs');
7
- var options = require('./options-b96f6338.js');
7
+ var options = require('./options-9dd8de2e.js');
8
8
  var postcss = require('./postcss-8d7f67b4.js');
9
9
  var defaults = require('./defaults-b7341550.js');
10
10
  var index = require('./index-aede98ce.js');
package/dist/webpack.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import path from 'node:path';
2
2
  import fs from 'node:fs';
3
- import { g as getOptions, a as createTailwindcssPatcher } from './options-f70d1c6f.mjs';
3
+ import { g as getOptions, a as createTailwindcssPatcher } from './options-e1a9fdd3.mjs';
4
4
  import { a as pluginName } from './postcss-55ed4d42.mjs';
5
5
  import { g as getGroupedEntries, r as removeExt } from './defaults-d2c66d23.mjs';
6
6
  import { c as createDebug } from './index-84c7aa87.mjs';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "weapp-tailwindcss",
3
- "version": "2.9.1",
3
+ "version": "2.9.2",
4
4
  "description": "把tailwindcss jit引擎,带给小程序开发者们! bring tailwindcss jit engine to miniprogram developers!",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -190,7 +190,7 @@
190
190
  "@babel/parser": "^7.22.16",
191
191
  "@babel/traverse": "^7.22.20",
192
192
  "@babel/types": "^7.22.19",
193
- "@csstools/postcss-is-pseudo-class": "^4.0.1",
193
+ "@csstools/postcss-is-pseudo-class": "^4.0.2",
194
194
  "@tailwindcss-mangle/shared": "^2.2.1",
195
195
  "@weapp-core/escape": "^2.0.0",
196
196
  "@weapp-core/regex": "^1.0.1",
@@ -201,7 +201,7 @@
201
201
  "magic-string": "^0.30.3",
202
202
  "md5": "^2.3.0",
203
203
  "micromatch": "^4.0.5",
204
- "postcss": "8.4.29",
204
+ "postcss": "8.4.30",
205
205
  "postcss-selector-parser": "^6.0.13",
206
206
  "semver": "^7.5.4",
207
207
  "tailwindcss-patch": "^2.2.1"