@skmtc/core 0.0.878 → 0.0.879

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.
@@ -0,0 +1,2 @@
1
+ export declare const protectedKeywords: Record<string, string>;
2
+ //# sourceMappingURL=protectedKeywords.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protectedKeywords.d.ts","sourceRoot":"","sources":["../../src/helpers/protectedKeywords.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAmEpD,CAAA"}
@@ -0,0 +1,68 @@
1
+ export const protectedKeywords = {
2
+ abstract: 'abstractValue',
3
+ arguments: 'argumentsValue',
4
+ 'async *': 'asyncStarValue',
5
+ 'await *': 'awaitStarValue',
6
+ boolean: 'booleanValue',
7
+ break: 'breakValue',
8
+ byte: 'byteValue',
9
+ case: 'caseValue',
10
+ catch: 'catchValue',
11
+ char: 'charValue',
12
+ 'class *': 'classStarValue',
13
+ 'const *': 'constStarValue',
14
+ continue: 'continueValue',
15
+ debugger: 'debuggerValue',
16
+ default: 'defaultValue',
17
+ delete: 'deleteValue',
18
+ do: 'doValue',
19
+ double: 'doubleValue',
20
+ else: 'elseValue',
21
+ 'enum *': 'enumStarValue',
22
+ eval: 'evalValue',
23
+ 'export *': 'exportStarValue',
24
+ 'extends *': 'extendsStarValue',
25
+ false: 'falseValue',
26
+ final: 'finalValue',
27
+ finally: 'finallyValue',
28
+ float: 'floatValue',
29
+ for: 'forValue',
30
+ goto: 'gotoValue',
31
+ if: 'ifValue',
32
+ implements: 'implementsValue',
33
+ function: 'functionValue',
34
+ 'import *': 'importStarValue',
35
+ in: 'inValue',
36
+ instanceof: 'instanceofValue',
37
+ int: 'intValue',
38
+ interface: 'interfaceValue',
39
+ 'let *': 'letStarValue',
40
+ long: 'longValue',
41
+ native: 'nativeValue',
42
+ new: 'newValue',
43
+ null: 'nullValue',
44
+ package: 'packageValue',
45
+ private: 'privateValue',
46
+ protected: 'protectedValue',
47
+ public: 'publicValue',
48
+ return: 'returnValue',
49
+ short: 'shortValue',
50
+ static: 'staticValue',
51
+ 'super *': 'superStarValue',
52
+ switch: 'switchValue',
53
+ synchronized: 'synchronizedValue',
54
+ this: 'thisValue',
55
+ throw: 'throwValue',
56
+ throws: 'throwsValue',
57
+ transient: 'transientValue',
58
+ true: 'trueValue',
59
+ try: 'tryValue',
60
+ typeof: 'typeofValue',
61
+ 'using *': 'usingStarValue',
62
+ var: 'varValue',
63
+ void: 'voidValue',
64
+ volatile: 'volatileValue',
65
+ while: 'whileValue',
66
+ with: 'withValue',
67
+ yield: 'yieldValue'
68
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"sanitizePropertyName.d.ts","sourceRoot":"","sources":["../../src/helpers/sanitizePropertyName.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AAG5C,eAAO,MAAM,oBAAoB,GAAI,cAAc,MAAM,kDAUxD,CAAA"}
1
+ {"version":3,"file":"sanitizePropertyName.d.ts","sourceRoot":"","sources":["../../src/helpers/sanitizePropertyName.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AAI5C,eAAO,MAAM,oBAAoB,GAAI,cAAc,MAAM,kDAYxD,CAAA"}
@@ -1,16 +1,14 @@
1
- import { isIdentifierName, isReservedWord } from '@babel/helper-validator-identifier';
1
+ import { isIdentifierName } from '@babel/helper-validator-identifier';
2
2
  import { List } from '../typescript/List.js';
3
3
  import { camelCase } from './strings.js';
4
+ import { protectedKeywords } from './protectedKeywords.js';
4
5
  export const sanitizePropertyName = (propertyName) => {
5
- if (isReservedWord(propertyName, true)) {
6
- return sanitizeReservedWord(propertyName);
6
+ const sanitizedKeyword = protectedKeywords[propertyName];
7
+ if (sanitizedKeyword) {
8
+ return sanitizedKeyword;
7
9
  }
8
10
  if (!isIdentifierName(propertyName)) {
9
- return List.toKeyValue(propertyName, camelCase(propertyName));
11
+ return List.toKeyValue(`'${propertyName}'`, camelCase(propertyName));
10
12
  }
11
13
  return propertyName;
12
14
  };
13
- const sanitizeReservedWord = (propertyName) => {
14
- const destarred = propertyName.replace(' *', 'Star');
15
- return `${destarred}Value`;
16
- };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skmtc/core",
3
- "version": "0.0.878",
3
+ "version": "0.0.879",
4
4
  "description": "Skmtc is a declarative code generation framework",
5
5
  "keywords": [
6
6
  "openapi",
@@ -0,0 +1,2 @@
1
+ export declare const protectedKeywords: Record<string, string>;
2
+ //# sourceMappingURL=protectedKeywords.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protectedKeywords.d.ts","sourceRoot":"","sources":["../../src/helpers/protectedKeywords.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAmEpD,CAAA"}
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.protectedKeywords = void 0;
4
+ exports.protectedKeywords = {
5
+ abstract: 'abstractValue',
6
+ arguments: 'argumentsValue',
7
+ 'async *': 'asyncStarValue',
8
+ 'await *': 'awaitStarValue',
9
+ boolean: 'booleanValue',
10
+ break: 'breakValue',
11
+ byte: 'byteValue',
12
+ case: 'caseValue',
13
+ catch: 'catchValue',
14
+ char: 'charValue',
15
+ 'class *': 'classStarValue',
16
+ 'const *': 'constStarValue',
17
+ continue: 'continueValue',
18
+ debugger: 'debuggerValue',
19
+ default: 'defaultValue',
20
+ delete: 'deleteValue',
21
+ do: 'doValue',
22
+ double: 'doubleValue',
23
+ else: 'elseValue',
24
+ 'enum *': 'enumStarValue',
25
+ eval: 'evalValue',
26
+ 'export *': 'exportStarValue',
27
+ 'extends *': 'extendsStarValue',
28
+ false: 'falseValue',
29
+ final: 'finalValue',
30
+ finally: 'finallyValue',
31
+ float: 'floatValue',
32
+ for: 'forValue',
33
+ goto: 'gotoValue',
34
+ if: 'ifValue',
35
+ implements: 'implementsValue',
36
+ function: 'functionValue',
37
+ 'import *': 'importStarValue',
38
+ in: 'inValue',
39
+ instanceof: 'instanceofValue',
40
+ int: 'intValue',
41
+ interface: 'interfaceValue',
42
+ 'let *': 'letStarValue',
43
+ long: 'longValue',
44
+ native: 'nativeValue',
45
+ new: 'newValue',
46
+ null: 'nullValue',
47
+ package: 'packageValue',
48
+ private: 'privateValue',
49
+ protected: 'protectedValue',
50
+ public: 'publicValue',
51
+ return: 'returnValue',
52
+ short: 'shortValue',
53
+ static: 'staticValue',
54
+ 'super *': 'superStarValue',
55
+ switch: 'switchValue',
56
+ synchronized: 'synchronizedValue',
57
+ this: 'thisValue',
58
+ throw: 'throwValue',
59
+ throws: 'throwsValue',
60
+ transient: 'transientValue',
61
+ true: 'trueValue',
62
+ try: 'tryValue',
63
+ typeof: 'typeofValue',
64
+ 'using *': 'usingStarValue',
65
+ var: 'varValue',
66
+ void: 'voidValue',
67
+ volatile: 'volatileValue',
68
+ while: 'whileValue',
69
+ with: 'withValue',
70
+ yield: 'yieldValue'
71
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"sanitizePropertyName.d.ts","sourceRoot":"","sources":["../../src/helpers/sanitizePropertyName.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AAG5C,eAAO,MAAM,oBAAoB,GAAI,cAAc,MAAM,kDAUxD,CAAA"}
1
+ {"version":3,"file":"sanitizePropertyName.d.ts","sourceRoot":"","sources":["../../src/helpers/sanitizePropertyName.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AAI5C,eAAO,MAAM,oBAAoB,GAAI,cAAc,MAAM,kDAYxD,CAAA"}
@@ -4,17 +4,15 @@ exports.sanitizePropertyName = void 0;
4
4
  const helper_validator_identifier_1 = require("@babel/helper-validator-identifier");
5
5
  const List_js_1 = require("../typescript/List.js");
6
6
  const strings_js_1 = require("./strings.js");
7
+ const protectedKeywords_js_1 = require("./protectedKeywords.js");
7
8
  const sanitizePropertyName = (propertyName) => {
8
- if ((0, helper_validator_identifier_1.isReservedWord)(propertyName, true)) {
9
- return sanitizeReservedWord(propertyName);
9
+ const sanitizedKeyword = protectedKeywords_js_1.protectedKeywords[propertyName];
10
+ if (sanitizedKeyword) {
11
+ return sanitizedKeyword;
10
12
  }
11
13
  if (!(0, helper_validator_identifier_1.isIdentifierName)(propertyName)) {
12
- return List_js_1.List.toKeyValue(propertyName, (0, strings_js_1.camelCase)(propertyName));
14
+ return List_js_1.List.toKeyValue(`'${propertyName}'`, (0, strings_js_1.camelCase)(propertyName));
13
15
  }
14
16
  return propertyName;
15
17
  };
16
18
  exports.sanitizePropertyName = sanitizePropertyName;
17
- const sanitizeReservedWord = (propertyName) => {
18
- const destarred = propertyName.replace(' *', 'Star');
19
- return `${destarred}Value`;
20
- };