@parcel/transformer-pug 2.8.3 → 2.9.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.
@@ -4,63 +4,41 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  function _path() {
9
8
  const data = _interopRequireDefault(require("path"));
10
-
11
9
  _path = function () {
12
10
  return data;
13
11
  };
14
-
15
12
  return data;
16
13
  }
17
-
18
14
  function _plugin() {
19
15
  const data = require("@parcel/plugin");
20
-
21
16
  _plugin = function () {
22
17
  return data;
23
18
  };
24
-
25
19
  return data;
26
20
  }
27
-
28
21
  function _pug() {
29
22
  const data = _interopRequireDefault(require("pug"));
30
-
31
23
  _pug = function () {
32
24
  return data;
33
25
  };
34
-
35
26
  return data;
36
27
  }
37
-
38
28
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
39
-
40
29
  var _default = new (_plugin().Transformer)({
41
30
  async loadConfig({
42
31
  config
43
32
  }) {
44
- let configFile = await config.getConfig(['.pugrc', '.pugrc.js', '.pugrc.cjs', 'pug.config.js', 'pug.config.cjs']);
45
-
46
- if (configFile) {
47
- let isJavascript = _path().default.extname(configFile.filePath).endsWith('js');
48
-
49
- if (isJavascript) {
50
- config.invalidateOnStartup();
51
- }
52
-
53
- return configFile.contents;
54
- }
33
+ let configFile = await config.getConfig(['.pugrc', '.pugrc.js', '.pugrc.cjs', '.pugrc.mjs', 'pug.config.js', 'pug.config.cjs', 'pug.config.mjs']);
34
+ return configFile === null || configFile === void 0 ? void 0 : configFile.contents;
55
35
  },
56
-
57
36
  async transform({
58
37
  asset,
59
38
  config
60
39
  }) {
61
40
  const pugConfig = config !== null && config !== void 0 ? config : {};
62
41
  const content = await asset.getCode();
63
-
64
42
  const render = _pug().default.compile(content, {
65
43
  compileDebug: false,
66
44
  basedir: _path().default.dirname(asset.filePath),
@@ -68,16 +46,12 @@ var _default = new (_plugin().Transformer)({
68
46
  ...pugConfig,
69
47
  pretty: pugConfig.pretty || false
70
48
  });
71
-
72
49
  for (let filePath of render.dependencies) {
73
50
  await asset.invalidateOnFileChange(filePath);
74
51
  }
75
-
76
52
  asset.type = 'html';
77
53
  asset.setCode(render(pugConfig.locals));
78
54
  return [asset];
79
55
  }
80
-
81
56
  });
82
-
83
57
  exports.default = _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parcel/transformer-pug",
3
- "version": "2.8.3",
3
+ "version": "2.9.0",
4
4
  "license": "MIT",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -17,11 +17,11 @@
17
17
  "source": "src/PugTransformer.js",
18
18
  "engines": {
19
19
  "node": ">= 12.0.0",
20
- "parcel": "^2.8.3"
20
+ "parcel": "^2.9.0"
21
21
  },
22
22
  "dependencies": {
23
- "@parcel/plugin": "2.8.3",
23
+ "@parcel/plugin": "2.9.0",
24
24
  "pug": "^3.0.2"
25
25
  },
26
- "gitHead": "349a6caf40ec8abb6a49fcae0765f8f8deb2073d"
26
+ "gitHead": "dd9435be8afed35c5ffc161cf4b586fd6c78fc1f"
27
27
  }
@@ -10,18 +10,13 @@ export default (new Transformer({
10
10
  '.pugrc',
11
11
  '.pugrc.js',
12
12
  '.pugrc.cjs',
13
+ '.pugrc.mjs',
13
14
  'pug.config.js',
14
15
  'pug.config.cjs',
16
+ 'pug.config.mjs',
15
17
  ]);
16
18
 
17
- if (configFile) {
18
- let isJavascript = path.extname(configFile.filePath).endsWith('js');
19
- if (isJavascript) {
20
- config.invalidateOnStartup();
21
- }
22
-
23
- return configFile.contents;
24
- }
19
+ return configFile?.contents;
25
20
  },
26
21
 
27
22
  async transform({asset, config}) {