@routier/core 0.6.0 → 0.8.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/dist/assertions/index.cjs +19 -8
- package/dist/assertions/index.cjs.map +1 -1
- package/dist/assertions/index.d.ts +5 -1
- package/dist/assertions/index.js +21 -9
- package/dist/assertions/index.js.map +1 -1
- package/dist/codegen/blocks.d.ts +17 -1
- package/dist/codegen/handlers/types.d.ts +13 -5
- package/dist/codegen/index.cjs +28 -0
- package/dist/codegen/index.cjs.map +1 -1
- package/dist/codegen/index.js +28 -0
- package/dist/codegen/index.js.map +1 -1
- package/dist/collections/MemoryDataCollection.d.ts +8 -0
- package/dist/collections/index.cjs +141 -4
- package/dist/collections/index.cjs.map +1 -1
- package/dist/collections/index.js +141 -4
- package/dist/collections/index.js.map +1 -1
- package/dist/expressions/callSource.d.ts +41 -0
- package/dist/expressions/evaluate.d.ts +3 -0
- package/dist/expressions/fold.d.ts +7 -0
- package/dist/expressions/index.cjs +1985 -242
- package/dist/expressions/index.cjs.map +1 -1
- package/dist/expressions/index.d.ts +2 -0
- package/dist/expressions/index.js +1997 -243
- package/dist/expressions/index.js.map +1 -1
- package/dist/expressions/parser.d.ts +42 -1
- package/dist/expressions/types.d.ts +45 -26
- package/dist/expressions/utils.d.ts +19 -1
- package/dist/index.cjs +3139 -680
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3479 -997
- package/dist/index.js.map +1 -1
- package/dist/performance/index.cjs +6 -4
- package/dist/performance/index.cjs.map +1 -1
- package/dist/performance/index.js +6 -4
- package/dist/performance/index.js.map +1 -1
- package/dist/pipeline/index.cjs +6 -4
- package/dist/pipeline/index.cjs.map +1 -1
- package/dist/pipeline/index.js +6 -4
- package/dist/pipeline/index.js.map +1 -1
- package/dist/plugins/EphemeralDataPlugin.d.ts +8 -0
- package/dist/plugins/index.cjs +2921 -411
- package/dist/plugins/index.cjs.map +1 -1
- package/dist/plugins/index.js +2863 -343
- package/dist/plugins/index.js.map +1 -1
- package/dist/plugins/query/QueryOptionsCollection.d.ts +48 -10
- package/dist/plugins/query/describeFilter.d.ts +83 -0
- package/dist/plugins/query/explain.d.ts +71 -9
- package/dist/plugins/query/index.d.ts +2 -0
- package/dist/plugins/query/join.d.ts +4 -1
- package/dist/plugins/query/renames.d.ts +27 -0
- package/dist/plugins/query/types.d.ts +50 -4
- package/dist/plugins/translators/SqlTranslator.d.ts +15 -0
- package/dist/schema/PropertyInfo.d.ts +0 -1
- package/dist/schema/SchemaDefinition.d.ts +8 -0
- package/dist/schema/changeTracker.d.ts +10 -0
- package/dist/schema/index.cjs +298 -288
- package/dist/schema/index.cjs.map +1 -1
- package/dist/schema/index.d.ts +1 -0
- package/dist/schema/index.js +301 -290
- package/dist/schema/index.js.map +1 -1
- package/dist/schema/types.d.ts +8 -7
- package/dist/schema/utils/storageDates.d.ts +25 -0
- package/dist/transfer/index.cjs.map +1 -1
- package/dist/transfer/index.js.map +1 -1
- package/dist/utilities/index.cjs +306 -68
- package/dist/utilities/index.cjs.map +1 -1
- package/dist/utilities/index.js +306 -68
- package/dist/utilities/index.js.map +1 -1
- package/package.json +2 -2
- package/dist/codegen/utils.d.ts +0 -22
|
@@ -5,14 +5,19 @@ var __webpack_modules__ = ({
|
|
|
5
5
|
__webpack_require__.d(__webpack_exports__, {
|
|
6
6
|
t: () => (EXPRESSION_TYPES)
|
|
7
7
|
});
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
|
|
8
|
+
/**
|
|
9
|
+
* A `Record` rather than a list, so adding to `ExpressionType` without adding it here is a compile
|
|
10
|
+
* error. As a list it was not exhaustive, and `call` was silently missing from `isExpression`.
|
|
11
|
+
*/ const EXPRESSION_TYPE_SET = {
|
|
12
|
+
"operator": true,
|
|
13
|
+
"comparator": true,
|
|
14
|
+
"property": true,
|
|
15
|
+
"value": true,
|
|
16
|
+
"call": true,
|
|
17
|
+
"empty": true,
|
|
18
|
+
"not-parsable": true
|
|
19
|
+
};
|
|
20
|
+
const EXPRESSION_TYPES = Object.keys(EXPRESSION_TYPE_SET);
|
|
16
21
|
|
|
17
22
|
|
|
18
23
|
},
|
|
@@ -92,6 +97,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
92
97
|
assertIsNotNull: () => (assertIsNotNull),
|
|
93
98
|
assertIsNumber: () => (assertIsNumber),
|
|
94
99
|
assertString: () => (assertString),
|
|
100
|
+
isCallExpression: () => (isCallExpression),
|
|
95
101
|
isComparatorExpression: () => (isComparatorExpression),
|
|
96
102
|
isEmptyExpression: () => (isEmptyExpression),
|
|
97
103
|
isExpression: () => (isExpression),
|
|
@@ -172,6 +178,11 @@ function isObjectWithType(value) {
|
|
|
172
178
|
*/ function isValueExpression(value) {
|
|
173
179
|
return isObjectWithType(value) && value.type === "value";
|
|
174
180
|
}
|
|
181
|
+
/**
|
|
182
|
+
* Type guard: narrows `value` to `CallExpression` when it is an object with `type === "call"`.
|
|
183
|
+
*/ function isCallExpression(value) {
|
|
184
|
+
return isObjectWithType(value) && value.type === "call";
|
|
185
|
+
}
|
|
175
186
|
/**
|
|
176
187
|
* Type guard: narrows `value` to `EmptyExpression` when it is an object with `type === "empty"`.
|
|
177
188
|
*/ function isEmptyExpression(value) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assertions/index.cjs","sources":["webpack://@routier/core/./src/expressions/constants.ts","webpack://@routier/core/./src/utilities/dates.ts","webpack://@routier/core/webpack/runtime/define_property_getters","webpack://@routier/core/webpack/runtime/has_own_property","webpack://@routier/core/webpack/runtime/make_namespace_object","webpack://@routier/core/./src/assertions/index.ts"],"sourcesContent":["import { ExpressionType } from \"./types\";\n\
|
|
1
|
+
{"version":3,"file":"assertions/index.cjs","sources":["webpack://@routier/core/./src/expressions/constants.ts","webpack://@routier/core/./src/utilities/dates.ts","webpack://@routier/core/webpack/runtime/define_property_getters","webpack://@routier/core/webpack/runtime/has_own_property","webpack://@routier/core/webpack/runtime/make_namespace_object","webpack://@routier/core/./src/assertions/index.ts"],"sourcesContent":["import { ExpressionType } from \"./types\";\n\n/**\n * A `Record` rather than a list, so adding to `ExpressionType` without adding it here is a compile\n * error. As a list it was not exhaustive, and `call` was silently missing from `isExpression`.\n */\nconst EXPRESSION_TYPE_SET: Record<ExpressionType, true> = {\n \"operator\": true,\n \"comparator\": true,\n \"property\": true,\n \"value\": true,\n \"call\": true,\n \"empty\": true,\n \"not-parsable\": true,\n};\n\nexport const EXPRESSION_TYPES = Object.keys(EXPRESSION_TYPE_SET) as ExpressionType[];\n","export const isDate = (data: unknown): data is Date => {\n if (data == null) {\n return false;\n }\n\n if (typeof data !== \"object\") {\n return false;\n }\n\n return data instanceof Date;\n}","__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n }\n }\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { EXPRESSION_TYPES } from \"../expressions/constants\";\nimport { CallExpression, ComparatorExpression, EmptyExpression, Expression, ExpressionType, NotParsableExpression, OperatorExpression, PropertyExpression, ValueExpression } from \"../expressions/types\";\nimport { isDate } from \"../utilities\";\n\nexport function assertDate(data: unknown): asserts data is Date {\n if (isDate(data) === false) {\n throw new TypeError('Value is not a Date');\n }\n}\n\nexport function assertIsNotNull<T>(data: T | null | undefined, message?: string | (() => string)): asserts data is NonNullable<T> {\n if (data == null) {\n if (message == null) {\n throw new TypeError('Assertion failed, data is null');\n }\n\n if (typeof message === \"string\") {\n throw new TypeError(message);\n }\n\n throw new TypeError(message());\n }\n}\n\nexport function assertIsArray<T>(data: unknown, message?: string): asserts data is T[] {\n if (!Array.isArray(data)) {\n throw new TypeError(message ?? 'Assertion failed, data is not of type Array');\n }\n}\n\nexport function assertString(data: unknown, message?: string): asserts data is string {\n if (typeof data !== \"string\") {\n throw new TypeError(message ?? 'Assertion failed, data is not of type String');\n }\n}\n\nexport function assertInstanceOf<T extends new (...args: any[]) => any>(value: unknown, Instance: T): asserts value is T {\n if (value instanceof Instance) {\n return;\n }\n\n if (value != null && typeof value === \"object\" && \"constructor\" in value) {\n throw new TypeError(`value is not instance of type. Type: ${value.constructor.name}`);\n }\n\n throw new TypeError(`value is not instance of type`);\n}\n\nexport function assertIsNumber(value: unknown): asserts value is number {\n if (typeof value !== \"number\") {\n throw new TypeError(\"value is not of type `number`\");\n }\n}\n\n\nfunction isObjectWithType(value: unknown): value is Record<\"type\", unknown> {\n return typeof value === \"object\" && value !== null && \"type\" in value;\n}\n\n/**\n * Type guard: narrows `value` to `Expression` when it is an object with a valid `type` property.\n */\nexport function isExpression(value: unknown): value is Expression {\n return isObjectWithType(value) && EXPRESSION_TYPES.includes(value.type as ExpressionType);\n}\n\n/**\n * Type guard: narrows `value` to `OperatorExpression` when it is an object with `type === \"operator\"`.\n */\nexport function isOperatorExpression(value: unknown): value is OperatorExpression {\n return isObjectWithType(value) && value.type === \"operator\";\n}\n\n/**\n * Type guard: narrows `value` to `ComparatorExpression` when it is an object with `type === \"comparator\"`.\n */\nexport function isComparatorExpression(value: unknown): value is ComparatorExpression {\n return isObjectWithType(value) && value.type === \"comparator\";\n}\n\n/**\n * Type guard: narrows `value` to `PropertyExpression` when it is an object with `type === \"property\"`.\n */\nexport function isPropertyExpression(value: unknown): value is PropertyExpression {\n return isObjectWithType(value) && value.type === \"property\";\n}\n\n/**\n * Type guard: narrows `value` to `ValueExpression` when it is an object with `type === \"value\"`.\n */\nexport function isValueExpression(value: unknown): value is ValueExpression {\n return isObjectWithType(value) && value.type === \"value\";\n}\n\n/**\n * Type guard: narrows `value` to `CallExpression` when it is an object with `type === \"call\"`.\n */\nexport function isCallExpression(value: unknown): value is CallExpression {\n return isObjectWithType(value) && value.type === \"call\";\n}\n\n/**\n * Type guard: narrows `value` to `EmptyExpression` when it is an object with `type === \"empty\"`.\n */\nexport function isEmptyExpression(value: unknown): value is EmptyExpression {\n return isObjectWithType(value) && value.type === \"empty\";\n}\n\n/**\n * Type guard: narrows `value` to `NotParsableExpression` when it is an object with `type === \"not-parsable\"`.\n */\nexport function isNotParsableExpression(value: unknown): value is NotParsableExpression {\n return isObjectWithType(value) && value.type === \"not-parsable\";\n}"],"names":["EXPRESSION_TYPE_SET","EXPRESSION_TYPES","Object","isDate","data","Date","assertDate","TypeError","assertIsNotNull","message","assertIsArray","Array","assertString","assertInstanceOf","value","Instance","assertIsNumber","isObjectWithType","isExpression","isOperatorExpression","isComparatorExpression","isPropertyExpression","isValueExpression","isCallExpression","isEmptyExpression","isNotParsableExpression"],"mappings":";;;;;;;AAEA;;;CAGC,GACD,MAAMA,sBAAoD;IACtD,YAAY;IACZ,cAAc;IACd,YAAY;IACZ,SAAS;IACT,QAAQ;IACR,SAAS;IACT,gBAAgB;AACpB;AAEO,MAAMC,mBAAmBC,OAAO,IAAI,CAACF,qBAAyC;;;;;;;;AChB9E,MAAMG,SAAS,CAACC;IACnB,IAAIA,QAAQ,MAAM;QACd,OAAO;IACX;IAEA,IAAI,OAAOA,SAAS,UAAU;QAC1B,OAAO;IACX;IAEA,OAAOA,gBAAgBC;AAC3B,EAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACVD;AACA;AACA;AACA,kDAAkD,wCAAwC;AAC1F;AACA;AACA,E;;;;ACNA,wF;;;;ACAA;AACA;AACA;AACA,uDAAuD,iBAAiB;AACxE;AACA,gDAAgD,aAAa;AAC7D,E;;;;;;;;;;;;;;;;;;;;;;;;ACN4D;AAEtB;AAE/B,SAASC,WAAWF,IAAa;IACpC,IAAID,8CAAMA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jD,OAAOG,iBAAiBH,UAAUA,MAAM,IAAI,KAAK;AACrD;AAEA;;CAEC,GACM,SAASO,qBAAqBP,KAAc;IAC/C,OAAOG,iBAAiBH,UAAUA,MAAM,IAAI,KAAK;AACrD;AAEA;;CAEC,GACM,SAASQ,kBAAkBR,KAAc;IAC5C,OAAOG,iBAAiBH,UAAUA,MAAM,IAAI,KAAK;AACrD;AAEA;;CAEC,GACM,SAASS,iBAAiBT,KAAc;IAC3C,OAAOG,iBAAiBH,UAAUA,MAAM,IAAI,KAAK;AACrD;AAEA;;CAEC,GACM,SAASU,kBAAkBV,KAAc;IAC5C,OAAOG,iBAAiBH,UAAUA,MAAM,IAAI,KAAK;AACrD;AAEA;;CAEC,GACM,SAASW,wBAAwBX,KAAc;IAClD,OAAOG,iBAAiBH,UAAUA,MAAM,IAAI,KAAK;AACrD"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ComparatorExpression, EmptyExpression, Expression, NotParsableExpression, OperatorExpression, PropertyExpression, ValueExpression } from "../expressions/types";
|
|
1
|
+
import { CallExpression, ComparatorExpression, EmptyExpression, Expression, NotParsableExpression, OperatorExpression, PropertyExpression, ValueExpression } from "../expressions/types";
|
|
2
2
|
export declare function assertDate(data: unknown): asserts data is Date;
|
|
3
3
|
export declare function assertIsNotNull<T>(data: T | null | undefined, message?: string | (() => string)): asserts data is NonNullable<T>;
|
|
4
4
|
export declare function assertIsArray<T>(data: unknown, message?: string): asserts data is T[];
|
|
@@ -25,6 +25,10 @@ export declare function isPropertyExpression(value: unknown): value is PropertyE
|
|
|
25
25
|
* Type guard: narrows `value` to `ValueExpression` when it is an object with `type === "value"`.
|
|
26
26
|
*/
|
|
27
27
|
export declare function isValueExpression(value: unknown): value is ValueExpression;
|
|
28
|
+
/**
|
|
29
|
+
* Type guard: narrows `value` to `CallExpression` when it is an object with `type === "call"`.
|
|
30
|
+
*/
|
|
31
|
+
export declare function isCallExpression(value: unknown): value is CallExpression;
|
|
28
32
|
/**
|
|
29
33
|
* Type guard: narrows `value` to `EmptyExpression` when it is an object with `type === "empty"`.
|
|
30
34
|
*/
|
package/dist/assertions/index.js
CHANGED
|
@@ -3,14 +3,19 @@ var __webpack_modules__ = ({
|
|
|
3
3
|
__webpack_require__.d(__webpack_exports__, {
|
|
4
4
|
t: () => (EXPRESSION_TYPES)
|
|
5
5
|
});
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
|
|
6
|
+
/**
|
|
7
|
+
* A `Record` rather than a list, so adding to `ExpressionType` without adding it here is a compile
|
|
8
|
+
* error. As a list it was not exhaustive, and `call` was silently missing from `isExpression`.
|
|
9
|
+
*/ const EXPRESSION_TYPE_SET = {
|
|
10
|
+
"operator": true,
|
|
11
|
+
"comparator": true,
|
|
12
|
+
"property": true,
|
|
13
|
+
"value": true,
|
|
14
|
+
"call": true,
|
|
15
|
+
"empty": true,
|
|
16
|
+
"not-parsable": true
|
|
17
|
+
};
|
|
18
|
+
const EXPRESSION_TYPES = Object.keys(EXPRESSION_TYPE_SET);
|
|
14
19
|
|
|
15
20
|
|
|
16
21
|
},
|
|
@@ -80,6 +85,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
80
85
|
Ye: () => (assertIsNumber),
|
|
81
86
|
dp: () => (assertDate),
|
|
82
87
|
e3: () => (isPropertyExpression),
|
|
88
|
+
fm: () => (isCallExpression),
|
|
83
89
|
jf: () => (assertIsNotNull),
|
|
84
90
|
nn: () => (assertInstanceOf),
|
|
85
91
|
vg: () => (isOperatorExpression),
|
|
@@ -159,6 +165,11 @@ function isObjectWithType(value) {
|
|
|
159
165
|
*/ function isValueExpression(value) {
|
|
160
166
|
return isObjectWithType(value) && value.type === "value";
|
|
161
167
|
}
|
|
168
|
+
/**
|
|
169
|
+
* Type guard: narrows `value` to `CallExpression` when it is an object with `type === "call"`.
|
|
170
|
+
*/ function isCallExpression(value) {
|
|
171
|
+
return isObjectWithType(value) && value.type === "call";
|
|
172
|
+
}
|
|
162
173
|
/**
|
|
163
174
|
* Type guard: narrows `value` to `EmptyExpression` when it is an object with `type === "empty"`.
|
|
164
175
|
*/ function isEmptyExpression(value) {
|
|
@@ -178,6 +189,7 @@ var __webpack_exports__assertIsArray = __webpack_exports__.ys;
|
|
|
178
189
|
var __webpack_exports__assertIsNotNull = __webpack_exports__.jf;
|
|
179
190
|
var __webpack_exports__assertIsNumber = __webpack_exports__.Ye;
|
|
180
191
|
var __webpack_exports__assertString = __webpack_exports__.Cv;
|
|
192
|
+
var __webpack_exports__isCallExpression = __webpack_exports__.fm;
|
|
181
193
|
var __webpack_exports__isComparatorExpression = __webpack_exports__.xH;
|
|
182
194
|
var __webpack_exports__isEmptyExpression = __webpack_exports__.wL;
|
|
183
195
|
var __webpack_exports__isExpression = __webpack_exports__.BH;
|
|
@@ -185,6 +197,6 @@ var __webpack_exports__isNotParsableExpression = __webpack_exports__.AF;
|
|
|
185
197
|
var __webpack_exports__isOperatorExpression = __webpack_exports__.vg;
|
|
186
198
|
var __webpack_exports__isPropertyExpression = __webpack_exports__.e3;
|
|
187
199
|
var __webpack_exports__isValueExpression = __webpack_exports__.S6;
|
|
188
|
-
export { __webpack_exports__assertDate as assertDate, __webpack_exports__assertInstanceOf as assertInstanceOf, __webpack_exports__assertIsArray as assertIsArray, __webpack_exports__assertIsNotNull as assertIsNotNull, __webpack_exports__assertIsNumber as assertIsNumber, __webpack_exports__assertString as assertString, __webpack_exports__isComparatorExpression as isComparatorExpression, __webpack_exports__isEmptyExpression as isEmptyExpression, __webpack_exports__isExpression as isExpression, __webpack_exports__isNotParsableExpression as isNotParsableExpression, __webpack_exports__isOperatorExpression as isOperatorExpression, __webpack_exports__isPropertyExpression as isPropertyExpression, __webpack_exports__isValueExpression as isValueExpression };
|
|
200
|
+
export { __webpack_exports__assertDate as assertDate, __webpack_exports__assertInstanceOf as assertInstanceOf, __webpack_exports__assertIsArray as assertIsArray, __webpack_exports__assertIsNotNull as assertIsNotNull, __webpack_exports__assertIsNumber as assertIsNumber, __webpack_exports__assertString as assertString, __webpack_exports__isCallExpression as isCallExpression, __webpack_exports__isComparatorExpression as isComparatorExpression, __webpack_exports__isEmptyExpression as isEmptyExpression, __webpack_exports__isExpression as isExpression, __webpack_exports__isNotParsableExpression as isNotParsableExpression, __webpack_exports__isOperatorExpression as isOperatorExpression, __webpack_exports__isPropertyExpression as isPropertyExpression, __webpack_exports__isValueExpression as isValueExpression };
|
|
189
201
|
|
|
190
202
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assertions/index.js","sources":["webpack://@routier/core/./src/expressions/constants.ts","webpack://@routier/core/./src/utilities/dates.ts","webpack://@routier/core/webpack/runtime/define_property_getters","webpack://@routier/core/webpack/runtime/has_own_property","webpack://@routier/core/./src/assertions/index.ts"],"sourcesContent":["import { ExpressionType } from \"./types\";\n\
|
|
1
|
+
{"version":3,"file":"assertions/index.js","sources":["webpack://@routier/core/./src/expressions/constants.ts","webpack://@routier/core/./src/utilities/dates.ts","webpack://@routier/core/webpack/runtime/define_property_getters","webpack://@routier/core/webpack/runtime/has_own_property","webpack://@routier/core/./src/assertions/index.ts"],"sourcesContent":["import { ExpressionType } from \"./types\";\n\n/**\n * A `Record` rather than a list, so adding to `ExpressionType` without adding it here is a compile\n * error. As a list it was not exhaustive, and `call` was silently missing from `isExpression`.\n */\nconst EXPRESSION_TYPE_SET: Record<ExpressionType, true> = {\n \"operator\": true,\n \"comparator\": true,\n \"property\": true,\n \"value\": true,\n \"call\": true,\n \"empty\": true,\n \"not-parsable\": true,\n};\n\nexport const EXPRESSION_TYPES = Object.keys(EXPRESSION_TYPE_SET) as ExpressionType[];\n","export const isDate = (data: unknown): data is Date => {\n if (data == null) {\n return false;\n }\n\n if (typeof data !== \"object\") {\n return false;\n }\n\n return data instanceof Date;\n}","__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n }\n }\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","import { EXPRESSION_TYPES } from \"../expressions/constants\";\nimport { CallExpression, ComparatorExpression, EmptyExpression, Expression, ExpressionType, NotParsableExpression, OperatorExpression, PropertyExpression, ValueExpression } from \"../expressions/types\";\nimport { isDate } from \"../utilities\";\n\nexport function assertDate(data: unknown): asserts data is Date {\n if (isDate(data) === false) {\n throw new TypeError('Value is not a Date');\n }\n}\n\nexport function assertIsNotNull<T>(data: T | null | undefined, message?: string | (() => string)): asserts data is NonNullable<T> {\n if (data == null) {\n if (message == null) {\n throw new TypeError('Assertion failed, data is null');\n }\n\n if (typeof message === \"string\") {\n throw new TypeError(message);\n }\n\n throw new TypeError(message());\n }\n}\n\nexport function assertIsArray<T>(data: unknown, message?: string): asserts data is T[] {\n if (!Array.isArray(data)) {\n throw new TypeError(message ?? 'Assertion failed, data is not of type Array');\n }\n}\n\nexport function assertString(data: unknown, message?: string): asserts data is string {\n if (typeof data !== \"string\") {\n throw new TypeError(message ?? 'Assertion failed, data is not of type String');\n }\n}\n\nexport function assertInstanceOf<T extends new (...args: any[]) => any>(value: unknown, Instance: T): asserts value is T {\n if (value instanceof Instance) {\n return;\n }\n\n if (value != null && typeof value === \"object\" && \"constructor\" in value) {\n throw new TypeError(`value is not instance of type. Type: ${value.constructor.name}`);\n }\n\n throw new TypeError(`value is not instance of type`);\n}\n\nexport function assertIsNumber(value: unknown): asserts value is number {\n if (typeof value !== \"number\") {\n throw new TypeError(\"value is not of type `number`\");\n }\n}\n\n\nfunction isObjectWithType(value: unknown): value is Record<\"type\", unknown> {\n return typeof value === \"object\" && value !== null && \"type\" in value;\n}\n\n/**\n * Type guard: narrows `value` to `Expression` when it is an object with a valid `type` property.\n */\nexport function isExpression(value: unknown): value is Expression {\n return isObjectWithType(value) && EXPRESSION_TYPES.includes(value.type as ExpressionType);\n}\n\n/**\n * Type guard: narrows `value` to `OperatorExpression` when it is an object with `type === \"operator\"`.\n */\nexport function isOperatorExpression(value: unknown): value is OperatorExpression {\n return isObjectWithType(value) && value.type === \"operator\";\n}\n\n/**\n * Type guard: narrows `value` to `ComparatorExpression` when it is an object with `type === \"comparator\"`.\n */\nexport function isComparatorExpression(value: unknown): value is ComparatorExpression {\n return isObjectWithType(value) && value.type === \"comparator\";\n}\n\n/**\n * Type guard: narrows `value` to `PropertyExpression` when it is an object with `type === \"property\"`.\n */\nexport function isPropertyExpression(value: unknown): value is PropertyExpression {\n return isObjectWithType(value) && value.type === \"property\";\n}\n\n/**\n * Type guard: narrows `value` to `ValueExpression` when it is an object with `type === \"value\"`.\n */\nexport function isValueExpression(value: unknown): value is ValueExpression {\n return isObjectWithType(value) && value.type === \"value\";\n}\n\n/**\n * Type guard: narrows `value` to `CallExpression` when it is an object with `type === \"call\"`.\n */\nexport function isCallExpression(value: unknown): value is CallExpression {\n return isObjectWithType(value) && value.type === \"call\";\n}\n\n/**\n * Type guard: narrows `value` to `EmptyExpression` when it is an object with `type === \"empty\"`.\n */\nexport function isEmptyExpression(value: unknown): value is EmptyExpression {\n return isObjectWithType(value) && value.type === \"empty\";\n}\n\n/**\n * Type guard: narrows `value` to `NotParsableExpression` when it is an object with `type === \"not-parsable\"`.\n */\nexport function isNotParsableExpression(value: unknown): value is NotParsableExpression {\n return isObjectWithType(value) && value.type === \"not-parsable\";\n}"],"names":["EXPRESSION_TYPE_SET","EXPRESSION_TYPES","Object","isDate","data","Date","assertDate","TypeError","assertIsNotNull","message","assertIsArray","Array","assertString","assertInstanceOf","value","Instance","assertIsNumber","isObjectWithType","isExpression","isOperatorExpression","isComparatorExpression","isPropertyExpression","isValueExpression","isCallExpression","isEmptyExpression","isNotParsableExpression"],"mappings":";;;;;AAEA;;;CAGC,GACD,MAAMA,sBAAoD;IACtD,YAAY;IACZ,cAAc;IACd,YAAY;IACZ,SAAS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CAAC,6BAA6B,CAAC;AACvD;AAEO,SAASS,eAAeF,KAAc;IACzC,IAAI,OAAOA,UAAU,UAAU;QAC3B,MAAM,IAAIP,UAAU;IACxB;AACJ;AAGA,SAASU,iBAAiBH,KAAc;IACpC,OAAO,OAAOA,UAAU,YAAYA,UAAU,QAAQ,UAAUA;AACpE;AAEA;;CAEC,GACM,SAASI,aAAaJ,KAAc;IACvC,OAAOG,iBAAiBH,UAAUb,kFAAyB,CAACa,MAAM,IAAI;AAC1E;AAEA;;CAEC,GACM,SAASK,qBAAqBL,KAAc;IAC/C,OAAOG,iBAAiBH,UAAUA,MAAM,IAAI,KAAK;AACrD;AAEA;;CAEC,GACM,SAASM,uBAAuBN,KAAc;IACjD,OAAOG,iBAAiBH,UAAUA,MAAM,IAAI,KAAK;AACrD;AAEA;;CAEC,GACM,SAASO,qBAAqBP,KAAc;IAC/C,OAAOG,iBAAiBH,UAAUA,MAAM,IAAI,KAAK;AACrD;AAEA;;CAEC,GACM,SAASQ,kBAAkBR,KAAc;IAC5C,OAAOG,iBAAiBH,UAAUA,MAAM,IAAI,KAAK;AACrD;AAEA;;CAEC,GACM,SAASS,iBAAiBT,KAAc;IAC3C,OAAOG,iBAAiBH,UAAUA,MAAM,IAAI,KAAK;AACrD;AAEA;;CAEC,GACM,SAASU,kBAAkBV,KAAc;IAC5C,OAAOG,iBAAiBH,UAAUA,MAAM,IAAI,KAAK;AACrD;AAEA;;CAEC,GACM,SAASW,wBAAwBX,KAAc;IAClD,OAAOG,iBAAiBH,UAAUA,MAAM,IAAI,KAAK;AACrD"}
|
package/dist/codegen/blocks.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CreateBlockOptions } from "./types";
|
|
2
2
|
type Line = string | Block;
|
|
3
|
-
type Param = {
|
|
3
|
+
export type Param = {
|
|
4
4
|
name: string;
|
|
5
5
|
value: any;
|
|
6
6
|
};
|
|
@@ -100,6 +100,11 @@ export declare class FunctionFactoryBuilder extends ContainerBlock {
|
|
|
100
100
|
getParameters(): Param[];
|
|
101
101
|
createParameter(value: any): Param;
|
|
102
102
|
parameters(...params: Param[]): this;
|
|
103
|
+
/**
|
|
104
|
+
* Adds a factory parameter carrying `value` and returns its name, for generated code to
|
|
105
|
+
* refer to. See `CodeBuilder.bind` for why values travel this way.
|
|
106
|
+
*/
|
|
107
|
+
bind(value: unknown): string;
|
|
103
108
|
return(): this;
|
|
104
109
|
appendBody(line: string): this;
|
|
105
110
|
invoke(): any;
|
|
@@ -133,6 +138,17 @@ export declare class IfBuilder extends ContainerBlock {
|
|
|
133
138
|
toString(): string;
|
|
134
139
|
}
|
|
135
140
|
export declare class CodeBuilder extends ContainerBlock {
|
|
141
|
+
private _bindings;
|
|
142
|
+
/**
|
|
143
|
+
* Makes `value` available to the generated function under the returned name.
|
|
144
|
+
*
|
|
145
|
+
* Generated code must never reach a runtime value by its source name or by pasting its
|
|
146
|
+
* source text: a minifier renames the declaration and cannot see inside the generated
|
|
147
|
+
* string, and pasted source loses the scope it closed over (#40, #46). A binding is passed
|
|
148
|
+
* in as a real value when the function is compiled, so it survives any bundler.
|
|
149
|
+
*/
|
|
150
|
+
bind(value: unknown, name?: string): string;
|
|
151
|
+
getBindings(): Param[];
|
|
136
152
|
toString(): string;
|
|
137
153
|
}
|
|
138
154
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CodeBuilder,
|
|
1
|
+
import { CodeBuilder, IfBuilder, SlotBlock } from '..';
|
|
2
2
|
import { PropertyInfo } from '../../schema/PropertyInfo';
|
|
3
3
|
import { SlotPath } from '../SlotPath';
|
|
4
4
|
export interface IHandler {
|
|
@@ -65,8 +65,16 @@ export declare abstract class PropertyInfoHandler implements IHandler {
|
|
|
65
65
|
*/
|
|
66
66
|
protected buildEnrichedObjectSlotPath(property: PropertyInfo<any>, base: SlotPath): SlotPath;
|
|
67
67
|
protected setEnrichedProperty(property: PropertyInfo<any>, root: CodeBuilder): void;
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
68
|
+
/**
|
|
69
|
+
* Binds a function the schema author supplied (a default, a computed, a serializer) into
|
|
70
|
+
* the generated code and returns the expression that calls it with `args`.
|
|
71
|
+
*
|
|
72
|
+
* The function is passed in by value rather than pasted in as source text. Pasted source
|
|
73
|
+
* loses the scope it was written in, so a default that called an imported helper threw, and
|
|
74
|
+
* it had to be parsed back apart, which only worked for arrows: a bundler that lowers arrows
|
|
75
|
+
* to `function` expressions, or renames what they refer to, broke every schema (#46).
|
|
76
|
+
*/
|
|
77
|
+
protected emitBoundCall(target: {
|
|
78
|
+
bind(value: unknown): string;
|
|
79
|
+
}, fn: Function, args: string[]): string;
|
|
72
80
|
}
|
package/dist/codegen/index.cjs
CHANGED
|
@@ -358,6 +358,14 @@ class FunctionFactoryBuilder extends ContainerBlock {
|
|
|
358
358
|
this._params.push(...params);
|
|
359
359
|
return this;
|
|
360
360
|
}
|
|
361
|
+
/**
|
|
362
|
+
* Adds a factory parameter carrying `value` and returns its name, for generated code to
|
|
363
|
+
* refer to. See `CodeBuilder.bind` for why values travel this way.
|
|
364
|
+
*/ bind(value) {
|
|
365
|
+
const parameter = this.createParameter(value);
|
|
366
|
+
this._params.push(parameter);
|
|
367
|
+
return parameter.name;
|
|
368
|
+
}
|
|
361
369
|
return() {
|
|
362
370
|
this._return = true;
|
|
363
371
|
return this;
|
|
@@ -473,6 +481,26 @@ class IfBuilder extends ContainerBlock {
|
|
|
473
481
|
}
|
|
474
482
|
}
|
|
475
483
|
class CodeBuilder extends ContainerBlock {
|
|
484
|
+
_bindings = [];
|
|
485
|
+
/**
|
|
486
|
+
* Makes `value` available to the generated function under the returned name.
|
|
487
|
+
*
|
|
488
|
+
* Generated code must never reach a runtime value by its source name or by pasting its
|
|
489
|
+
* source text: a minifier renames the declaration and cannot see inside the generated
|
|
490
|
+
* string, and pasted source loses the scope it closed over (#40, #46). A binding is passed
|
|
491
|
+
* in as a real value when the function is compiled, so it survives any bundler.
|
|
492
|
+
*/ bind(value, name = `binding${this._bindings.length}`) {
|
|
493
|
+
this._bindings.push({
|
|
494
|
+
name,
|
|
495
|
+
value
|
|
496
|
+
});
|
|
497
|
+
return name;
|
|
498
|
+
}
|
|
499
|
+
getBindings() {
|
|
500
|
+
return [
|
|
501
|
+
...this._bindings
|
|
502
|
+
];
|
|
503
|
+
}
|
|
476
504
|
toString() {
|
|
477
505
|
return this._lines.map((line)=>typeof line === 'string' ? this.indent(line) : line.toString()).join('\n\n');
|
|
478
506
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codegen/index.cjs","sources":["webpack://@routier/core/./src/codegen/blocks.ts","webpack://@routier/core/./src/utilities/uuid.ts","webpack://@routier/core/webpack/runtime/define_property_getters","webpack://@routier/core/webpack/runtime/has_own_property","webpack://@routier/core/webpack/runtime/make_namespace_object","webpack://@routier/core/./src/codegen/index.ts"],"sourcesContent":["import { uuid } from \"../utilities\";\nimport { CreateBlockOptions } from \"./types\";\n\ntype Line = string | Block;\n\ntype Param = { name: string, value: any };\ntype GenericParam = { name: string, callName: string };\n\n\nexport abstract class Block {\n readonly name: string;\n protected _lines: Line[] = [];\n protected _indent: string = \"\";\n protected _parent?: Block;\n\n constructor(name?: string, parentIndent: string = \"\", parent?: Block) {\n this.name = name != null ? name : uuid();\n this._indent = parentIndent;\n this._parent = parent;\n }\n\n indexOf(name: string) {\n return this._lines.findIndex(w => typeof w !== \"string\" && w.name === name);\n }\n\n getLines() {\n return this._lines;\n }\n\n getParent() {\n return this._parent;\n }\n\n getIndent() {\n return this._indent;\n }\n\n setLines(lines: Line[]) {\n this._lines = lines;\n }\n\n setParent(block: Block) {\n this._parent = block;\n }\n\n setIndent(indent: string) {\n this._indent = indent;\n }\n\n getOrDefault<T extends Block>(name: string): T | undefined {\n\n if (name.includes('.') === false) {\n return this._lines.find(w => typeof w !== \"string\" && w.name === name) as T | undefined;\n }\n\n const split = name.match(/(\\[[^\\]]+\\]|[^.]+)/g);\n // oxlint-disable-next-line no-this-alias\n let result: Block = this;\n\n for (const item of split) {\n const found = result._lines.find(w => typeof w !== \"string\" && w.name === item) as Block;\n\n if (found == null) {\n\n if (\"getValue\" in result && result.getValue instanceof Block && result.getValue.name === item) {\n result = result.getValue;\n continue;\n }\n\n return undefined;\n }\n\n result = found;\n }\n\n return result as T;\n }\n\n get<T extends Block>(name: string): T {\n const found = this.getOrDefault(name);\n\n if (found == null) {\n throw new Error(`Error finding code block for given path. Path: ${name}`)\n }\n\n return found as T;\n }\n\n has(name: string) {\n return this._lines.some(w => typeof w !== \"string\" && w.name === name);\n }\n\n remove(name: string) {\n this._lines = this._lines.filter(x => typeof x === \"object\" && typeof x.name === \"string\" && x.name !== name);\n }\n\n replace(name: string, line: Block) {\n\n const foundIndex = this._lines.findIndex(x => typeof x !== \"string\" && x.name === name);\n\n if (foundIndex === -1) {\n throw new Error(`Cannot find line by name. Name: ${name}`)\n }\n\n const found = this._lines[foundIndex];\n\n if (typeof found === \"string\") {\n // Replace the line\n this._lines.splice(foundIndex, 1, line);\n return;\n }\n\n line.setLines(found.getLines());\n line.setIndent(found.getIndent());\n line.setParent(found.getParent());\n\n // Replace the line\n this._lines.splice(foundIndex, 1, line);\n\n return;\n }\n\n protected push(line: Line) {\n this._lines.push(line);\n }\n\n protected unshift(line: Line) {\n this._lines.unshift(line);\n }\n\n protected indent(text: string): string {\n return this._indent + text;\n }\n\n\n abstract toString(): string;\n}\n\nexport abstract class ContainerBlock extends Block {\n if(condition: string, options?: CreateBlockOptions): IfBuilder {\n const builder = new IfBuilder(condition, options?.name, this._indent + \" \", this);\n if (options?.unshift === true) {\n this.unshift(builder);\n } else {\n this.push(builder);\n }\n\n return builder;\n }\n\n raw(raw: string, options?: CreateBlockOptions): RawBuilder {\n const builder = new RawBuilder(raw, options?.name, this._indent + \" \", this);\n this.push(builder);\n return builder;\n }\n\n function(name?: string, options?: CreateBlockOptions): FunctionBuilder {\n const builder = new FunctionBuilder(name, options?.name, this._indent + \" \", this);\n this.push(builder);\n return builder;\n }\n\n factory(name?: string, options?: CreateBlockOptions): FunctionFactoryBuilder {\n const builder = new FunctionFactoryBuilder(name, options?.name, this._indent + \" \", this);\n this.push(builder);\n return builder;\n }\n\n variable(declaration: string, options?: CreateBlockOptions): VariableBuilder {\n const builder = new VariableBuilder(declaration, options?.name, this._indent + \" \", this);\n this.push(builder);\n return builder;\n }\n\n assign(variableName: string, options?: CreateBlockOptions): AssignmentBuilder {\n const builder = new AssignmentBuilder(variableName, options?.name, this._indent + \" \", this);\n this.push(builder);\n return builder;\n }\n\n object(options?: CreateBlockOptions): ObjectBuilder {\n const builder = new ObjectBuilder(options?.name, this._indent + \" \", this);\n this.push(builder);\n return builder;\n }\n\n slot(name: string) {\n const builder = new SlotBlock(name, this._indent + \" \", this);\n this.push(builder);\n return builder;\n }\n\n array(accessor: string, options?: CreateBlockOptions) {\n const builder = new ArrayBuilder(accessor, options?.name, this._indent + \" \", this);\n this.push(builder);\n return builder;\n }\n}\n\nexport type StringType = \"template\" | \"default\";\n\nexport class StringBuilder extends Block {\n\n private _type: StringType;\n\n constructor(type: StringType, name?: string, parentIndent: string = \"\", parent?: Block) {\n super(name, parentIndent, parent);\n this._type = type;\n }\n\n append(value: string) {\n this._lines.push(value);\n return this;\n }\n\n toString() {\n if (this._type === \"template\") {\n return \"`\" + this._lines.join(\"\") + \"`\";\n }\n\n return `\"${this._lines.join(\"\")}\"`;\n }\n}\n\nexport class SlotBlock extends ContainerBlock {\n\n constructor(name: string, parentIndent: string = \"\", parent?: Block) {\n super(name, parentIndent, parent);\n }\n\n insert(line: string | Block) {\n this.push(line);\n }\n\n toString(): string {\n return this._lines.map(line =>\n typeof line === 'string'\n ? this.indent(line)\n : line.toString()\n ).join('\\n\\n');\n }\n}\n\nexport class AssignmentBuilder extends ContainerBlock {\n protected _variableName: string;\n protected _value?: string | Block;\n protected _functionName?: string;\n\n get getValue() {\n return this._value;\n }\n\n constructor(variableName: string, name?: string, parentIndent: string = \"\", parent?: Block) {\n super(name, parentIndent, parent);\n this._variableName = variableName;\n }\n\n value(value: string): this {\n this._value = value;\n return this;\n }\n\n and(and: string, options?: CreateBlockOptions): this {\n this._value = new AndBuilder(and, options?.name, this._indent, this);\n return this;\n }\n\n object(options?: CreateBlockOptions): ObjectBuilder {\n const objectBuilder = new ObjectBuilder(options?.name, this._indent, this);\n\n this._value = objectBuilder;\n\n return objectBuilder;\n }\n\n call(functionName: string, options?: CreateBlockOptions): ObjectBuilder {\n this._functionName = functionName;\n const objectBuilder = new ObjectBuilder(options?.name, this._indent, this);\n\n this._value = objectBuilder;\n\n return objectBuilder;\n }\n\n string(type: StringType, options?: CreateBlockOptions) {\n const stringBuilder = new StringBuilder(type, options?.name, this._indent, this);\n\n this._value = stringBuilder;\n\n return stringBuilder;\n }\n\n toString(): string {\n\n if (this._value == null) {\n throw new Error(\"Value cannot be null for AssignmentBuilder Builder\")\n }\n\n if (this._functionName != null) {\n return this.indent(`${this._variableName} = ${this._functionName}(${this._value.toString()});`);\n }\n\n return this.indent(`${this._variableName} = ${this._value.toString()};`);\n }\n}\n\nexport class AndBuilder extends ContainerBlock {\n\n constructor(and: string, name?: string, parentIndent: string = \"\", parent?: Block) {\n super(name, parentIndent, parent);\n this._lines.push(and);\n }\n\n and(and: string) {\n this._lines.push(and);\n }\n\n toString() {\n return this._lines.join(\" && \")\n }\n}\n\nexport class VariableBuilder extends Block {\n protected _declaration: string;\n protected _value?: string | Block;\n\n get getValue() {\n return this._value;\n }\n\n constructor(declaration: string, name?: string, parentIndent: string = \"\", parent?: Block) {\n super(name, parentIndent, parent);\n this._declaration = declaration;\n }\n\n value(value: string): this {\n this._value = value;\n return this;\n }\n\n object(options?: CreateBlockOptions): ObjectBuilder {\n const objectBuilder = new ObjectBuilder(options?.name, this._indent, this);\n\n this._value = objectBuilder;\n\n return objectBuilder;\n }\n\n array(accessor: string, options?: CreateBlockOptions): ArrayBuilder {\n const arrayBuilder = new ArrayBuilder(accessor, options?.name, this._indent, this);\n\n this._value = arrayBuilder;\n\n return arrayBuilder;\n }\n\n toString(): string {\n\n if (this._value == null) {\n throw new Error(\"Value cannot be null for Variable Builder\")\n }\n\n return this.indent(`const ${this._declaration} = ${this._value.toString()};`);\n }\n}\n\nexport class RawBuilder extends ContainerBlock {\n private _raw: string;\n\n constructor(raw: string, name?: string, parentIndent: string = \"\", parent?: Block) {\n super(name, parentIndent, parent);\n this._raw = raw;\n }\n\n toString(): string {\n return `${this._raw}\\n`;\n }\n}\n\nexport class ObjectBuilder extends Block {\n\n property(line: string) {\n // Add comma to previous line if it exists and isn't a brace\n if (this._lines.length > 0) {\n const lastLine = this._lines[this._lines.length - 1];\n if (typeof lastLine === 'string' && !lastLine.endsWith(\"{\")) {\n this._lines[this._lines.length - 1] = lastLine + \",\";\n }\n }\n this.push(line);\n return this;\n }\n\n nested(propertyName: string, name?: string) {\n const builder = new ObjectBuilder(name, this._indent + \" \", this);\n // Add comma to previous line if it exists and isn't a brace\n if (this._lines.length > 0) {\n const lastLine = this._lines[this._lines.length - 1];\n if (typeof lastLine === 'string' && !lastLine.endsWith(\"{\")) {\n this._lines[this._lines.length - 1] = lastLine + \",\";\n }\n }\n // Add the property name and opening brace\n this.push(`${propertyName}: {`);\n // Add the nested builder\n this.push(builder);\n // Add the closing brace\n this.push(\"}\");\n return builder;\n }\n\n toString(): string {\n // Check if this is a nested object's content\n const isNestedContent = this._parent instanceof ObjectBuilder;\n\n if (isNestedContent) {\n // For nested object contents, just return the lines\n return this._lines.map(line =>\n typeof line === 'string'\n ? this.indent(\" \" + line)\n : line.toString()\n ).join('\\n');\n }\n\n // For root objects, include the braces\n const lines = [\n \"{\",\n ...this._lines.map(line =>\n typeof line === 'string'\n ? this.indent(\" \" + line)\n : line.toString()\n ),\n this.indent(\"}\")\n ];\n\n return lines.join('\\n');\n }\n}\n\nexport class FunctionFactoryBuilder extends ContainerBlock {\n private _functionName?: string;\n private _params: Param[] = [];\n private _return: boolean = false;\n\n constructor(functionName?: string, sectionName?: string, parentIndent: string = \"\", parent?: Block) {\n super(sectionName, parentIndent, parent);\n this._functionName = functionName;\n }\n\n getParameters() {\n return [...this._params];\n }\n\n createParameter(value: any): Param {\n const name = `injection${this._params.length}`;\n return {\n name,\n value\n }\n }\n\n parameters(...params: Param[]): this {\n this._params.push(...params);\n return this;\n }\n\n return() {\n this._return = true;\n return this;\n }\n\n appendBody(line: string): this {\n this.push(line);\n return this;\n }\n\n invoke() {\n const body = this.toString();\n const parameterNames = this._getParameterNames();\n const parameterValues = this._getParameterValues();\n\n return Function(...parameterNames, body)(...parameterValues)\n }\n\n private _getParameterNames() {\n return this._params.map(w => w.name).join(\", \")\n }\n\n private _getParameterValues() {\n return this._params.map(w => w.value);\n }\n\n toString(): string {\n const r = this._return === true ? \"return \" : \"\";\n const signature = this._functionName\n ? `${r}function ${this._functionName}(${this._getParameterNames()})`\n : `${r}function(${this._getParameterNames()})`;\n\n const lines = [\n this.indent(signature + \" {\"),\n ...this._lines.map(line =>\n typeof line === 'string'\n ? this.indent(\" \" + line)\n : line.toString()\n ),\n this.indent(\"}\")\n ];\n\n return lines.join('\\n');\n }\n}\n\nexport class FunctionBuilder extends ContainerBlock {\n private _functionName?: string;\n private _params: (string | GenericParam)[] = [];\n private _return: boolean = false;\n\n constructor(functionName?: string, sectionName?: string, parentIndent: string = \"\", parent?: Block) {\n super(sectionName, parentIndent, parent);\n this._functionName = functionName;\n }\n\n parameters(...params: (string | GenericParam)[]): this {\n this._params.push(...params);\n return this;\n }\n\n return() {\n this._return = true;\n return this;\n }\n\n appendBody(line: string): this {\n this.push(line);\n return this;\n }\n\n private _getParameterKeys() {\n return this._params.map(w => typeof w === \"object\" ? w.name : w).join(\", \")\n }\n\n toCallable() {\n return `${this._functionName}(${this._params.map(w => typeof w === \"object\" ? w.callName : w).join(\", \")})`\n }\n\n toString(): string {\n const r = this._return === true ? \"return \" : \"\";\n const signature = this._functionName\n ? `${r}function ${this._functionName}(${this._getParameterKeys()})`\n : `${r}function(${this._getParameterKeys()})`;\n\n const lines = [\n this.indent(signature + \" {\"),\n ...this._lines.map(line =>\n typeof line === 'string'\n ? this.indent(\" \" + line)\n : line.toString()\n ),\n this.indent(\"}\")\n ];\n\n return lines.join('\\n');\n }\n}\n\nexport class ArrayBuilder extends Block {\n constructor(accessor: string, name?: string, parentIndent: string = \"\", parent?: Block) {\n super(name, parentIndent, parent);\n this._lines.push(accessor);\n }\n\n append(accessor: string) {\n this._lines.push(accessor);\n return this;\n }\n\n toString() {\n return `[${this._lines.join(\",\")}]`\n }\n}\n\nexport class IfBuilder extends ContainerBlock {\n private _condition: string;\n\n constructor(condition: string, name?: string, parentIndent: string = \"\", parent?: Block) {\n super(name, parentIndent, parent);\n this._condition = condition;\n }\n\n appendBody(line: string): this {\n this.push(line);\n return this;\n }\n\n unshiftBody(line: string): this {\n this.unshift(line);\n return this;\n }\n\n private stringifyLine(line: Line) {\n if (typeof line === 'string') {\n return this.indent(\" \" + line);\n }\n\n if (Array.isArray(line)) {\n return line.join(\"\\r\\n\")\n }\n\n return line.toString();\n }\n\n toString(): string {\n // need to join with \\r\\n because we are not an object\n const lines = [\n this.indent(`if (${this._condition}) {`),\n this._lines.map(x => this.stringifyLine(x)).join(\"\\r\\n\"),\n this.indent(\"}\")\n ]\n\n return lines.join(\"\\n\\n\");\n }\n}\n\nexport class CodeBuilder extends ContainerBlock {\n\n toString(): string {\n return this._lines.map(line =>\n typeof line === 'string'\n ? this.indent(line)\n : line.toString()\n ).join('\\n\\n');\n }\n}","export const uuid = (length: number = 16): string => {\n const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\n const charLength = chars.length;\n let result = '';\n\n for (let i = 0; i < length; i++) {\n result += chars[Math.random() * charLength | 0];\n }\n return result;\n}\n\nconst HEX_CHARS = '0123456789abcdef';\nconst UUID_TEMPLATE = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx';\n\nconst hasCrypto =\n typeof crypto !== 'undefined' && typeof crypto.getRandomValues === 'function';\n\nconst hasRandomUUID =\n typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function';\n\nexport const uuidv4 = (): string => {\n if (hasRandomUUID) {\n return crypto.randomUUID();\n }\n\n return uuidv4Fallback();\n};\n\nconst uuidv4Fallback = (): string => {\n let randomBytes: Uint8Array | null = null;\n if (hasCrypto) {\n randomBytes = crypto.getRandomValues(new Uint8Array(16));\n }\n\n let byteIndex = 0;\n let uuid = '';\n\n for (let i = 0; i < UUID_TEMPLATE.length; i++) {\n const c = UUID_TEMPLATE[i];\n if (c === '-') {\n uuid += '-';\n continue;\n }\n\n let r: number;\n if (hasCrypto && randomBytes) {\n // Each byte gives two hex digits (nibbles)\n r =\n (i % 2 === 0\n ? randomBytes[byteIndex] >> 4\n : randomBytes[byteIndex++] & 0x0f);\n } else {\n r = Math.floor(Math.random() * 16);\n }\n\n if (c === 'x') {\n uuid += HEX_CHARS[r];\n } else if (c === 'y') {\n // Variant bits: 8, 9, A, or B\n uuid += HEX_CHARS[(r & 0x3) | 0x8];\n } else if (c === '4') {\n uuid += '4';\n }\n }\n\n return uuid;\n};\n","__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n }\n }\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","export * from './blocks';\nexport * from './types';"],"names":["uuid","Block","name","parentIndent","parent","w","lines","block","indent","split","result","item","found","undefined","Error","x","line","foundIndex","text","ContainerBlock","condition","options","builder","IfBuilder","raw","RawBuilder","FunctionBuilder","FunctionFactoryBuilder","declaration","VariableBuilder","variableName","AssignmentBuilder","ObjectBuilder","SlotBlock","accessor","ArrayBuilder","StringBuilder","type","value","and","AndBuilder","objectBuilder","functionName","stringBuilder","arrayBuilder","lastLine","propertyName","isNestedContent","sectionName","params","body","parameterNames","parameterValues","Function","r","signature","Array","CodeBuilder","length","chars","charLength","i","Math","HEX_CHARS","UUID_TEMPLATE","hasCrypto","crypto","hasRandomUUID","uuidv4","uuidv4Fallback","randomBytes","Uint8Array","byteIndex","c"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAoC;AAS7B,MAAeC;IACT,KAAa;IACZ,SAAiB,EAAE,CAAC;IACpB,UAAkB,GAAG;IACrB,QAAgB;IAE1B,YAAYC,IAAa,EAAEC,eAAuB,EAAE,EAAEC,MAAc,CAAE;QAClE,IAAI,CAAC,IAAI,GAAGF,QAAQ,OAAOA,OAAOF,4CAAIA;QACtC,IAAI,CAAC,OAAO,GAAGG;QACf,IAAI,CAAC,OAAO,GAAGC;IACnB;IAEA,QAAQF,IAAY,EAAE;QAClB,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS,CAACG,CAAAA,IAAK,OAAOA,MAAM,YAAYA,EAAE,IAAI,KAAKH;IAC1E;IAEA,WAAW;QACP,OAAO,IAAI,CAAC,MAAM;IACtB;IAEA,YAAY;QACR,OAAO,IAAI,CAAC,OAAO;IACvB;IAEA,YAAY;QACR,OAAO,IAAI,CAAC,OAAO;IACvB;IAEA,SAASI,KAAa,EAAE;QACpB,IAAI,CAAC,MAAM,GAAGA;IAClB;IAEA,UAAUC,KAAY,EAAE;QACpB,IAAI,CAAC,OAAO,GAAGA;IACnB;IAEA,UAAUC,MAAc,EAAE;QACtB,IAAI,CAAC,OAAO,GAAGA;IACnB;IAEA,aAA8BN,IAAY,EAAiB;QAEvD,IAAIA,KAAK,QAAQ,CAAC,SAAS,OAAO;YAC9B,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAACG,CAAAA,IAAK,OAAOA,MAAM,YAAYA,EAA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
|
|
1
|
+
{"version":3,"file":"codegen/index.cjs","sources":["webpack://@routier/core/./src/codegen/blocks.ts","webpack://@routier/core/./src/utilities/uuid.ts","webpack://@routier/core/webpack/runtime/define_property_getters","webpack://@routier/core/webpack/runtime/has_own_property","webpack://@routier/core/webpack/runtime/make_namespace_object","webpack://@routier/core/./src/codegen/index.ts"],"sourcesContent":["import { uuid } from \"../utilities\";\nimport { CreateBlockOptions } from \"./types\";\n\ntype Line = string | Block;\n\nexport type Param = { name: string, value: any };\ntype GenericParam = { name: string, callName: string };\n\n\nexport abstract class Block {\n readonly name: string;\n protected _lines: Line[] = [];\n protected _indent: string = \"\";\n protected _parent?: Block;\n\n constructor(name?: string, parentIndent: string = \"\", parent?: Block) {\n this.name = name != null ? name : uuid();\n this._indent = parentIndent;\n this._parent = parent;\n }\n\n indexOf(name: string) {\n return this._lines.findIndex(w => typeof w !== \"string\" && w.name === name);\n }\n\n getLines() {\n return this._lines;\n }\n\n getParent() {\n return this._parent;\n }\n\n getIndent() {\n return this._indent;\n }\n\n setLines(lines: Line[]) {\n this._lines = lines;\n }\n\n setParent(block: Block) {\n this._parent = block;\n }\n\n setIndent(indent: string) {\n this._indent = indent;\n }\n\n getOrDefault<T extends Block>(name: string): T | undefined {\n\n if (name.includes('.') === false) {\n return this._lines.find(w => typeof w !== \"string\" && w.name === name) as T | undefined;\n }\n\n const split = name.match(/(\\[[^\\]]+\\]|[^.]+)/g);\n // oxlint-disable-next-line no-this-alias\n let result: Block = this;\n\n for (const item of split) {\n const found = result._lines.find(w => typeof w !== \"string\" && w.name === item) as Block;\n\n if (found == null) {\n\n if (\"getValue\" in result && result.getValue instanceof Block && result.getValue.name === item) {\n result = result.getValue;\n continue;\n }\n\n return undefined;\n }\n\n result = found;\n }\n\n return result as T;\n }\n\n get<T extends Block>(name: string): T {\n const found = this.getOrDefault(name);\n\n if (found == null) {\n throw new Error(`Error finding code block for given path. Path: ${name}`)\n }\n\n return found as T;\n }\n\n has(name: string) {\n return this._lines.some(w => typeof w !== \"string\" && w.name === name);\n }\n\n remove(name: string) {\n this._lines = this._lines.filter(x => typeof x === \"object\" && typeof x.name === \"string\" && x.name !== name);\n }\n\n replace(name: string, line: Block) {\n\n const foundIndex = this._lines.findIndex(x => typeof x !== \"string\" && x.name === name);\n\n if (foundIndex === -1) {\n throw new Error(`Cannot find line by name. Name: ${name}`)\n }\n\n const found = this._lines[foundIndex];\n\n if (typeof found === \"string\") {\n // Replace the line\n this._lines.splice(foundIndex, 1, line);\n return;\n }\n\n line.setLines(found.getLines());\n line.setIndent(found.getIndent());\n line.setParent(found.getParent());\n\n // Replace the line\n this._lines.splice(foundIndex, 1, line);\n\n return;\n }\n\n protected push(line: Line) {\n this._lines.push(line);\n }\n\n protected unshift(line: Line) {\n this._lines.unshift(line);\n }\n\n protected indent(text: string): string {\n return this._indent + text;\n }\n\n\n abstract toString(): string;\n}\n\nexport abstract class ContainerBlock extends Block {\n if(condition: string, options?: CreateBlockOptions): IfBuilder {\n const builder = new IfBuilder(condition, options?.name, this._indent + \" \", this);\n if (options?.unshift === true) {\n this.unshift(builder);\n } else {\n this.push(builder);\n }\n\n return builder;\n }\n\n raw(raw: string, options?: CreateBlockOptions): RawBuilder {\n const builder = new RawBuilder(raw, options?.name, this._indent + \" \", this);\n this.push(builder);\n return builder;\n }\n\n function(name?: string, options?: CreateBlockOptions): FunctionBuilder {\n const builder = new FunctionBuilder(name, options?.name, this._indent + \" \", this);\n this.push(builder);\n return builder;\n }\n\n factory(name?: string, options?: CreateBlockOptions): FunctionFactoryBuilder {\n const builder = new FunctionFactoryBuilder(name, options?.name, this._indent + \" \", this);\n this.push(builder);\n return builder;\n }\n\n variable(declaration: string, options?: CreateBlockOptions): VariableBuilder {\n const builder = new VariableBuilder(declaration, options?.name, this._indent + \" \", this);\n this.push(builder);\n return builder;\n }\n\n assign(variableName: string, options?: CreateBlockOptions): AssignmentBuilder {\n const builder = new AssignmentBuilder(variableName, options?.name, this._indent + \" \", this);\n this.push(builder);\n return builder;\n }\n\n object(options?: CreateBlockOptions): ObjectBuilder {\n const builder = new ObjectBuilder(options?.name, this._indent + \" \", this);\n this.push(builder);\n return builder;\n }\n\n slot(name: string) {\n const builder = new SlotBlock(name, this._indent + \" \", this);\n this.push(builder);\n return builder;\n }\n\n array(accessor: string, options?: CreateBlockOptions) {\n const builder = new ArrayBuilder(accessor, options?.name, this._indent + \" \", this);\n this.push(builder);\n return builder;\n }\n}\n\nexport type StringType = \"template\" | \"default\";\n\nexport class StringBuilder extends Block {\n\n private _type: StringType;\n\n constructor(type: StringType, name?: string, parentIndent: string = \"\", parent?: Block) {\n super(name, parentIndent, parent);\n this._type = type;\n }\n\n append(value: string) {\n this._lines.push(value);\n return this;\n }\n\n toString() {\n if (this._type === \"template\") {\n return \"`\" + this._lines.join(\"\") + \"`\";\n }\n\n return `\"${this._lines.join(\"\")}\"`;\n }\n}\n\nexport class SlotBlock extends ContainerBlock {\n\n constructor(name: string, parentIndent: string = \"\", parent?: Block) {\n super(name, parentIndent, parent);\n }\n\n insert(line: string | Block) {\n this.push(line);\n }\n\n toString(): string {\n return this._lines.map(line =>\n typeof line === 'string'\n ? this.indent(line)\n : line.toString()\n ).join('\\n\\n');\n }\n}\n\nexport class AssignmentBuilder extends ContainerBlock {\n protected _variableName: string;\n protected _value?: string | Block;\n protected _functionName?: string;\n\n get getValue() {\n return this._value;\n }\n\n constructor(variableName: string, name?: string, parentIndent: string = \"\", parent?: Block) {\n super(name, parentIndent, parent);\n this._variableName = variableName;\n }\n\n value(value: string): this {\n this._value = value;\n return this;\n }\n\n and(and: string, options?: CreateBlockOptions): this {\n this._value = new AndBuilder(and, options?.name, this._indent, this);\n return this;\n }\n\n object(options?: CreateBlockOptions): ObjectBuilder {\n const objectBuilder = new ObjectBuilder(options?.name, this._indent, this);\n\n this._value = objectBuilder;\n\n return objectBuilder;\n }\n\n call(functionName: string, options?: CreateBlockOptions): ObjectBuilder {\n this._functionName = functionName;\n const objectBuilder = new ObjectBuilder(options?.name, this._indent, this);\n\n this._value = objectBuilder;\n\n return objectBuilder;\n }\n\n string(type: StringType, options?: CreateBlockOptions) {\n const stringBuilder = new StringBuilder(type, options?.name, this._indent, this);\n\n this._value = stringBuilder;\n\n return stringBuilder;\n }\n\n toString(): string {\n\n if (this._value == null) {\n throw new Error(\"Value cannot be null for AssignmentBuilder Builder\")\n }\n\n if (this._functionName != null) {\n return this.indent(`${this._variableName} = ${this._functionName}(${this._value.toString()});`);\n }\n\n return this.indent(`${this._variableName} = ${this._value.toString()};`);\n }\n}\n\nexport class AndBuilder extends ContainerBlock {\n\n constructor(and: string, name?: string, parentIndent: string = \"\", parent?: Block) {\n super(name, parentIndent, parent);\n this._lines.push(and);\n }\n\n and(and: string) {\n this._lines.push(and);\n }\n\n toString() {\n return this._lines.join(\" && \")\n }\n}\n\nexport class VariableBuilder extends Block {\n protected _declaration: string;\n protected _value?: string | Block;\n\n get getValue() {\n return this._value;\n }\n\n constructor(declaration: string, name?: string, parentIndent: string = \"\", parent?: Block) {\n super(name, parentIndent, parent);\n this._declaration = declaration;\n }\n\n value(value: string): this {\n this._value = value;\n return this;\n }\n\n object(options?: CreateBlockOptions): ObjectBuilder {\n const objectBuilder = new ObjectBuilder(options?.name, this._indent, this);\n\n this._value = objectBuilder;\n\n return objectBuilder;\n }\n\n array(accessor: string, options?: CreateBlockOptions): ArrayBuilder {\n const arrayBuilder = new ArrayBuilder(accessor, options?.name, this._indent, this);\n\n this._value = arrayBuilder;\n\n return arrayBuilder;\n }\n\n toString(): string {\n\n if (this._value == null) {\n throw new Error(\"Value cannot be null for Variable Builder\")\n }\n\n return this.indent(`const ${this._declaration} = ${this._value.toString()};`);\n }\n}\n\nexport class RawBuilder extends ContainerBlock {\n private _raw: string;\n\n constructor(raw: string, name?: string, parentIndent: string = \"\", parent?: Block) {\n super(name, parentIndent, parent);\n this._raw = raw;\n }\n\n toString(): string {\n return `${this._raw}\\n`;\n }\n}\n\nexport class ObjectBuilder extends Block {\n\n property(line: string) {\n // Add comma to previous line if it exists and isn't a brace\n if (this._lines.length > 0) {\n const lastLine = this._lines[this._lines.length - 1];\n if (typeof lastLine === 'string' && !lastLine.endsWith(\"{\")) {\n this._lines[this._lines.length - 1] = lastLine + \",\";\n }\n }\n this.push(line);\n return this;\n }\n\n nested(propertyName: string, name?: string) {\n const builder = new ObjectBuilder(name, this._indent + \" \", this);\n // Add comma to previous line if it exists and isn't a brace\n if (this._lines.length > 0) {\n const lastLine = this._lines[this._lines.length - 1];\n if (typeof lastLine === 'string' && !lastLine.endsWith(\"{\")) {\n this._lines[this._lines.length - 1] = lastLine + \",\";\n }\n }\n // Add the property name and opening brace\n this.push(`${propertyName}: {`);\n // Add the nested builder\n this.push(builder);\n // Add the closing brace\n this.push(\"}\");\n return builder;\n }\n\n toString(): string {\n // Check if this is a nested object's content\n const isNestedContent = this._parent instanceof ObjectBuilder;\n\n if (isNestedContent) {\n // For nested object contents, just return the lines\n return this._lines.map(line =>\n typeof line === 'string'\n ? this.indent(\" \" + line)\n : line.toString()\n ).join('\\n');\n }\n\n // For root objects, include the braces\n const lines = [\n \"{\",\n ...this._lines.map(line =>\n typeof line === 'string'\n ? this.indent(\" \" + line)\n : line.toString()\n ),\n this.indent(\"}\")\n ];\n\n return lines.join('\\n');\n }\n}\n\nexport class FunctionFactoryBuilder extends ContainerBlock {\n private _functionName?: string;\n private _params: Param[] = [];\n private _return: boolean = false;\n\n constructor(functionName?: string, sectionName?: string, parentIndent: string = \"\", parent?: Block) {\n super(sectionName, parentIndent, parent);\n this._functionName = functionName;\n }\n\n getParameters() {\n return [...this._params];\n }\n\n createParameter(value: any): Param {\n const name = `injection${this._params.length}`;\n return {\n name,\n value\n }\n }\n\n parameters(...params: Param[]): this {\n this._params.push(...params);\n return this;\n }\n\n /**\n * Adds a factory parameter carrying `value` and returns its name, for generated code to\n * refer to. See `CodeBuilder.bind` for why values travel this way.\n */\n bind(value: unknown): string {\n const parameter = this.createParameter(value);\n this._params.push(parameter);\n return parameter.name;\n }\n\n return() {\n this._return = true;\n return this;\n }\n\n appendBody(line: string): this {\n this.push(line);\n return this;\n }\n\n invoke() {\n const body = this.toString();\n const parameterNames = this._getParameterNames();\n const parameterValues = this._getParameterValues();\n\n return Function(...parameterNames, body)(...parameterValues)\n }\n\n private _getParameterNames() {\n return this._params.map(w => w.name).join(\", \")\n }\n\n private _getParameterValues() {\n return this._params.map(w => w.value);\n }\n\n toString(): string {\n const r = this._return === true ? \"return \" : \"\";\n const signature = this._functionName\n ? `${r}function ${this._functionName}(${this._getParameterNames()})`\n : `${r}function(${this._getParameterNames()})`;\n\n const lines = [\n this.indent(signature + \" {\"),\n ...this._lines.map(line =>\n typeof line === 'string'\n ? this.indent(\" \" + line)\n : line.toString()\n ),\n this.indent(\"}\")\n ];\n\n return lines.join('\\n');\n }\n}\n\nexport class FunctionBuilder extends ContainerBlock {\n private _functionName?: string;\n private _params: (string | GenericParam)[] = [];\n private _return: boolean = false;\n\n constructor(functionName?: string, sectionName?: string, parentIndent: string = \"\", parent?: Block) {\n super(sectionName, parentIndent, parent);\n this._functionName = functionName;\n }\n\n parameters(...params: (string | GenericParam)[]): this {\n this._params.push(...params);\n return this;\n }\n\n return() {\n this._return = true;\n return this;\n }\n\n appendBody(line: string): this {\n this.push(line);\n return this;\n }\n\n private _getParameterKeys() {\n return this._params.map(w => typeof w === \"object\" ? w.name : w).join(\", \")\n }\n\n toCallable() {\n return `${this._functionName}(${this._params.map(w => typeof w === \"object\" ? w.callName : w).join(\", \")})`\n }\n\n toString(): string {\n const r = this._return === true ? \"return \" : \"\";\n const signature = this._functionName\n ? `${r}function ${this._functionName}(${this._getParameterKeys()})`\n : `${r}function(${this._getParameterKeys()})`;\n\n const lines = [\n this.indent(signature + \" {\"),\n ...this._lines.map(line =>\n typeof line === 'string'\n ? this.indent(\" \" + line)\n : line.toString()\n ),\n this.indent(\"}\")\n ];\n\n return lines.join('\\n');\n }\n}\n\nexport class ArrayBuilder extends Block {\n constructor(accessor: string, name?: string, parentIndent: string = \"\", parent?: Block) {\n super(name, parentIndent, parent);\n this._lines.push(accessor);\n }\n\n append(accessor: string) {\n this._lines.push(accessor);\n return this;\n }\n\n toString() {\n return `[${this._lines.join(\",\")}]`\n }\n}\n\nexport class IfBuilder extends ContainerBlock {\n private _condition: string;\n\n constructor(condition: string, name?: string, parentIndent: string = \"\", parent?: Block) {\n super(name, parentIndent, parent);\n this._condition = condition;\n }\n\n appendBody(line: string): this {\n this.push(line);\n return this;\n }\n\n unshiftBody(line: string): this {\n this.unshift(line);\n return this;\n }\n\n private stringifyLine(line: Line) {\n if (typeof line === 'string') {\n return this.indent(\" \" + line);\n }\n\n if (Array.isArray(line)) {\n return line.join(\"\\r\\n\")\n }\n\n return line.toString();\n }\n\n toString(): string {\n // need to join with \\r\\n because we are not an object\n const lines = [\n this.indent(`if (${this._condition}) {`),\n this._lines.map(x => this.stringifyLine(x)).join(\"\\r\\n\"),\n this.indent(\"}\")\n ]\n\n return lines.join(\"\\n\\n\");\n }\n}\n\nexport class CodeBuilder extends ContainerBlock {\n\n private _bindings: Param[] = [];\n\n /**\n * Makes `value` available to the generated function under the returned name.\n *\n * Generated code must never reach a runtime value by its source name or by pasting its\n * source text: a minifier renames the declaration and cannot see inside the generated\n * string, and pasted source loses the scope it closed over (#40, #46). A binding is passed\n * in as a real value when the function is compiled, so it survives any bundler.\n */\n bind(value: unknown, name: string = `binding${this._bindings.length}`): string {\n this._bindings.push({ name, value });\n return name;\n }\n\n getBindings() {\n return [...this._bindings];\n }\n\n toString(): string {\n return this._lines.map(line =>\n typeof line === 'string'\n ? this.indent(line)\n : line.toString()\n ).join('\\n\\n');\n }\n}","export const uuid = (length: number = 16): string => {\n const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\n const charLength = chars.length;\n let result = '';\n\n for (let i = 0; i < length; i++) {\n result += chars[Math.random() * charLength | 0];\n }\n return result;\n}\n\nconst HEX_CHARS = '0123456789abcdef';\nconst UUID_TEMPLATE = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx';\n\nconst hasCrypto =\n typeof crypto !== 'undefined' && typeof crypto.getRandomValues === 'function';\n\nconst hasRandomUUID =\n typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function';\n\nexport const uuidv4 = (): string => {\n if (hasRandomUUID) {\n return crypto.randomUUID();\n }\n\n return uuidv4Fallback();\n};\n\nconst uuidv4Fallback = (): string => {\n let randomBytes: Uint8Array | null = null;\n if (hasCrypto) {\n randomBytes = crypto.getRandomValues(new Uint8Array(16));\n }\n\n let byteIndex = 0;\n let uuid = '';\n\n for (let i = 0; i < UUID_TEMPLATE.length; i++) {\n const c = UUID_TEMPLATE[i];\n if (c === '-') {\n uuid += '-';\n continue;\n }\n\n let r: number;\n if (hasCrypto && randomBytes) {\n // Each byte gives two hex digits (nibbles)\n r =\n (i % 2 === 0\n ? randomBytes[byteIndex] >> 4\n : randomBytes[byteIndex++] & 0x0f);\n } else {\n r = Math.floor(Math.random() * 16);\n }\n\n if (c === 'x') {\n uuid += HEX_CHARS[r];\n } else if (c === 'y') {\n // Variant bits: 8, 9, A, or B\n uuid += HEX_CHARS[(r & 0x3) | 0x8];\n } else if (c === '4') {\n uuid += '4';\n }\n }\n\n return uuid;\n};\n","__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n }\n }\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","export * from './blocks';\nexport * from './types';"],"names":["uuid","Block","name","parentIndent","parent","w","lines","block","indent","split","result","item","found","undefined","Error","x","line","foundIndex","text","ContainerBlock","condition","options","builder","IfBuilder","raw","RawBuilder","FunctionBuilder","FunctionFactoryBuilder","declaration","VariableBuilder","variableName","AssignmentBuilder","ObjectBuilder","SlotBlock","accessor","ArrayBuilder","StringBuilder","type","value","and","AndBuilder","objectBuilder","functionName","stringBuilder","arrayBuilder","lastLine","propertyName","isNestedContent","sectionName","params","parameter","body","parameterNames","parameterValues","Function","r","signature","Array","CodeBuilder","length","chars","charLength","i","Math","HEX_CHARS","UUID_TEMPLATE","hasCrypto","crypto","hasRandomUUID","uuidv4","uuidv4Fallback","randomBytes","Uint8Array","byteIndex","c"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAoC;AAS7B,MAAeC;IACT,KAAa;IACZ,SAAiB,EAAE,CAAC;IACpB,UAAkB,GAAG;IACrB,QAAgB;IAE1B,YAAYC,IAAa,EAAEC,eAAuB,EAAE,EAAEC,MAAc,CAAE;QAClE,IAAI,CAAC,IAAI,GAAGF,QAAQ,OAAOA,OAAOF,4CAAIA;QACtC,IAAI,CAAC,OAAO,GAAGG;QACf,IAAI,CAAC,OAAO,GAAGC;IACnB;IAEA,QAAQF,IAAY,EAAE;QAClB,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS,CAACG,CAAAA,IAAK,OAAOA,MAAM,YAAYA,EAAE,IAAI,KAAKH;IAC1E;IAEA,WAAW;QACP,OAAO,IAAI,CAAC,MAAM;IACtB;IAEA,YAAY;QACR,OAAO,IAAI,CAAC,OAAO;IACvB;IAEA,YAAY;QACR,OAAO,IAAI,CAAC,OAAO;IACvB;IAEA,SAASI,KAAa,EAAE;QACpB,IAAI,CAAC,MAAM,GAAGA;IAClB;IAEA,UAAUC,KAAY,EAAE;QACpB,IAAI,CAAC,OAAO,GAAGA;IACnB;IAEA,UAAUC,MAAc,EAAE;QACtB,IAAI,CAAC,OAAO,GAAGA;IACnB;IAEA,aAA8BN,IAAY,EAAiB;QAEvD,IAAIA,KAAK,QAAQ,CAAC,SAAS,OA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GAAG;QACzC,OAAO;YACHlB,IAAIQ,KAAK,KAAK,CAACA,KAAK,MAAM,KAAK;QACnC;QAEA,IAAIW,MAAM,KAAK;YACX1E,QAAQgE,SAAS,CAACT,EAAE;QACxB,OAAO,IAAImB,MAAM,KAAK;YAClB,8BAA8B;YAC9B1E,QAAQgE,SAAS,CAAET,IAAI,MAAO,IAAI;QACtC,OAAO,IAAImB,MAAM,KAAK;YAClB1E,QAAQ;QACZ;IACJ;IAEA,OAAOA;AACX;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AClEA;AACA;AACA;AACA,kDAAkD,wCAAwC;AAC1F;AACA;AACA,E;;;;ACNA,wF;;;;ACAA;AACA;AACA;AACA,uDAAuD,iBAAiB;AACxE;AACA,gDAAgD,aAAa;AAC7D,E;;;;;;;;;;;;;;;;;;;;;;;ACNyB;AACD"}
|
package/dist/codegen/index.js
CHANGED
|
@@ -356,6 +356,14 @@ class FunctionFactoryBuilder extends ContainerBlock {
|
|
|
356
356
|
this._params.push(...params);
|
|
357
357
|
return this;
|
|
358
358
|
}
|
|
359
|
+
/**
|
|
360
|
+
* Adds a factory parameter carrying `value` and returns its name, for generated code to
|
|
361
|
+
* refer to. See `CodeBuilder.bind` for why values travel this way.
|
|
362
|
+
*/ bind(value) {
|
|
363
|
+
const parameter = this.createParameter(value);
|
|
364
|
+
this._params.push(parameter);
|
|
365
|
+
return parameter.name;
|
|
366
|
+
}
|
|
359
367
|
return() {
|
|
360
368
|
this._return = true;
|
|
361
369
|
return this;
|
|
@@ -471,6 +479,26 @@ class IfBuilder extends ContainerBlock {
|
|
|
471
479
|
}
|
|
472
480
|
}
|
|
473
481
|
class CodeBuilder extends ContainerBlock {
|
|
482
|
+
_bindings = [];
|
|
483
|
+
/**
|
|
484
|
+
* Makes `value` available to the generated function under the returned name.
|
|
485
|
+
*
|
|
486
|
+
* Generated code must never reach a runtime value by its source name or by pasting its
|
|
487
|
+
* source text: a minifier renames the declaration and cannot see inside the generated
|
|
488
|
+
* string, and pasted source loses the scope it closed over (#40, #46). A binding is passed
|
|
489
|
+
* in as a real value when the function is compiled, so it survives any bundler.
|
|
490
|
+
*/ bind(value, name = `binding${this._bindings.length}`) {
|
|
491
|
+
this._bindings.push({
|
|
492
|
+
name,
|
|
493
|
+
value
|
|
494
|
+
});
|
|
495
|
+
return name;
|
|
496
|
+
}
|
|
497
|
+
getBindings() {
|
|
498
|
+
return [
|
|
499
|
+
...this._bindings
|
|
500
|
+
];
|
|
501
|
+
}
|
|
474
502
|
toString() {
|
|
475
503
|
return this._lines.map((line)=>typeof line === 'string' ? this.indent(line) : line.toString()).join('\n\n');
|
|
476
504
|
}
|