tailwindcss-injector 0.1.5 → 0.1.6-alpha.1

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/postcss.cjs CHANGED
@@ -27,9 +27,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
27
  mod
28
28
  ));
29
29
 
30
- // ../../node_modules/.pnpm/tsup@8.3.5_jiti@2.4.1_postcss@8.4.49_tsx@4.19.2_typescript@5.7.2_yaml@2.6.1/node_modules/tsup/assets/cjs_shims.js
30
+ // ../../node_modules/.pnpm/tsup@8.3.5_jiti@2.4.2_postcss@8.4.49_tsx@4.19.2_typescript@5.7.3_yaml@2.7.0/node_modules/tsup/assets/cjs_shims.js
31
31
  var init_cjs_shims = __esm({
32
- "../../node_modules/.pnpm/tsup@8.3.5_jiti@2.4.1_postcss@8.4.49_tsx@4.19.2_typescript@5.7.2_yaml@2.6.1/node_modules/tsup/assets/cjs_shims.js"() {
32
+ "../../node_modules/.pnpm/tsup@8.3.5_jiti@2.4.2_postcss@8.4.49_tsx@4.19.2_typescript@5.7.3_yaml@2.7.0/node_modules/tsup/assets/cjs_shims.js"() {
33
33
  "use strict";
34
34
  }
35
35
  });
@@ -68,7 +68,7 @@ var require_is_plain_object = __commonJS({
68
68
  function isObjectObject(o) {
69
69
  return isObject(o) === true && Object.prototype.toString.call(o) === "[object Object]";
70
70
  }
71
- module.exports = function isPlainObject2(o) {
71
+ module.exports = function isPlainObject(o) {
72
72
  var ctor, prot;
73
73
  if (isObjectObject(o) === false) return false;
74
74
  ctor = o.constructor;
@@ -90,7 +90,7 @@ var require_set_value = __commonJS({
90
90
  init_cjs_shims();
91
91
  var { deleteProperty } = Reflect;
92
92
  var isPrimitive = require_is_primitive();
93
- var isPlainObject2 = require_is_plain_object();
93
+ var isPlainObject = require_is_plain_object();
94
94
  var isObject = (value) => {
95
95
  return typeof value === "object" && value !== null || typeof value === "function";
96
96
  };
@@ -171,7 +171,7 @@ var require_set_value = __commonJS({
171
171
  deleteProperty(obj, prop);
172
172
  } else if (options && options.merge) {
173
173
  const merge = options.merge === "function" ? options.merge : Object.assign;
174
- if (merge && isPlainObject2(obj[prop]) && isPlainObject2(value)) {
174
+ if (merge && isPlainObject(obj[prop]) && isPlainObject(value)) {
175
175
  obj[prop] = merge(obj[prop], value);
176
176
  } else {
177
177
  obj[prop] = value;
@@ -228,77 +228,7 @@ var _process = require('process'); var _process2 = _interopRequireDefault(_proce
228
228
  init_cjs_shims();
229
229
  var _crypto = require('crypto'); var _crypto2 = _interopRequireDefault(_crypto);
230
230
  var _path = require('path'); var _path2 = _interopRequireDefault(_path);
231
-
232
- // ../../node_modules/.pnpm/defu@6.1.4/node_modules/defu/dist/defu.mjs
233
- init_cjs_shims();
234
- function isPlainObject(value) {
235
- if (value === null || typeof value !== "object") {
236
- return false;
237
- }
238
- const prototype = Object.getPrototypeOf(value);
239
- if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) {
240
- return false;
241
- }
242
- if (Symbol.iterator in value) {
243
- return false;
244
- }
245
- if (Symbol.toStringTag in value) {
246
- return Object.prototype.toString.call(value) === "[object Module]";
247
- }
248
- return true;
249
- }
250
- function _defu(baseObject, defaults, namespace = ".", merger) {
251
- if (!isPlainObject(defaults)) {
252
- return _defu(baseObject, {}, namespace, merger);
253
- }
254
- const object = Object.assign({}, defaults);
255
- for (const key in baseObject) {
256
- if (key === "__proto__" || key === "constructor") {
257
- continue;
258
- }
259
- const value = baseObject[key];
260
- if (value === null || value === void 0) {
261
- continue;
262
- }
263
- if (merger && merger(object, key, value, namespace)) {
264
- continue;
265
- }
266
- if (Array.isArray(value) && Array.isArray(object[key])) {
267
- object[key] = [...value, ...object[key]];
268
- } else if (isPlainObject(value) && isPlainObject(object[key])) {
269
- object[key] = _defu(
270
- value,
271
- object[key],
272
- (namespace ? `${namespace}.` : "") + key.toString(),
273
- merger
274
- );
275
- } else {
276
- object[key] = value;
277
- }
278
- }
279
- return object;
280
- }
281
- function createDefu(merger) {
282
- return (...arguments_) => (
283
- // eslint-disable-next-line unicorn/no-array-reduce
284
- arguments_.reduce((p, c) => _defu(p, c, "", merger), {})
285
- );
286
- }
287
- var defu = createDefu();
288
- var defuFn = createDefu((object, key, currentValue) => {
289
- if (object[key] !== void 0 && typeof currentValue === "function") {
290
- object[key] = currentValue(object[key]);
291
- return true;
292
- }
293
- });
294
- var defuArrayFn = createDefu((object, key, currentValue) => {
295
- if (Array.isArray(object[key]) && typeof currentValue === "function") {
296
- object[key] = currentValue(object[key]);
297
- return true;
298
- }
299
- });
300
-
301
- // src/utils.ts
231
+ var _shared = require('@weapp-tailwindcss/shared');
302
232
  function removeFileExtension(filePath) {
303
233
  if (!filePath) {
304
234
  return "";
@@ -312,38 +242,11 @@ function removeFileExtension(filePath) {
312
242
  const dir = _path2.default.dirname(filePath);
313
243
  return _path2.default.join(dir, baseName);
314
244
  }
315
- var defuOverrideArray = createDefu((obj, key, value) => {
316
- if (Array.isArray(obj[key]) && Array.isArray(value)) {
317
- obj[key] = value;
318
- return true;
319
- }
320
- });
321
245
  function md5(input) {
322
246
  const hash = _crypto2.default.createHash("md5");
323
247
  hash.update(input);
324
248
  return hash.digest("hex");
325
249
  }
326
- function isRegexp(value) {
327
- return Object.prototype.toString.call(value) === "[object RegExp]";
328
- }
329
- function regExpTest(arr = [], str) {
330
- if (Array.isArray(arr)) {
331
- for (const item of arr) {
332
- if (typeof item === "string") {
333
- if (str.includes(item)) {
334
- return true;
335
- }
336
- } else if (isRegexp(item)) {
337
- item.lastIndex = 0;
338
- if (item.test(str)) {
339
- return true;
340
- }
341
- }
342
- }
343
- return false;
344
- }
345
- throw new TypeError("paramater 'arr' should be a Array of Regexp | String !");
346
- }
347
250
 
348
251
  // src/config.ts
349
252
  function getDefaultConfig() {
@@ -360,7 +263,7 @@ function getDefaultConfig() {
360
263
  };
361
264
  }
362
265
  function getConfig(options) {
363
- return defuOverrideArray(options, getDefaultConfig());
266
+ return _shared.defuOverrideArray.call(void 0, options, getDefaultConfig());
364
267
  }
365
268
 
366
269
  // src/constants.ts
@@ -475,7 +378,7 @@ var creator = (options) => {
475
378
  async Once(root, helpers) {
476
379
  if (filter(_optionalChain([root, 'access', _ => _.source, 'optionalAccess', _2 => _2.input]))) {
477
380
  const atruleLastIndex = root.nodes.findLastIndex((x) => x.type === "atrule" && insertAfterAtRulesNames.includes(x.name));
478
- const commentLastIndex = root.nodes.findLastIndex((x) => x.type === "comment" && regExpTest(insertAfterComments, x.text));
381
+ const commentLastIndex = root.nodes.findLastIndex((x) => x.type === "comment" && _shared.regExpTest.call(void 0, insertAfterComments, x.text));
479
382
  const lastIndex = Math.max(atruleLastIndex, commentLastIndex);
480
383
  for (const params of directiveParams) {
481
384
  const node = root.nodes.find((x) => x.type === "atrule" && x.params === params);
package/dist/postcss.js CHANGED
@@ -27,9 +27,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
27
  mod
28
28
  ));
29
29
 
30
- // ../../node_modules/.pnpm/tsup@8.3.5_jiti@2.4.1_postcss@8.4.49_tsx@4.19.2_typescript@5.7.2_yaml@2.6.1/node_modules/tsup/assets/esm_shims.js
30
+ // ../../node_modules/.pnpm/tsup@8.3.5_jiti@2.4.2_postcss@8.4.49_tsx@4.19.2_typescript@5.7.3_yaml@2.7.0/node_modules/tsup/assets/esm_shims.js
31
31
  var init_esm_shims = __esm({
32
- "../../node_modules/.pnpm/tsup@8.3.5_jiti@2.4.1_postcss@8.4.49_tsx@4.19.2_typescript@5.7.2_yaml@2.6.1/node_modules/tsup/assets/esm_shims.js"() {
32
+ "../../node_modules/.pnpm/tsup@8.3.5_jiti@2.4.2_postcss@8.4.49_tsx@4.19.2_typescript@5.7.3_yaml@2.7.0/node_modules/tsup/assets/esm_shims.js"() {
33
33
  "use strict";
34
34
  }
35
35
  });
@@ -68,7 +68,7 @@ var require_is_plain_object = __commonJS({
68
68
  function isObjectObject(o) {
69
69
  return isObject(o) === true && Object.prototype.toString.call(o) === "[object Object]";
70
70
  }
71
- module.exports = function isPlainObject2(o) {
71
+ module.exports = function isPlainObject(o) {
72
72
  var ctor, prot;
73
73
  if (isObjectObject(o) === false) return false;
74
74
  ctor = o.constructor;
@@ -90,7 +90,7 @@ var require_set_value = __commonJS({
90
90
  init_esm_shims();
91
91
  var { deleteProperty } = Reflect;
92
92
  var isPrimitive = require_is_primitive();
93
- var isPlainObject2 = require_is_plain_object();
93
+ var isPlainObject = require_is_plain_object();
94
94
  var isObject = (value) => {
95
95
  return typeof value === "object" && value !== null || typeof value === "function";
96
96
  };
@@ -171,7 +171,7 @@ var require_set_value = __commonJS({
171
171
  deleteProperty(obj, prop);
172
172
  } else if (options && options.merge) {
173
173
  const merge = options.merge === "function" ? options.merge : Object.assign;
174
- if (merge && isPlainObject2(obj[prop]) && isPlainObject2(value)) {
174
+ if (merge && isPlainObject(obj[prop]) && isPlainObject(value)) {
175
175
  obj[prop] = merge(obj[prop], value);
176
176
  } else {
177
177
  obj[prop] = value;
@@ -228,77 +228,7 @@ import process from "node:process";
228
228
  init_esm_shims();
229
229
  import crypto from "node:crypto";
230
230
  import path from "node:path";
231
-
232
- // ../../node_modules/.pnpm/defu@6.1.4/node_modules/defu/dist/defu.mjs
233
- init_esm_shims();
234
- function isPlainObject(value) {
235
- if (value === null || typeof value !== "object") {
236
- return false;
237
- }
238
- const prototype = Object.getPrototypeOf(value);
239
- if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) {
240
- return false;
241
- }
242
- if (Symbol.iterator in value) {
243
- return false;
244
- }
245
- if (Symbol.toStringTag in value) {
246
- return Object.prototype.toString.call(value) === "[object Module]";
247
- }
248
- return true;
249
- }
250
- function _defu(baseObject, defaults, namespace = ".", merger) {
251
- if (!isPlainObject(defaults)) {
252
- return _defu(baseObject, {}, namespace, merger);
253
- }
254
- const object = Object.assign({}, defaults);
255
- for (const key in baseObject) {
256
- if (key === "__proto__" || key === "constructor") {
257
- continue;
258
- }
259
- const value = baseObject[key];
260
- if (value === null || value === void 0) {
261
- continue;
262
- }
263
- if (merger && merger(object, key, value, namespace)) {
264
- continue;
265
- }
266
- if (Array.isArray(value) && Array.isArray(object[key])) {
267
- object[key] = [...value, ...object[key]];
268
- } else if (isPlainObject(value) && isPlainObject(object[key])) {
269
- object[key] = _defu(
270
- value,
271
- object[key],
272
- (namespace ? `${namespace}.` : "") + key.toString(),
273
- merger
274
- );
275
- } else {
276
- object[key] = value;
277
- }
278
- }
279
- return object;
280
- }
281
- function createDefu(merger) {
282
- return (...arguments_) => (
283
- // eslint-disable-next-line unicorn/no-array-reduce
284
- arguments_.reduce((p, c) => _defu(p, c, "", merger), {})
285
- );
286
- }
287
- var defu = createDefu();
288
- var defuFn = createDefu((object, key, currentValue) => {
289
- if (object[key] !== void 0 && typeof currentValue === "function") {
290
- object[key] = currentValue(object[key]);
291
- return true;
292
- }
293
- });
294
- var defuArrayFn = createDefu((object, key, currentValue) => {
295
- if (Array.isArray(object[key]) && typeof currentValue === "function") {
296
- object[key] = currentValue(object[key]);
297
- return true;
298
- }
299
- });
300
-
301
- // src/utils.ts
231
+ import { defu, defuOverrideArray, isRegexp, regExpTest } from "@weapp-tailwindcss/shared";
302
232
  function removeFileExtension(filePath) {
303
233
  if (!filePath) {
304
234
  return "";
@@ -312,38 +242,11 @@ function removeFileExtension(filePath) {
312
242
  const dir = path.dirname(filePath);
313
243
  return path.join(dir, baseName);
314
244
  }
315
- var defuOverrideArray = createDefu((obj, key, value) => {
316
- if (Array.isArray(obj[key]) && Array.isArray(value)) {
317
- obj[key] = value;
318
- return true;
319
- }
320
- });
321
245
  function md5(input) {
322
246
  const hash = crypto.createHash("md5");
323
247
  hash.update(input);
324
248
  return hash.digest("hex");
325
249
  }
326
- function isRegexp(value) {
327
- return Object.prototype.toString.call(value) === "[object RegExp]";
328
- }
329
- function regExpTest(arr = [], str) {
330
- if (Array.isArray(arr)) {
331
- for (const item of arr) {
332
- if (typeof item === "string") {
333
- if (str.includes(item)) {
334
- return true;
335
- }
336
- } else if (isRegexp(item)) {
337
- item.lastIndex = 0;
338
- if (item.test(str)) {
339
- return true;
340
- }
341
- }
342
- }
343
- return false;
344
- }
345
- throw new TypeError("paramater 'arr' should be a Array of Regexp | String !");
346
- }
347
250
 
348
251
  // src/config.ts
349
252
  function getDefaultConfig() {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tailwindcss-injector",
3
3
  "type": "module",
4
- "version": "0.1.5",
4
+ "version": "0.1.6-alpha.1",
5
5
  "description": "tsup(esbuild) build package template",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",
@@ -32,10 +32,11 @@
32
32
  ],
33
33
  "dependencies": {
34
34
  "fs-extra": "^11.2.0",
35
- "htmlparser2": "^9.1.0",
36
- "magic-string": "^0.30.15",
35
+ "htmlparser2": "^10.0.0",
36
+ "magic-string": "^0.30.17",
37
37
  "postcss": "^8.4.49",
38
- "tailwindcss": "^3.4.16",
38
+ "tailwindcss": "^3.4.17",
39
+ "@weapp-tailwindcss/shared": "1.0.0-alpha.1",
39
40
  "tailwindcss-config": "0.0.0"
40
41
  },
41
42
  "scripts": {