@unocss/extractor-pug 0.13.1 → 0.14.3

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.
@@ -1,11 +1,12 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/index.ts
2
- var regexVueTemplate = /<template.*?lang=['"]pug['"][^>]*?>\n([\s\S]*?\n)<\/template>/gm;
1
+ 'use strict';
2
+
3
+ const regexVueTemplate = /<template.*?lang=['"]pug['"][^>]*?>\n([\s\S]*?\n)<\/template>/gm;
3
4
  function extractorPug() {
4
5
  async function compile(code, id) {
5
- const Pug = await Promise.resolve().then(() => require("pug"));
6
+ const Pug = await import('pug');
6
7
  try {
7
8
  return Pug.compile(code, { filename: id })();
8
- } catch (e) {
9
+ } catch {
9
10
  }
10
11
  }
11
12
  return {
@@ -17,7 +18,7 @@ function extractorPug() {
17
18
  if (ctx.id.match(/\.pug$/) || ctx.id.match(/\?vue&type=template/)) {
18
19
  try {
19
20
  ctx.code = await compile(ctx.code, ctx.id) || ctx.code;
20
- } catch (e) {
21
+ } catch {
21
22
  }
22
23
  } else if (ctx.id.match(/\.vue$/)) {
23
24
  const matches = Array.from(ctx.code.matchAll(regexVueTemplate));
@@ -37,5 +38,4 @@ ${tail}`;
37
38
  };
38
39
  }
39
40
 
40
-
41
- exports.default = extractorPug;
41
+ module.exports = extractorPug;
package/dist/index.mjs CHANGED
@@ -1,11 +1,10 @@
1
- // src/index.ts
2
- var regexVueTemplate = /<template.*?lang=['"]pug['"][^>]*?>\n([\s\S]*?\n)<\/template>/gm;
1
+ const regexVueTemplate = /<template.*?lang=['"]pug['"][^>]*?>\n([\s\S]*?\n)<\/template>/gm;
3
2
  function extractorPug() {
4
3
  async function compile(code, id) {
5
- const Pug = await import("pug");
4
+ const Pug = await import('pug');
6
5
  try {
7
6
  return Pug.compile(code, { filename: id })();
8
- } catch (e) {
7
+ } catch {
9
8
  }
10
9
  }
11
10
  return {
@@ -17,7 +16,7 @@ function extractorPug() {
17
16
  if (ctx.id.match(/\.pug$/) || ctx.id.match(/\?vue&type=template/)) {
18
17
  try {
19
18
  ctx.code = await compile(ctx.code, ctx.id) || ctx.code;
20
- } catch (e) {
19
+ } catch {
21
20
  }
22
21
  } else if (ctx.id.match(/\.vue$/)) {
23
22
  const matches = Array.from(ctx.code.matchAll(regexVueTemplate));
@@ -36,6 +35,5 @@ ${tail}`;
36
35
  }
37
36
  };
38
37
  }
39
- export {
40
- extractorPug as default
41
- };
38
+
39
+ export { extractorPug as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unocss/extractor-pug",
3
- "version": "0.13.1",
3
+ "version": "0.14.3",
4
4
  "description": "UnoCSS extractor for Pug",
5
5
  "keywords": [
6
6
  "unocss",
@@ -22,11 +22,11 @@
22
22
  "sideEffects": false,
23
23
  "exports": {
24
24
  ".": {
25
- "require": "./dist/index.js",
25
+ "require": "./dist/index.cjs",
26
26
  "import": "./dist/index.mjs"
27
27
  }
28
28
  },
29
- "main": "./dist/index.js",
29
+ "main": "./dist/index.cjs",
30
30
  "module": "./dist/index.mjs",
31
31
  "types": "./dist/index.d.ts",
32
32
  "files": [
@@ -42,11 +42,11 @@
42
42
  },
43
43
  "devDependencies": {
44
44
  "@types/pug": "^2.0.5",
45
- "@unocss/core": "0.13.1",
45
+ "@unocss/core": "0.14.3",
46
46
  "pug": "^3.0.2"
47
47
  },
48
48
  "scripts": {
49
- "build": "tsup",
50
- "dev": "tsup --watch src"
49
+ "build": "unbuild",
50
+ "stub": "unbuild --stub"
51
51
  }
52
52
  }