@orioro/util 0.13.1 → 0.15.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/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @orioro/util
2
2
 
3
+ ## 0.15.0
4
+
5
+ ### Minor Changes
6
+
7
+ - add support for special chars inside string interpolator
8
+
9
+ ## 0.14.0
10
+
11
+ ### Minor Changes
12
+
13
+ - syntheticJson fallback to full json in case of error
14
+
15
+ ## 0.13.2
16
+
17
+ ### Patch Changes
18
+
19
+ - undo export update
20
+
3
21
  ## 0.13.1
4
22
 
5
23
  ### Patch Changes
package/dist/index.js CHANGED
@@ -932,8 +932,10 @@ function debugFn(fnName, fn, logCall, logResult) {
932
932
  }
933
933
 
934
934
  /**
935
- * /\$\{\s*([\w$.]+)\s*\}/g
936
- * ![](docs/resources/interpolation_regexp.png)
935
+ * /\$\{\s*([A-Za-z0-9_$.=#+?@ \/'"-]+)\s*\}/g
936
+ * ![](docs/interpolation_regexp.png)
937
+ *
938
+ * https://regex-vis.com/?r=%2F%5C%24%5C%7B%5Cs*%28%5BA-Za-z0-9_%24.%3D%23%2B%3F%40+%5C%2F%27%22-%5D%2B%29%5Cs*%5C%7D%2Fg
937
939
  *
938
940
  * RegExp used for matching interpolation expressions.
939
941
  * Allows a non-interrupted sequence of alphanumeric chars ([A-Za-z0-9_]),
@@ -954,7 +956,7 @@ function debugFn(fnName, fn, logCall, logResult) {
954
956
  *
955
957
  * @const {RegExp} INTERPOLATION_REGEXP
956
958
  */
957
- var INTERPOLATION_REGEXP = /\$\{\s*([\w$.=\s]+)\s*\}/g;
959
+ var INTERPOLATION_REGEXP = /\$\{\s*([A-Za-z0-9_$.=#+?@ \/'"-]+)\s*\}/g;
958
960
  var DEFAULT_SIGN = '=';
959
961
  function _parsePathExpr(pathExpr) {
960
962
  var splitRes = pathExpr.split(DEFAULT_SIGN);
@@ -1491,8 +1493,12 @@ function syntheticJson(str) {
1491
1493
  // Step 3: Parse as JSON
1492
1494
  try {
1493
1495
  return JSON.parse(normalized);
1494
- } catch (error) {
1495
- throw new Error("Invalid synthetic JSON: ".concat(str));
1496
+ } catch (err1) {
1497
+ try {
1498
+ return JSON.parse(str);
1499
+ } catch (err2) {
1500
+ throw new Error("Invalid synthetic JSON: ".concat(str));
1501
+ }
1496
1502
  }
1497
1503
  }
1498
1504
 
package/dist/index.mjs CHANGED
@@ -930,8 +930,10 @@ function debugFn(fnName, fn, logCall, logResult) {
930
930
  }
931
931
 
932
932
  /**
933
- * /\$\{\s*([\w$.]+)\s*\}/g
934
- * ![](docs/resources/interpolation_regexp.png)
933
+ * /\$\{\s*([A-Za-z0-9_$.=#+?@ \/'"-]+)\s*\}/g
934
+ * ![](docs/interpolation_regexp.png)
935
+ *
936
+ * https://regex-vis.com/?r=%2F%5C%24%5C%7B%5Cs*%28%5BA-Za-z0-9_%24.%3D%23%2B%3F%40+%5C%2F%27%22-%5D%2B%29%5Cs*%5C%7D%2Fg
935
937
  *
936
938
  * RegExp used for matching interpolation expressions.
937
939
  * Allows a non-interrupted sequence of alphanumeric chars ([A-Za-z0-9_]),
@@ -952,7 +954,7 @@ function debugFn(fnName, fn, logCall, logResult) {
952
954
  *
953
955
  * @const {RegExp} INTERPOLATION_REGEXP
954
956
  */
955
- var INTERPOLATION_REGEXP = /\$\{\s*([\w$.=\s]+)\s*\}/g;
957
+ var INTERPOLATION_REGEXP = /\$\{\s*([A-Za-z0-9_$.=#+?@ \/'"-]+)\s*\}/g;
956
958
  var DEFAULT_SIGN = '=';
957
959
  function _parsePathExpr(pathExpr) {
958
960
  var splitRes = pathExpr.split(DEFAULT_SIGN);
@@ -1489,8 +1491,12 @@ function syntheticJson(str) {
1489
1491
  // Step 3: Parse as JSON
1490
1492
  try {
1491
1493
  return JSON.parse(normalized);
1492
- } catch (error) {
1493
- throw new Error("Invalid synthetic JSON: ".concat(str));
1494
+ } catch (err1) {
1495
+ try {
1496
+ return JSON.parse(str);
1497
+ } catch (err2) {
1498
+ throw new Error("Invalid synthetic JSON: ".concat(str));
1499
+ }
1494
1500
  }
1495
1501
  }
1496
1502
 
package/package.json CHANGED
@@ -1,19 +1,13 @@
1
1
  {
2
2
  "name": "@orioro/util",
3
- "version": "0.13.1",
3
+ "version": "0.15.0",
4
4
  "packageManager": "yarn@4.0.2",
5
5
  "type": "module",
6
6
  "main": "dist/index.mjs",
7
7
  "types": "dist/index.d.ts",
8
8
  "exports": {
9
- ".": {
10
- "import": "./dist/index.mjs",
11
- "require": "./dist/index.js"
12
- },
13
- "./*": {
14
- "import": "./dist/*.mjs",
15
- "require": "./dist/*.js"
16
- }
9
+ ".": "./dist/index.mjs",
10
+ "./*": "./dist/*"
17
11
  },
18
12
  "files": [
19
13
  "dist"