@routier/core 0.2.0 → 0.3.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/LICENSE +21 -0
- package/{readme.md → README.md} +2 -2
- package/dist/assertions/index.cjs +191 -0
- package/dist/assertions/index.cjs.map +1 -0
- package/dist/assertions/index.d.ts +30 -0
- package/dist/assertions/index.js +94 -30
- package/dist/assertions/index.js.map +1 -1
- package/dist/capabilities/index.cjs +820 -0
- package/dist/capabilities/index.cjs.map +1 -0
- package/dist/capabilities/index.js +580 -545
- package/dist/capabilities/index.js.map +1 -1
- package/dist/codegen/handlers/CloneHandlerBuilder.d.ts +10 -1
- package/dist/codegen/handlers/SetHandlerBuilder.d.ts +4 -0
- package/dist/codegen/handlers/clone/CloneArrayHandler.d.ts +3 -0
- package/dist/codegen/handlers/clone/CloneDateHandler.d.ts +13 -0
- package/dist/codegen/handlers/clone/CloneValueHandler.d.ts +16 -0
- package/dist/codegen/handlers/compare/CompareComputedHandler.d.ts +10 -0
- package/dist/codegen/handlers/compare/CompareFunctionHandler.d.ts +10 -0
- package/dist/codegen/handlers/deserialize/DeserializeArrayHandler.d.ts +14 -0
- package/dist/codegen/handlers/enableChangeTracking/EnableChangeTrackingArrayHandler.d.ts +11 -0
- package/dist/codegen/handlers/enrichment/EnrichmentArrayHandler.d.ts +11 -0
- package/dist/codegen/handlers/freeze/FreezeArrayHandler.d.ts +6 -0
- package/dist/codegen/handlers/hash/HashArrayHandler.d.ts +10 -0
- package/dist/codegen/handlers/hash/HashFileHandler.d.ts +24 -0
- package/dist/codegen/handlers/hash/HashObjectHandler.d.ts +10 -0
- package/dist/codegen/handlers/hash/HashTransformHandler.d.ts +23 -0
- package/dist/codegen/handlers/index.d.ts +1 -0
- package/dist/codegen/handlers/merge/MergeArrayHandler.d.ts +20 -0
- package/dist/codegen/handlers/merge/MergeObjectHandler.d.ts +10 -0
- package/dist/codegen/handlers/serialize/SerializeArrayHandler.d.ts +19 -0
- package/dist/codegen/handlers/serialize/SerializeComputedHandler.d.ts +6 -0
- package/dist/codegen/handlers/set/SetComplexHandler.d.ts +6 -0
- package/dist/codegen/handlers/strip/StripComputedHandler.d.ts +10 -0
- package/dist/codegen/handlers/strip/StripFunctionHandler.d.ts +9 -0
- package/dist/codegen/handlers/types.d.ts +55 -1
- package/dist/codegen/index.cjs +618 -0
- package/dist/codegen/index.cjs.map +1 -0
- package/dist/codegen/index.js +100 -127
- package/dist/codegen/index.js.map +1 -1
- package/dist/collections/Changes.d.ts +2 -2
- package/dist/collections/MemoryDataCollection.d.ts +15 -1
- package/dist/collections/TagCollection.d.ts +7 -8
- package/dist/collections/index.cjs +702 -0
- package/dist/collections/index.cjs.map +1 -0
- package/dist/collections/index.js +282 -276
- package/dist/collections/index.js.map +1 -1
- package/dist/errors/OptimisticConcurrencyError.d.ts +18 -0
- package/dist/errors/PluginDestroyedError.d.ts +10 -0
- package/dist/errors/index.cjs +132 -0
- package/dist/errors/index.cjs.map +1 -0
- package/dist/errors/index.d.ts +2 -0
- package/dist/errors/index.js +61 -19
- package/dist/errors/index.js.map +1 -1
- package/dist/expressions/constants.d.ts +2 -0
- package/dist/expressions/evaluate.d.ts +53 -0
- package/dist/expressions/index.cjs +2087 -0
- package/dist/expressions/index.cjs.map +1 -0
- package/dist/expressions/index.d.ts +2 -0
- package/dist/expressions/index.js +1784 -772
- package/dist/expressions/index.js.map +1 -1
- package/dist/expressions/parser.d.ts +19 -0
- package/dist/expressions/types.d.ts +87 -2
- package/dist/expressions/utils.d.ts +1 -2
- package/dist/index.cjs +13925 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.js +12094 -7049
- package/dist/index.js.map +1 -1
- package/dist/performance/index.cjs +217 -0
- package/dist/performance/index.cjs.map +1 -0
- package/dist/performance/index.js +126 -50
- package/dist/performance/index.js.map +1 -1
- package/dist/pipeline/index.cjs +576 -0
- package/dist/pipeline/index.cjs.map +1 -0
- package/dist/pipeline/index.js +229 -156
- package/dist/pipeline/index.js.map +1 -1
- package/dist/plugins/BatchingDbPlugin.d.ts +139 -0
- package/dist/plugins/CacheDbPlugin.d.ts +70 -0
- package/dist/plugins/ConcurrencyDbPlugin.d.ts +78 -0
- package/dist/plugins/EphemeralDataPlugin.d.ts +57 -1
- package/dist/plugins/RetryDbPlugin.d.ts +77 -0
- package/dist/plugins/index.cjs +6104 -0
- package/dist/plugins/index.cjs.map +1 -0
- package/dist/plugins/index.d.ts +5 -1
- package/dist/plugins/index.js +5572 -1491
- package/dist/plugins/index.js.map +1 -1
- package/dist/plugins/query/QueryOptionsCollection.d.ts +22 -0
- package/dist/plugins/query/index.d.ts +2 -0
- package/dist/plugins/query/join.d.ts +210 -0
- package/dist/plugins/query/similarity.d.ts +38 -0
- package/dist/plugins/query/types.d.ts +64 -1
- package/dist/plugins/translators/DataTranslator.d.ts +28 -0
- package/dist/plugins/translators/JsonTranslator.d.ts +27 -0
- package/dist/plugins/translators/SqlTranslator.d.ts +45 -0
- package/dist/plugins/translators/TranslatedArrayValue.d.ts +3 -1
- package/dist/plugins/translators/TranslatedGroupValue.d.ts +3 -1
- package/dist/plugins/translators/TranslatedSingleValue.d.ts +3 -1
- package/dist/plugins/translators/TupleTranslator.d.ts +45 -0
- package/dist/plugins/translators/index.d.ts +1 -0
- package/dist/plugins/translators/types.d.ts +8 -1
- package/dist/plugins/types.d.ts +87 -11
- package/dist/plugins/wire/handler.d.ts +122 -0
- package/dist/plugins/wire/index.d.ts +4 -0
- package/dist/plugins/wire/persist.d.ts +43 -0
- package/dist/plugins/wire/query.d.ts +49 -0
- package/dist/plugins/wire/types.d.ts +123 -0
- package/dist/results/Result.d.ts +2 -2
- package/dist/results/index.cjs +174 -0
- package/dist/results/index.cjs.map +1 -0
- package/dist/results/index.js +29 -44
- package/dist/results/index.js.map +1 -1
- package/dist/schema/PropertyInfo.d.ts +35 -2
- package/dist/schema/SchemaDefinition.d.ts +51 -1
- package/dist/schema/builder.d.ts +35 -1
- package/dist/schema/communication/broadcast.d.ts +17 -1
- package/dist/schema/index.cjs +6911 -0
- package/dist/schema/index.cjs.map +1 -0
- package/dist/schema/index.d.ts +4 -0
- package/dist/schema/index.js +5781 -3973
- package/dist/schema/index.js.map +1 -1
- package/dist/schema/property/base/SchemaBase.d.ts +50 -2
- package/dist/schema/property/modifiers/SchemaDeserialize.d.ts +5 -1
- package/dist/schema/property/modifiers/SchemaForeignKey.d.ts +15 -0
- package/dist/schema/property/modifiers/SchemaKey.d.ts +2 -0
- package/dist/schema/property/modifiers/SchemaNullable.d.ts +15 -1
- package/dist/schema/property/modifiers/SchemaOptional.d.ts +22 -1
- package/dist/schema/property/modifiers/SchemaSearchable.d.ts +34 -0
- package/dist/schema/property/modifiers/SchemaTag.d.ts +27 -0
- package/dist/schema/property/modifiers/SchemaTracked.d.ts +5 -1
- package/dist/schema/property/modifiers/index.d.ts +3 -0
- package/dist/schema/property/types/SchemaArray.d.ts +2 -0
- package/dist/schema/property/types/SchemaBoolean.d.ts +2 -0
- package/dist/schema/property/types/SchemaDate.d.ts +2 -0
- package/dist/schema/property/types/SchemaFile.d.ts +60 -0
- package/dist/schema/property/types/SchemaNumber.d.ts +5 -1
- package/dist/schema/property/types/SchemaObject.d.ts +2 -0
- package/dist/schema/property/types/SchemaString.d.ts +25 -1
- package/dist/schema/property/types/SchemaVector.d.ts +61 -0
- package/dist/schema/property/types/index.d.ts +2 -0
- package/dist/schema/table/SchemaTransform.d.ts +40 -0
- package/dist/schema/table/index.d.ts +1 -0
- package/dist/schema/types.d.ts +200 -32
- package/dist/schema/utils/propertyKind.d.ts +4 -0
- package/dist/schema/utils/standardJsonSchema.d.ts +90 -0
- package/dist/types/index.cjs +23 -0
- package/dist/types/index.cjs.map +1 -0
- package/dist/types/index.js +0 -14
- package/dist/types/index.js.map +1 -1
- package/dist/utilities/functions.d.ts +1 -1
- package/dist/utilities/index.cjs +982 -0
- package/dist/utilities/index.cjs.map +1 -0
- package/dist/utilities/index.js +590 -321
- package/dist/utilities/index.js.map +1 -1
- package/dist/utilities/logger.d.ts +48 -0
- package/package.json +152 -98
- package/dist/collections/Changes.test.d.ts +0 -1
- package/dist/collections/MemoryDataCollection.test.d.ts +0 -1
- package/dist/collections/TagCollection.test.d.ts +0 -1
- package/dist/expressions/parser.test.d.ts +0 -1
- package/dist/expressions/utils.test.d.ts +0 -1
- package/dist/pipeline/SyncronousQueue.test.d.ts +0 -1
- package/dist/pipeline/WorkPipeline.test.d.ts +0 -1
- package/dist/plugins/EphemeralDataPlugin.test.d.ts +0 -1
- package/dist/plugins/query/QueryOptionsCollection.test.d.ts +0 -1
- package/dist/plugins/replication/OptimisticReplicationDbPlugin.d.ts +0 -23
- package/dist/plugins/replication/ReplicationDbPlugin.d.ts +0 -22
- package/dist/plugins/replication/index.d.ts +0 -3
- package/dist/plugins/replication/types.d.ts +0 -5
- package/dist/plugins/translators/JsonTranslator.test.d.ts +0 -1
- package/dist/schema/PropertyInfo.test.d.ts +0 -1
- package/dist/schema/schemaGeneration.test.d.ts +0 -1
- package/dist/schema/testSchemas.test.d.ts +0 -314
- package/dist/utilities/arrays.test.d.ts +0 -1
- package/dist/utilities/dates.test.d.ts +0 -1
- package/dist/utilities/strings.test.d.ts +0 -1
|
@@ -0,0 +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,YAA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K;YACXzE,QAAQ+D,SAAS,CAACT,EAAE;QACxB,OAAO,IAAImB,MAAM,KAAK;YAClB,8BAA8B;YAC9BzE,QAAQ+D,SAAS,CAAET,IAAI,MAAO,IAAI;QACtC,OAAO,IAAImB,MAAM,KAAK;YAClBzE,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
|
@@ -1,36 +1,35 @@
|
|
|
1
1
|
var __webpack_modules__ = ({
|
|
2
|
-
|
|
3
|
-
__webpack_require__.r(__webpack_exports__);
|
|
2
|
+
980(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
4
3
|
__webpack_require__.d(__webpack_exports__, {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
4
|
+
$j: () => (ArrayBuilder),
|
|
5
|
+
E2: () => (SlotBlock),
|
|
6
|
+
Nl: () => (CodeBuilder),
|
|
7
|
+
No: () => (AndBuilder),
|
|
8
|
+
O_: () => (FunctionFactoryBuilder),
|
|
9
|
+
Tl: () => (ObjectBuilder),
|
|
10
|
+
Zm: () => (IfBuilder),
|
|
11
|
+
eB: () => (Block),
|
|
12
|
+
fe: () => (StringBuilder),
|
|
13
|
+
hL: () => (AssignmentBuilder),
|
|
14
|
+
j7: () => (ContainerBlock),
|
|
15
|
+
kF: () => (FunctionBuilder),
|
|
16
|
+
ot: () => (VariableBuilder),
|
|
17
|
+
qY: () => (RawBuilder)
|
|
19
18
|
});
|
|
20
|
-
/* import */ var _utilities__rspack_import_0 = __webpack_require__(
|
|
19
|
+
/* import */ var _utilities__rspack_import_0 = __webpack_require__(618);
|
|
21
20
|
|
|
22
21
|
class Block {
|
|
23
22
|
name;
|
|
24
23
|
_lines = [];
|
|
25
24
|
_indent = "";
|
|
26
25
|
_parent;
|
|
27
|
-
constructor(name, parentIndent = "", parent)
|
|
28
|
-
this.name = name != null ? name : (0,_utilities__rspack_import_0.uuid)();
|
|
26
|
+
constructor(name, parentIndent = "", parent){
|
|
27
|
+
this.name = name != null ? name : (0,_utilities__rspack_import_0/* .uuid */.u)();
|
|
29
28
|
this._indent = parentIndent;
|
|
30
29
|
this._parent = parent;
|
|
31
30
|
}
|
|
32
31
|
indexOf(name) {
|
|
33
|
-
return this._lines.findIndex(w
|
|
32
|
+
return this._lines.findIndex((w)=>typeof w !== "string" && w.name === name);
|
|
34
33
|
}
|
|
35
34
|
getLines() {
|
|
36
35
|
return this._lines;
|
|
@@ -52,12 +51,13 @@ class Block {
|
|
|
52
51
|
}
|
|
53
52
|
getOrDefault(name) {
|
|
54
53
|
if (name.includes('.') === false) {
|
|
55
|
-
return this._lines.find(w
|
|
54
|
+
return this._lines.find((w)=>typeof w !== "string" && w.name === name);
|
|
56
55
|
}
|
|
57
56
|
const split = name.match(/(\[[^\]]+\]|[^.]+)/g);
|
|
57
|
+
// oxlint-disable-next-line no-this-alias
|
|
58
58
|
let result = this;
|
|
59
|
-
for (const item of split)
|
|
60
|
-
const found = result._lines.find(w
|
|
59
|
+
for (const item of split){
|
|
60
|
+
const found = result._lines.find((w)=>typeof w !== "string" && w.name === item);
|
|
61
61
|
if (found == null) {
|
|
62
62
|
if ("getValue" in result && result.getValue instanceof Block && result.getValue.name === item) {
|
|
63
63
|
result = result.getValue;
|
|
@@ -77,13 +77,13 @@ class Block {
|
|
|
77
77
|
return found;
|
|
78
78
|
}
|
|
79
79
|
has(name) {
|
|
80
|
-
return this._lines.some(w
|
|
80
|
+
return this._lines.some((w)=>typeof w !== "string" && w.name === name);
|
|
81
81
|
}
|
|
82
82
|
remove(name) {
|
|
83
|
-
this._lines = this._lines.filter(x
|
|
83
|
+
this._lines = this._lines.filter((x)=>typeof x === "object" && typeof x.name === "string" && x.name !== name);
|
|
84
84
|
}
|
|
85
85
|
replace(name, line) {
|
|
86
|
-
const foundIndex = this._lines.findIndex(x
|
|
86
|
+
const foundIndex = this._lines.findIndex((x)=>typeof x !== "string" && x.name === name);
|
|
87
87
|
if (foundIndex === -1) {
|
|
88
88
|
throw new Error(`Cannot find line by name. Name: ${name}`);
|
|
89
89
|
}
|
|
@@ -115,8 +115,7 @@ class ContainerBlock extends Block {
|
|
|
115
115
|
const builder = new IfBuilder(condition, options?.name, this._indent + " ", this);
|
|
116
116
|
if (options?.unshift === true) {
|
|
117
117
|
this.unshift(builder);
|
|
118
|
-
}
|
|
119
|
-
else {
|
|
118
|
+
} else {
|
|
120
119
|
this.push(builder);
|
|
121
120
|
}
|
|
122
121
|
return builder;
|
|
@@ -164,7 +163,7 @@ class ContainerBlock extends Block {
|
|
|
164
163
|
}
|
|
165
164
|
class StringBuilder extends Block {
|
|
166
165
|
_type;
|
|
167
|
-
constructor(type, name, parentIndent = "", parent)
|
|
166
|
+
constructor(type, name, parentIndent = "", parent){
|
|
168
167
|
super(name, parentIndent, parent);
|
|
169
168
|
this._type = type;
|
|
170
169
|
}
|
|
@@ -180,16 +179,14 @@ class StringBuilder extends Block {
|
|
|
180
179
|
}
|
|
181
180
|
}
|
|
182
181
|
class SlotBlock extends ContainerBlock {
|
|
183
|
-
constructor(name, parentIndent = "", parent)
|
|
182
|
+
constructor(name, parentIndent = "", parent){
|
|
184
183
|
super(name, parentIndent, parent);
|
|
185
184
|
}
|
|
186
185
|
insert(line) {
|
|
187
186
|
this.push(line);
|
|
188
187
|
}
|
|
189
188
|
toString() {
|
|
190
|
-
return this._lines.map(line
|
|
191
|
-
? this.indent(line)
|
|
192
|
-
: line.toString()).join('\n\n');
|
|
189
|
+
return this._lines.map((line)=>typeof line === 'string' ? this.indent(line) : line.toString()).join('\n\n');
|
|
193
190
|
}
|
|
194
191
|
}
|
|
195
192
|
class AssignmentBuilder extends ContainerBlock {
|
|
@@ -199,7 +196,7 @@ class AssignmentBuilder extends ContainerBlock {
|
|
|
199
196
|
get getValue() {
|
|
200
197
|
return this._value;
|
|
201
198
|
}
|
|
202
|
-
constructor(variableName, name, parentIndent = "", parent)
|
|
199
|
+
constructor(variableName, name, parentIndent = "", parent){
|
|
203
200
|
super(name, parentIndent, parent);
|
|
204
201
|
this._variableName = variableName;
|
|
205
202
|
}
|
|
@@ -238,7 +235,7 @@ class AssignmentBuilder extends ContainerBlock {
|
|
|
238
235
|
}
|
|
239
236
|
}
|
|
240
237
|
class AndBuilder extends ContainerBlock {
|
|
241
|
-
constructor(and, name, parentIndent = "", parent)
|
|
238
|
+
constructor(and, name, parentIndent = "", parent){
|
|
242
239
|
super(name, parentIndent, parent);
|
|
243
240
|
this._lines.push(and);
|
|
244
241
|
}
|
|
@@ -255,7 +252,7 @@ class VariableBuilder extends Block {
|
|
|
255
252
|
get getValue() {
|
|
256
253
|
return this._value;
|
|
257
254
|
}
|
|
258
|
-
constructor(declaration, name, parentIndent = "", parent)
|
|
255
|
+
constructor(declaration, name, parentIndent = "", parent){
|
|
259
256
|
super(name, parentIndent, parent);
|
|
260
257
|
this._declaration = declaration;
|
|
261
258
|
}
|
|
@@ -282,7 +279,7 @@ class VariableBuilder extends Block {
|
|
|
282
279
|
}
|
|
283
280
|
class RawBuilder extends ContainerBlock {
|
|
284
281
|
_raw;
|
|
285
|
-
constructor(raw, name, parentIndent = "", parent)
|
|
282
|
+
constructor(raw, name, parentIndent = "", parent){
|
|
286
283
|
super(name, parentIndent, parent);
|
|
287
284
|
this._raw = raw;
|
|
288
285
|
}
|
|
@@ -324,16 +321,12 @@ class ObjectBuilder extends Block {
|
|
|
324
321
|
const isNestedContent = this._parent instanceof ObjectBuilder;
|
|
325
322
|
if (isNestedContent) {
|
|
326
323
|
// For nested object contents, just return the lines
|
|
327
|
-
return this._lines.map(line
|
|
328
|
-
? this.indent(" " + line)
|
|
329
|
-
: line.toString()).join('\n');
|
|
324
|
+
return this._lines.map((line)=>typeof line === 'string' ? this.indent(" " + line) : line.toString()).join('\n');
|
|
330
325
|
}
|
|
331
326
|
// For root objects, include the braces
|
|
332
327
|
const lines = [
|
|
333
328
|
"{",
|
|
334
|
-
...this._lines.map(line
|
|
335
|
-
? this.indent(" " + line)
|
|
336
|
-
: line.toString()),
|
|
329
|
+
...this._lines.map((line)=>typeof line === 'string' ? this.indent(" " + line) : line.toString()),
|
|
337
330
|
this.indent("}")
|
|
338
331
|
];
|
|
339
332
|
return lines.join('\n');
|
|
@@ -343,12 +336,14 @@ class FunctionFactoryBuilder extends ContainerBlock {
|
|
|
343
336
|
_functionName;
|
|
344
337
|
_params = [];
|
|
345
338
|
_return = false;
|
|
346
|
-
constructor(functionName, sectionName, parentIndent = "", parent)
|
|
339
|
+
constructor(functionName, sectionName, parentIndent = "", parent){
|
|
347
340
|
super(sectionName, parentIndent, parent);
|
|
348
341
|
this._functionName = functionName;
|
|
349
342
|
}
|
|
350
343
|
getParameters() {
|
|
351
|
-
return [
|
|
344
|
+
return [
|
|
345
|
+
...this._params
|
|
346
|
+
];
|
|
352
347
|
}
|
|
353
348
|
createParameter(value) {
|
|
354
349
|
const name = `injection${this._params.length}`;
|
|
@@ -376,21 +371,17 @@ class FunctionFactoryBuilder extends ContainerBlock {
|
|
|
376
371
|
return Function(...parameterNames, body)(...parameterValues);
|
|
377
372
|
}
|
|
378
373
|
_getParameterNames() {
|
|
379
|
-
return this._params.map(w
|
|
374
|
+
return this._params.map((w)=>w.name).join(", ");
|
|
380
375
|
}
|
|
381
376
|
_getParameterValues() {
|
|
382
|
-
return this._params.map(w
|
|
377
|
+
return this._params.map((w)=>w.value);
|
|
383
378
|
}
|
|
384
379
|
toString() {
|
|
385
380
|
const r = this._return === true ? "return " : "";
|
|
386
|
-
const signature = this._functionName
|
|
387
|
-
? `${r}function ${this._functionName}(${this._getParameterNames()})`
|
|
388
|
-
: `${r}function(${this._getParameterNames()})`;
|
|
381
|
+
const signature = this._functionName ? `${r}function ${this._functionName}(${this._getParameterNames()})` : `${r}function(${this._getParameterNames()})`;
|
|
389
382
|
const lines = [
|
|
390
383
|
this.indent(signature + " {"),
|
|
391
|
-
...this._lines.map(line
|
|
392
|
-
? this.indent(" " + line)
|
|
393
|
-
: line.toString()),
|
|
384
|
+
...this._lines.map((line)=>typeof line === 'string' ? this.indent(" " + line) : line.toString()),
|
|
394
385
|
this.indent("}")
|
|
395
386
|
];
|
|
396
387
|
return lines.join('\n');
|
|
@@ -400,7 +391,7 @@ class FunctionBuilder extends ContainerBlock {
|
|
|
400
391
|
_functionName;
|
|
401
392
|
_params = [];
|
|
402
393
|
_return = false;
|
|
403
|
-
constructor(functionName, sectionName, parentIndent = "", parent)
|
|
394
|
+
constructor(functionName, sectionName, parentIndent = "", parent){
|
|
404
395
|
super(sectionName, parentIndent, parent);
|
|
405
396
|
this._functionName = functionName;
|
|
406
397
|
}
|
|
@@ -417,28 +408,24 @@ class FunctionBuilder extends ContainerBlock {
|
|
|
417
408
|
return this;
|
|
418
409
|
}
|
|
419
410
|
_getParameterKeys() {
|
|
420
|
-
return this._params.map(w
|
|
411
|
+
return this._params.map((w)=>typeof w === "object" ? w.name : w).join(", ");
|
|
421
412
|
}
|
|
422
413
|
toCallable() {
|
|
423
|
-
return `${this._functionName}(${this._params.map(w
|
|
414
|
+
return `${this._functionName}(${this._params.map((w)=>typeof w === "object" ? w.callName : w).join(", ")})`;
|
|
424
415
|
}
|
|
425
416
|
toString() {
|
|
426
417
|
const r = this._return === true ? "return " : "";
|
|
427
|
-
const signature = this._functionName
|
|
428
|
-
? `${r}function ${this._functionName}(${this._getParameterKeys()})`
|
|
429
|
-
: `${r}function(${this._getParameterKeys()})`;
|
|
418
|
+
const signature = this._functionName ? `${r}function ${this._functionName}(${this._getParameterKeys()})` : `${r}function(${this._getParameterKeys()})`;
|
|
430
419
|
const lines = [
|
|
431
420
|
this.indent(signature + " {"),
|
|
432
|
-
...this._lines.map(line
|
|
433
|
-
? this.indent(" " + line)
|
|
434
|
-
: line.toString()),
|
|
421
|
+
...this._lines.map((line)=>typeof line === 'string' ? this.indent(" " + line) : line.toString()),
|
|
435
422
|
this.indent("}")
|
|
436
423
|
];
|
|
437
424
|
return lines.join('\n');
|
|
438
425
|
}
|
|
439
426
|
}
|
|
440
427
|
class ArrayBuilder extends Block {
|
|
441
|
-
constructor(accessor, name, parentIndent = "", parent)
|
|
428
|
+
constructor(accessor, name, parentIndent = "", parent){
|
|
442
429
|
super(name, parentIndent, parent);
|
|
443
430
|
this._lines.push(accessor);
|
|
444
431
|
}
|
|
@@ -452,7 +439,7 @@ class ArrayBuilder extends Block {
|
|
|
452
439
|
}
|
|
453
440
|
class IfBuilder extends ContainerBlock {
|
|
454
441
|
_condition;
|
|
455
|
-
constructor(condition, name, parentIndent = "", parent)
|
|
442
|
+
constructor(condition, name, parentIndent = "", parent){
|
|
456
443
|
super(name, parentIndent, parent);
|
|
457
444
|
this._condition = condition;
|
|
458
445
|
}
|
|
@@ -477,7 +464,7 @@ class IfBuilder extends ContainerBlock {
|
|
|
477
464
|
// need to join with \r\n because we are not an object
|
|
478
465
|
const lines = [
|
|
479
466
|
this.indent(`if (${this._condition}) {`),
|
|
480
|
-
this._lines.map(x
|
|
467
|
+
this._lines.map((x)=>this.stringifyLine(x)).join("\r\n"),
|
|
481
468
|
this.indent("}")
|
|
482
469
|
];
|
|
483
470
|
return lines.join("\n\n");
|
|
@@ -485,25 +472,21 @@ class IfBuilder extends ContainerBlock {
|
|
|
485
472
|
}
|
|
486
473
|
class CodeBuilder extends ContainerBlock {
|
|
487
474
|
toString() {
|
|
488
|
-
return this._lines.map(line
|
|
489
|
-
? this.indent(line)
|
|
490
|
-
: line.toString()).join('\n\n');
|
|
475
|
+
return this._lines.map((line)=>typeof line === 'string' ? this.indent(line) : line.toString()).join('\n\n');
|
|
491
476
|
}
|
|
492
477
|
}
|
|
493
478
|
|
|
494
479
|
|
|
495
480
|
},
|
|
496
|
-
|
|
497
|
-
__webpack_require__.r(__webpack_exports__);
|
|
481
|
+
618(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
498
482
|
__webpack_require__.d(__webpack_exports__, {
|
|
499
|
-
|
|
500
|
-
uuidv4: () => (uuidv4)
|
|
483
|
+
u: () => (uuid)
|
|
501
484
|
});
|
|
502
|
-
const uuid = (length = 16)
|
|
485
|
+
const uuid = (length = 16)=>{
|
|
503
486
|
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
|
504
487
|
const charLength = chars.length;
|
|
505
488
|
let result = '';
|
|
506
|
-
for
|
|
489
|
+
for(let i = 0; i < length; i++){
|
|
507
490
|
result += chars[Math.random() * charLength | 0];
|
|
508
491
|
}
|
|
509
492
|
return result;
|
|
@@ -511,14 +494,21 @@ const uuid = (length = 16) => {
|
|
|
511
494
|
const HEX_CHARS = '0123456789abcdef';
|
|
512
495
|
const UUID_TEMPLATE = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx';
|
|
513
496
|
const hasCrypto = typeof crypto !== 'undefined' && typeof crypto.getRandomValues === 'function';
|
|
514
|
-
const
|
|
497
|
+
const hasRandomUUID = typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function';
|
|
498
|
+
const uuidv4 = ()=>{
|
|
499
|
+
if (hasRandomUUID) {
|
|
500
|
+
return crypto.randomUUID();
|
|
501
|
+
}
|
|
502
|
+
return uuidv4Fallback();
|
|
503
|
+
};
|
|
504
|
+
const uuidv4Fallback = ()=>{
|
|
515
505
|
let randomBytes = null;
|
|
516
506
|
if (hasCrypto) {
|
|
517
507
|
randomBytes = crypto.getRandomValues(new Uint8Array(16));
|
|
518
508
|
}
|
|
519
509
|
let byteIndex = 0;
|
|
520
510
|
let uuid = '';
|
|
521
|
-
for
|
|
511
|
+
for(let i = 0; i < UUID_TEMPLATE.length; i++){
|
|
522
512
|
const c = UUID_TEMPLATE[i];
|
|
523
513
|
if (c === '-') {
|
|
524
514
|
uuid += '-';
|
|
@@ -527,22 +517,16 @@ const uuidv4 = () => {
|
|
|
527
517
|
let r;
|
|
528
518
|
if (hasCrypto && randomBytes) {
|
|
529
519
|
// Each byte gives two hex digits (nibbles)
|
|
530
|
-
r =
|
|
531
|
-
|
|
532
|
-
? randomBytes[byteIndex] >> 4
|
|
533
|
-
: randomBytes[byteIndex++] & 0x0f);
|
|
534
|
-
}
|
|
535
|
-
else {
|
|
520
|
+
r = i % 2 === 0 ? randomBytes[byteIndex] >> 4 : randomBytes[byteIndex++] & 0x0f;
|
|
521
|
+
} else {
|
|
536
522
|
r = Math.floor(Math.random() * 16);
|
|
537
523
|
}
|
|
538
524
|
if (c === 'x') {
|
|
539
525
|
uuid += HEX_CHARS[r];
|
|
540
|
-
}
|
|
541
|
-
else if (c === 'y') {
|
|
526
|
+
} else if (c === 'y') {
|
|
542
527
|
// Variant bits: 8, 9, A, or B
|
|
543
|
-
uuid += HEX_CHARS[
|
|
544
|
-
}
|
|
545
|
-
else if (c === '4') {
|
|
528
|
+
uuid += HEX_CHARS[r & 0x3 | 0x8];
|
|
529
|
+
} else if (c === '4') {
|
|
546
530
|
uuid += '4';
|
|
547
531
|
}
|
|
548
532
|
}
|
|
@@ -590,56 +574,45 @@ __webpack_require__.d = (exports, definition) => {
|
|
|
590
574
|
(() => {
|
|
591
575
|
__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
592
576
|
})();
|
|
593
|
-
// webpack/runtime/make_namespace_object
|
|
594
|
-
(() => {
|
|
595
|
-
// define __esModule on exports
|
|
596
|
-
__webpack_require__.r = (exports) => {
|
|
597
|
-
if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
598
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
599
|
-
}
|
|
600
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
601
|
-
};
|
|
602
|
-
})();
|
|
603
577
|
var __webpack_exports__ = {};
|
|
604
578
|
// This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk.
|
|
605
579
|
(() => {
|
|
606
|
-
__webpack_require__.r(__webpack_exports__);
|
|
607
580
|
__webpack_require__.d(__webpack_exports__, {
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
581
|
+
$j: () => (/* reexport safe */ _blocks__rspack_import_0.$j),
|
|
582
|
+
E2: () => (/* reexport safe */ _blocks__rspack_import_0.E2),
|
|
583
|
+
Nl: () => (/* reexport safe */ _blocks__rspack_import_0.Nl),
|
|
584
|
+
No: () => (/* reexport safe */ _blocks__rspack_import_0.No),
|
|
585
|
+
O_: () => (/* reexport safe */ _blocks__rspack_import_0.O_),
|
|
586
|
+
Tl: () => (/* reexport safe */ _blocks__rspack_import_0.Tl),
|
|
587
|
+
Zm: () => (/* reexport safe */ _blocks__rspack_import_0.Zm),
|
|
588
|
+
eB: () => (/* reexport safe */ _blocks__rspack_import_0.eB),
|
|
589
|
+
fe: () => (/* reexport safe */ _blocks__rspack_import_0.fe),
|
|
590
|
+
hL: () => (/* reexport safe */ _blocks__rspack_import_0.hL),
|
|
591
|
+
j7: () => (/* reexport safe */ _blocks__rspack_import_0.j7),
|
|
592
|
+
kF: () => (/* reexport safe */ _blocks__rspack_import_0.kF),
|
|
593
|
+
ot: () => (/* reexport safe */ _blocks__rspack_import_0.ot),
|
|
594
|
+
qY: () => (/* reexport safe */ _blocks__rspack_import_0.qY)
|
|
622
595
|
});
|
|
623
|
-
/* import */ var _blocks__rspack_import_0 = __webpack_require__(
|
|
596
|
+
/* import */ var _blocks__rspack_import_0 = __webpack_require__(980);
|
|
624
597
|
|
|
625
598
|
|
|
626
599
|
|
|
627
600
|
})();
|
|
628
601
|
|
|
629
|
-
var __webpack_exports__AndBuilder = __webpack_exports__.
|
|
630
|
-
var __webpack_exports__ArrayBuilder = __webpack_exports__
|
|
631
|
-
var __webpack_exports__AssignmentBuilder = __webpack_exports__.
|
|
632
|
-
var __webpack_exports__Block = __webpack_exports__.
|
|
633
|
-
var __webpack_exports__CodeBuilder = __webpack_exports__.
|
|
634
|
-
var __webpack_exports__ContainerBlock = __webpack_exports__.
|
|
635
|
-
var __webpack_exports__FunctionBuilder = __webpack_exports__.
|
|
636
|
-
var __webpack_exports__FunctionFactoryBuilder = __webpack_exports__.
|
|
637
|
-
var __webpack_exports__IfBuilder = __webpack_exports__.
|
|
638
|
-
var __webpack_exports__ObjectBuilder = __webpack_exports__.
|
|
639
|
-
var __webpack_exports__RawBuilder = __webpack_exports__.
|
|
640
|
-
var __webpack_exports__SlotBlock = __webpack_exports__.
|
|
641
|
-
var __webpack_exports__StringBuilder = __webpack_exports__.
|
|
642
|
-
var __webpack_exports__VariableBuilder = __webpack_exports__.
|
|
602
|
+
var __webpack_exports__AndBuilder = __webpack_exports__.No;
|
|
603
|
+
var __webpack_exports__ArrayBuilder = __webpack_exports__.$j;
|
|
604
|
+
var __webpack_exports__AssignmentBuilder = __webpack_exports__.hL;
|
|
605
|
+
var __webpack_exports__Block = __webpack_exports__.eB;
|
|
606
|
+
var __webpack_exports__CodeBuilder = __webpack_exports__.Nl;
|
|
607
|
+
var __webpack_exports__ContainerBlock = __webpack_exports__.j7;
|
|
608
|
+
var __webpack_exports__FunctionBuilder = __webpack_exports__.kF;
|
|
609
|
+
var __webpack_exports__FunctionFactoryBuilder = __webpack_exports__.O_;
|
|
610
|
+
var __webpack_exports__IfBuilder = __webpack_exports__.Zm;
|
|
611
|
+
var __webpack_exports__ObjectBuilder = __webpack_exports__.Tl;
|
|
612
|
+
var __webpack_exports__RawBuilder = __webpack_exports__.qY;
|
|
613
|
+
var __webpack_exports__SlotBlock = __webpack_exports__.E2;
|
|
614
|
+
var __webpack_exports__StringBuilder = __webpack_exports__.fe;
|
|
615
|
+
var __webpack_exports__VariableBuilder = __webpack_exports__.ot;
|
|
643
616
|
export { __webpack_exports__AndBuilder as AndBuilder, __webpack_exports__ArrayBuilder as ArrayBuilder, __webpack_exports__AssignmentBuilder as AssignmentBuilder, __webpack_exports__Block as Block, __webpack_exports__CodeBuilder as CodeBuilder, __webpack_exports__ContainerBlock as ContainerBlock, __webpack_exports__FunctionBuilder as FunctionBuilder, __webpack_exports__FunctionFactoryBuilder as FunctionFactoryBuilder, __webpack_exports__IfBuilder as IfBuilder, __webpack_exports__ObjectBuilder as ObjectBuilder, __webpack_exports__RawBuilder as RawBuilder, __webpack_exports__SlotBlock as SlotBlock, __webpack_exports__StringBuilder as StringBuilder, __webpack_exports__VariableBuilder as VariableBuilder };
|
|
644
617
|
|
|
645
618
|
//# sourceMappingURL=index.js.map
|