@adobe/htlengine 6.3.5 → 6.4.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.
package/.eslintrc.js CHANGED
@@ -29,6 +29,7 @@ module.exports = {
29
29
  extends: 'airbnb-base',
30
30
  rules: {
31
31
  strict: 0,
32
+ 'import/extensions': 0,
32
33
 
33
34
  // allow dangling underscores for 'fields'
34
35
  'no-underscore-dangle': ['error', { allowAfterThis: true }],
package/CHANGELOG.md CHANGED
@@ -1,3 +1,33 @@
1
+ # [6.4.0](https://github.com/adobe/htlengine/compare/v6.3.8...v6.4.0) (2021-12-16)
2
+
3
+
4
+ ### Features
5
+
6
+ * trigger release ([a426c0a](https://github.com/adobe/htlengine/commit/a426c0a7ab41736a17d64dd321b69e34ad93d2ed))
7
+
8
+ ## [6.3.8](https://github.com/adobe/htlengine/compare/v6.3.7...v6.3.8) (2021-07-26)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * use node 12 for release ([362ff07](https://github.com/adobe/htlengine/commit/362ff072816d75d308d9fdaa25307e2d80cfcb75))
14
+ * use nodejs url instead of urijs ([821e0d9](https://github.com/adobe/htlengine/commit/821e0d97973975522d04ef1636ab994cfc1cacbd))
15
+ * **deps:** update external major ([#327](https://github.com/adobe/htlengine/issues/327)) ([b2450d5](https://github.com/adobe/htlengine/commit/b2450d57ff833c22d50d41a98c210890c68fcc1e))
16
+
17
+ ## [6.3.7](https://github.com/adobe/htlengine/compare/v6.3.6...v6.3.7) (2021-02-16)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * **deps:** update dependency xregexp to v5 ([#310](https://github.com/adobe/htlengine/issues/310)) ([e9ee1cd](https://github.com/adobe/htlengine/commit/e9ee1cda43b8564d3134d2c6556344fd2cc6cae2))
23
+
24
+ ## [6.3.6](https://github.com/adobe/htlengine/compare/v6.3.5...v6.3.6) (2021-02-13)
25
+
26
+
27
+ ### Bug Fixes
28
+
29
+ * **deps:** update dependency urijs to v1.19.6 ([704baed](https://github.com/adobe/htlengine/commit/704baed842f66eda6276841aee64dc5290980a42))
30
+
1
31
  ## [6.3.5](https://github.com/adobe/htlengine/compare/v6.3.4...v6.3.5) (2021-02-05)
2
32
 
3
33
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/htlengine",
3
- "version": "6.3.5",
3
+ "version": "6.4.0",
4
4
  "description": "Javascript Based HTL (Sightly) parser",
5
5
  "main": "src/index.js",
6
6
  "license": "Apache-2.0",
@@ -9,7 +9,7 @@
9
9
  "url": "https://github.com/adobe/htlengine.git"
10
10
  },
11
11
  "engines": {
12
- "node": ">=12.11.1 <15.0"
12
+ "node": ">=14"
13
13
  },
14
14
  "scripts": {
15
15
  "build": "npm run build:compile && npm run build:railroad",
@@ -19,10 +19,10 @@
19
19
  "start": "node src/run.js",
20
20
  "test": "c8 --check-coverage --branches 68 --statements 82 --lines 82 mocha",
21
21
  "test-ci": "npm run lint && npm run test && codecov",
22
- "lint": "./node_modules/.bin/eslint ."
22
+ "lint": "eslint ."
23
23
  },
24
24
  "dependencies": {
25
- "fs-extra": "9.1.0",
25
+ "fs-extra": "10.0.0",
26
26
  "he": "1.2.0",
27
27
  "moment": "2.29.1",
28
28
  "moo": "0.5.1",
@@ -32,30 +32,29 @@
32
32
  "rehype-parse": "7.0.1",
33
33
  "sanitizer": "0.1.3",
34
34
  "source-map": "0.7.3",
35
- "unified": "9.2.0",
35
+ "unified": "9.2.2",
36
36
  "unist-util-inspect": "6.0.1",
37
- "urijs": "1.19.5",
38
- "xregexp": "4.4.1"
37
+ "xregexp": "5.1.0"
39
38
  },
40
39
  "devDependencies": {
41
- "@semantic-release/changelog": "5.0.1",
42
- "@semantic-release/git": "9.0.0",
43
- "@semantic-release/github": "7.2.0",
44
- "c8": "7.4.0",
45
- "codecov": "3.8.1",
46
- "eslint": "7.18.0",
47
- "eslint-config-airbnb-base": "14.2.1",
48
- "eslint-plugin-header": "3.1.0",
49
- "eslint-plugin-import": "2.22.1",
40
+ "@semantic-release/changelog": "6.0.1",
41
+ "@semantic-release/git": "10.0.1",
42
+ "@semantic-release/github": "8.0.2",
43
+ "c8": "7.10.0",
44
+ "codecov": "3.8.3",
45
+ "eslint": "8.4.1",
46
+ "eslint-config-airbnb-base": "15.0.0",
47
+ "eslint-plugin-header": "3.1.1",
48
+ "eslint-plugin-import": "2.25.3",
50
49
  "ghooks": "2.0.4",
51
- "jsdom": "16.4.0",
52
- "lint-staged": "10.5.3",
53
- "mocha": "8.2.1",
54
- "mocha-junit-reporter": "2.0.0",
50
+ "jsdom": "19.0.0",
51
+ "lint-staged": "12.1.2",
52
+ "mocha": "9.1.3",
53
+ "mocha-junit-reporter": "2.0.2",
55
54
  "rehype-stringify": "8.0.0",
56
55
  "remark-parse": "9.0.0",
57
- "remark-rehype": "8.0.0",
58
- "semantic-release": "17.3.7"
56
+ "remark-rehype": "8.1.0",
57
+ "semantic-release": "18.0.1"
59
58
  },
60
59
  "lint-staged": {
61
60
  "*.js": "eslint"
@@ -336,7 +336,10 @@ module.exports = class Compiler {
336
336
  } else {
337
337
  // parse the template
338
338
  const res = await this._parse(
339
- templateSource, path.dirname(templatePath), mods, templates,
339
+ templateSource,
340
+ path.dirname(templatePath),
341
+ mods,
342
+ templates,
340
343
  );
341
344
 
342
345
  // extract the template functions and discard commands outside the functions
@@ -23,7 +23,9 @@ module.exports = class UsePlugin extends Plugin {
23
23
  if (this._expression.root instanceof StringConstant) {
24
24
  const lib = this._expression.root.text;
25
25
  stream.write(new FileReference(
26
- variableName, lib, [new MapLiteral(this._expression.options)],
26
+ variableName,
27
+ lib,
28
+ [new MapLiteral(this._expression.options)],
27
29
  ), true);
28
30
  return;
29
31
  }
@@ -26,24 +26,35 @@ const FRAGMENT = 'fragment';
26
26
  const QUERY = 'query';
27
27
  const ADD_QUERY = 'addQuery';
28
28
  const REMOVE_QUERY = 'removeQuery';
29
-
30
- const URI = require('urijs');
29
+ const url = require('url');
30
+ const querystring = require('querystring');
31
+ const path = require('path').posix;
31
32
 
32
33
  module.exports = function formatUri(uri, opts) {
33
34
  if (!uri) {
34
35
  return null;
35
36
  }
36
37
 
37
- const u = URI(uri);
38
+ let u;
39
+ if (uri.startsWith('//')) {
40
+ // no scheme, but parse will be wrong
41
+ u = url.parse(`fake:${uri}`);
42
+ u.protocol = '';
43
+ } else {
44
+ u = url.parse(uri);
45
+ }
38
46
  if (SCHEME in opts) {
39
- u.scheme(opts[SCHEME]);
47
+ u.protocol = opts[SCHEME];
40
48
  }
41
49
  if (DOMAIN in opts) {
42
- u.host(opts[DOMAIN]);
50
+ u.host = opts[DOMAIN];
51
+ u.hostname = opts[DOMAIN];
43
52
  }
53
+ u.search = null;
54
+ u.query = u.query ? querystring.parse(u.query) : {};
44
55
 
45
56
  // remove selectors and suffixes for path manipulation
46
- const p = u.path();
57
+ const p = u.pathname;
47
58
  const idxSelStart = p.indexOf('.');
48
59
  let idxSuffix = idxSelStart < 0 ? -1 : p.indexOf('/', idxSelStart);
49
60
  if (idxSuffix < 0) {
@@ -54,25 +65,22 @@ module.exports = function formatUri(uri, opts) {
54
65
  let selectors = selectorString ? selectorString.substring(1).split('.') : [];
55
66
  let extension = idxExtension < 0 ? '' : p.substring(idxExtension, idxSuffix);
56
67
  let suffix = idxSuffix < 0 ? '' : p.substring(idxSuffix);
57
- // const pp = idxSelStart < 0 ? p : p.substring(0, idxSelStart);
58
-
59
- // console.log(`'${p}' -> '${pp}' '${selectors}' '${extension}' '${suffix}'`);
60
68
 
61
69
  if (idxSelStart >= 0) {
62
- u.path(p.substring(0, idxSelStart));
70
+ u.pathname = p.substring(0, idxSelStart);
63
71
  }
64
72
 
65
73
  const setPath = opts[PATH];
66
74
  if (setPath) {
67
- u.path(setPath);
75
+ u.pathname = setPath;
68
76
  }
69
77
  const appendPath = opts[APPEND_PATH];
70
78
  if (appendPath) {
71
- u.path(`${u.path()}/${appendPath}`);
79
+ u.pathname = `${u.pathname}/${appendPath}`;
72
80
  }
73
81
  const prependPath = opts[PREPEND_PATH];
74
82
  if (prependPath) {
75
- u.path(`${prependPath}/${u.path()}`);
83
+ u.pathname = `${prependPath}/${u.pathname}`;
76
84
  }
77
85
  if (SELECTORS in opts) {
78
86
  let setSelectors = opts[SELECTORS];
@@ -129,30 +137,27 @@ module.exports = function formatUri(uri, opts) {
129
137
  if (QUERY in opts) {
130
138
  const qry = opts[QUERY];
131
139
  if (!qry) {
132
- u.query('');
140
+ u.query = {};
133
141
  } else {
134
- u.query(qry);
142
+ u.query = qry;
135
143
  }
136
144
  }
137
145
  const addQuery = opts[ADD_QUERY];
138
146
  if (addQuery) {
139
- const merged = Object.assign(u.query(true), addQuery);
140
- u.query(merged);
147
+ u.query = Object.assign(u.query, addQuery);
141
148
  }
142
149
  const removeQuery = opts[REMOVE_QUERY];
143
150
  if (removeQuery) {
144
- const qry = u.query(true);
145
151
  if (Array.isArray(removeQuery)) {
146
- removeQuery.forEach((q) => delete qry[q]);
152
+ removeQuery.forEach((q) => delete u.query[q]);
147
153
  } else {
148
- delete qry[removeQuery];
154
+ delete u.query[removeQuery];
149
155
  }
150
- u.query(qry);
151
156
  }
152
157
  if (FRAGMENT in opts) {
153
- u.fragment(opts[FRAGMENT] || '');
158
+ u.hash = opts[FRAGMENT] || '';
154
159
  }
155
160
  selectorString = selectors.length > 0 ? `.${selectors.join('.')}` : '';
156
- u.path(u.path() + selectorString + extension + suffix);
157
- return u.normalizePath().toString();
161
+ u.pathname = path.normalize(u.pathname + selectorString + extension + suffix);
162
+ return url.format(u);
158
163
  };