@fern-api/typescript-dynamic-snippets 0.0.5 → 0.0.6
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/cjs/DynamicSnippetsGenerator.cjs +70 -18
- package/cjs/EndpointSnippetGenerator.cjs +70 -18
- package/cjs/context/DynamicSnippetsGeneratorContext.cjs +70 -18
- package/cjs/context/DynamicTypeLiteralMapper.cjs +70 -18
- package/cjs/context/FilePropertyMapper.cjs +70 -18
- package/cjs/index.cjs +70 -18
- package/esm/DynamicSnippetsGenerator.js +7 -7
- package/esm/EndpointSnippetGenerator.js +3 -3
- package/esm/{chunk-K6P3GMIJ.js → chunk-37WY6L3Q.js} +1 -1
- package/esm/{chunk-ZHKZ5MWW.js → chunk-6Y2IOBCK.js} +2 -2
- package/esm/{chunk-QMEM6UIZ.js → chunk-KUITDN45.js} +2 -2
- package/esm/{chunk-5AHCFZX2.js → chunk-MR7ZAFRL.js} +4 -4
- package/esm/{chunk-VZ6REHK2.js → chunk-PLZLTFT4.js} +1 -1
- package/esm/{chunk-APAANCUR.js → chunk-TKT54OF7.js} +4 -4
- package/esm/{chunk-SGEN5HN3.js → chunk-WPDO6IRW.js} +70 -18
- package/esm/context/DynamicSnippetsGeneratorContext.js +5 -5
- package/esm/context/DynamicTypeLiteralMapper.js +3 -3
- package/esm/context/FilePropertyMapper.js +2 -2
- package/esm/index.js +7 -7
- package/package.json +1 -1
|
@@ -2674,6 +2674,20 @@ ${indent}`);
|
|
|
2674
2674
|
}
|
|
2675
2675
|
};
|
|
2676
2676
|
|
|
2677
|
+
// ../../browser-compatible-base/lib/ast/AbstractFormatter.js
|
|
2678
|
+
init_process();
|
|
2679
|
+
init_buffer();
|
|
2680
|
+
var AbstractFormatter = class {
|
|
2681
|
+
};
|
|
2682
|
+
var NopFormatter = class extends AbstractFormatter {
|
|
2683
|
+
async format(content) {
|
|
2684
|
+
return content;
|
|
2685
|
+
}
|
|
2686
|
+
formatSync(content) {
|
|
2687
|
+
return content;
|
|
2688
|
+
}
|
|
2689
|
+
};
|
|
2690
|
+
|
|
2677
2691
|
// ../../browser-compatible-base/lib/dynamic-snippets/index.js
|
|
2678
2692
|
init_process();
|
|
2679
2693
|
init_buffer();
|
|
@@ -3255,18 +3269,27 @@ init_buffer();
|
|
|
3255
3269
|
init_process();
|
|
3256
3270
|
init_buffer();
|
|
3257
3271
|
|
|
3272
|
+
// ../ast/lib/ast/core/TypeScriptFile.js
|
|
3273
|
+
init_process();
|
|
3274
|
+
init_buffer();
|
|
3275
|
+
|
|
3258
3276
|
// ../ast/lib/ast/core/Writer.js
|
|
3259
3277
|
init_process();
|
|
3260
3278
|
init_buffer();
|
|
3261
3279
|
var Writer = class extends AbstractWriter {
|
|
3262
|
-
constructor({ customConfig }) {
|
|
3280
|
+
constructor({ customConfig, formatter }) {
|
|
3263
3281
|
super();
|
|
3282
|
+
/* Custom generator config */
|
|
3264
3283
|
__publicField(this, "customConfig");
|
|
3284
|
+
/* Formatter used to format Go source files */
|
|
3285
|
+
__publicField(this, "formatter");
|
|
3286
|
+
/* Import statements */
|
|
3265
3287
|
__publicField(this, "imports", {});
|
|
3266
3288
|
__publicField(this, "defaultImports", {});
|
|
3267
3289
|
__publicField(this, "starImportAliases", {});
|
|
3268
3290
|
__publicField(this, "starImportAliasesInverse", {});
|
|
3269
3291
|
this.customConfig = customConfig;
|
|
3292
|
+
this.formatter = formatter != null ? formatter : new NopFormatter();
|
|
3270
3293
|
}
|
|
3271
3294
|
/**
|
|
3272
3295
|
* Adds the given import under its module name.
|
|
@@ -3344,7 +3367,38 @@ var Writer = class extends AbstractWriter {
|
|
|
3344
3367
|
throw new Error(`Attempted to use alias ${reference2.importFrom.starImportAlias} for more than one module in the same file`);
|
|
3345
3368
|
}
|
|
3346
3369
|
}
|
|
3347
|
-
|
|
3370
|
+
};
|
|
3371
|
+
|
|
3372
|
+
// ../ast/lib/ast/core/TypeScriptFile.js
|
|
3373
|
+
var TypeScriptFile = class extends Writer {
|
|
3374
|
+
constructor({ customConfig, formatter }) {
|
|
3375
|
+
super({ customConfig, formatter });
|
|
3376
|
+
}
|
|
3377
|
+
async toString() {
|
|
3378
|
+
const content = this.getContent();
|
|
3379
|
+
if (this.formatter != null) {
|
|
3380
|
+
try {
|
|
3381
|
+
return this.formatter.format(content);
|
|
3382
|
+
} catch (error) {
|
|
3383
|
+
throw new Error(`Failed to format TypeScript file: ${error}
|
|
3384
|
+
${content}`);
|
|
3385
|
+
}
|
|
3386
|
+
}
|
|
3387
|
+
return content;
|
|
3388
|
+
}
|
|
3389
|
+
toStringSync() {
|
|
3390
|
+
const content = this.getContent();
|
|
3391
|
+
if (this.formatter != null) {
|
|
3392
|
+
try {
|
|
3393
|
+
return this.formatter.formatSync(content);
|
|
3394
|
+
} catch (error) {
|
|
3395
|
+
throw new Error(`Failed to format TypeScript file: ${error}
|
|
3396
|
+
${content}`);
|
|
3397
|
+
}
|
|
3398
|
+
}
|
|
3399
|
+
return content;
|
|
3400
|
+
}
|
|
3401
|
+
getContent() {
|
|
3348
3402
|
const imports = this.stringifyImports();
|
|
3349
3403
|
if (imports.length > 0) {
|
|
3350
3404
|
return imports + "\n" + this.buffer;
|
|
@@ -3398,15 +3452,15 @@ var AstNode = class extends AbstractAstNode {
|
|
|
3398
3452
|
/**
|
|
3399
3453
|
* Writes the node to a string.
|
|
3400
3454
|
*/
|
|
3401
|
-
async toString({ customConfig }) {
|
|
3402
|
-
const
|
|
3403
|
-
this.write(
|
|
3404
|
-
return
|
|
3455
|
+
async toString({ customConfig, formatter }) {
|
|
3456
|
+
const file = new TypeScriptFile({ customConfig, formatter });
|
|
3457
|
+
this.write(file);
|
|
3458
|
+
return await file.toString();
|
|
3405
3459
|
}
|
|
3406
|
-
toStringSync({ customConfig }) {
|
|
3407
|
-
const
|
|
3408
|
-
this.write(
|
|
3409
|
-
return
|
|
3460
|
+
toStringSync({ customConfig, formatter }) {
|
|
3461
|
+
const file = new TypeScriptFile({ customConfig, formatter });
|
|
3462
|
+
this.write(file);
|
|
3463
|
+
return file.toStringSync();
|
|
3410
3464
|
}
|
|
3411
3465
|
};
|
|
3412
3466
|
|
|
@@ -3978,9 +4032,6 @@ var Parameter = class extends AstNode {
|
|
|
3978
4032
|
this.docs = docs;
|
|
3979
4033
|
}
|
|
3980
4034
|
write(writer) {
|
|
3981
|
-
writer.write(`${this.name}`);
|
|
3982
|
-
}
|
|
3983
|
-
writeWithType(writer) {
|
|
3984
4035
|
if (this.docs != null) {
|
|
3985
4036
|
writer.writeNode(new Comment({ docs: this.docs }));
|
|
3986
4037
|
}
|
|
@@ -4033,12 +4084,13 @@ var Function2 = class extends AstNode {
|
|
|
4033
4084
|
writer.write("()");
|
|
4034
4085
|
return;
|
|
4035
4086
|
}
|
|
4087
|
+
writer.indent();
|
|
4036
4088
|
writer.writeLine("(");
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
|
|
4041
|
-
|
|
4089
|
+
for (const parameter2 of this.parameters) {
|
|
4090
|
+
writer.writeNode(parameter2);
|
|
4091
|
+
writer.writeLine(",");
|
|
4092
|
+
}
|
|
4093
|
+
writer.dedent();
|
|
4042
4094
|
writer.write(")");
|
|
4043
4095
|
}
|
|
4044
4096
|
};
|
|
@@ -2001,6 +2001,20 @@ ${indent}`);
|
|
|
2001
2001
|
}
|
|
2002
2002
|
};
|
|
2003
2003
|
|
|
2004
|
+
// ../../browser-compatible-base/lib/ast/AbstractFormatter.js
|
|
2005
|
+
init_process();
|
|
2006
|
+
init_buffer();
|
|
2007
|
+
var AbstractFormatter = class {
|
|
2008
|
+
};
|
|
2009
|
+
var NopFormatter = class extends AbstractFormatter {
|
|
2010
|
+
async format(content) {
|
|
2011
|
+
return content;
|
|
2012
|
+
}
|
|
2013
|
+
formatSync(content) {
|
|
2014
|
+
return content;
|
|
2015
|
+
}
|
|
2016
|
+
};
|
|
2017
|
+
|
|
2004
2018
|
// ../../browser-compatible-base/lib/dynamic-snippets/index.js
|
|
2005
2019
|
init_process();
|
|
2006
2020
|
init_buffer();
|
|
@@ -2068,18 +2082,27 @@ init_buffer();
|
|
|
2068
2082
|
init_process();
|
|
2069
2083
|
init_buffer();
|
|
2070
2084
|
|
|
2085
|
+
// ../ast/lib/ast/core/TypeScriptFile.js
|
|
2086
|
+
init_process();
|
|
2087
|
+
init_buffer();
|
|
2088
|
+
|
|
2071
2089
|
// ../ast/lib/ast/core/Writer.js
|
|
2072
2090
|
init_process();
|
|
2073
2091
|
init_buffer();
|
|
2074
2092
|
var Writer = class extends AbstractWriter {
|
|
2075
|
-
constructor({ customConfig }) {
|
|
2093
|
+
constructor({ customConfig, formatter }) {
|
|
2076
2094
|
super();
|
|
2095
|
+
/* Custom generator config */
|
|
2077
2096
|
__publicField(this, "customConfig");
|
|
2097
|
+
/* Formatter used to format Go source files */
|
|
2098
|
+
__publicField(this, "formatter");
|
|
2099
|
+
/* Import statements */
|
|
2078
2100
|
__publicField(this, "imports", {});
|
|
2079
2101
|
__publicField(this, "defaultImports", {});
|
|
2080
2102
|
__publicField(this, "starImportAliases", {});
|
|
2081
2103
|
__publicField(this, "starImportAliasesInverse", {});
|
|
2082
2104
|
this.customConfig = customConfig;
|
|
2105
|
+
this.formatter = formatter != null ? formatter : new NopFormatter();
|
|
2083
2106
|
}
|
|
2084
2107
|
/**
|
|
2085
2108
|
* Adds the given import under its module name.
|
|
@@ -2157,7 +2180,38 @@ var Writer = class extends AbstractWriter {
|
|
|
2157
2180
|
throw new Error(`Attempted to use alias ${reference2.importFrom.starImportAlias} for more than one module in the same file`);
|
|
2158
2181
|
}
|
|
2159
2182
|
}
|
|
2160
|
-
|
|
2183
|
+
};
|
|
2184
|
+
|
|
2185
|
+
// ../ast/lib/ast/core/TypeScriptFile.js
|
|
2186
|
+
var TypeScriptFile = class extends Writer {
|
|
2187
|
+
constructor({ customConfig, formatter }) {
|
|
2188
|
+
super({ customConfig, formatter });
|
|
2189
|
+
}
|
|
2190
|
+
async toString() {
|
|
2191
|
+
const content = this.getContent();
|
|
2192
|
+
if (this.formatter != null) {
|
|
2193
|
+
try {
|
|
2194
|
+
return this.formatter.format(content);
|
|
2195
|
+
} catch (error) {
|
|
2196
|
+
throw new Error(`Failed to format TypeScript file: ${error}
|
|
2197
|
+
${content}`);
|
|
2198
|
+
}
|
|
2199
|
+
}
|
|
2200
|
+
return content;
|
|
2201
|
+
}
|
|
2202
|
+
toStringSync() {
|
|
2203
|
+
const content = this.getContent();
|
|
2204
|
+
if (this.formatter != null) {
|
|
2205
|
+
try {
|
|
2206
|
+
return this.formatter.formatSync(content);
|
|
2207
|
+
} catch (error) {
|
|
2208
|
+
throw new Error(`Failed to format TypeScript file: ${error}
|
|
2209
|
+
${content}`);
|
|
2210
|
+
}
|
|
2211
|
+
}
|
|
2212
|
+
return content;
|
|
2213
|
+
}
|
|
2214
|
+
getContent() {
|
|
2161
2215
|
const imports = this.stringifyImports();
|
|
2162
2216
|
if (imports.length > 0) {
|
|
2163
2217
|
return imports + "\n" + this.buffer;
|
|
@@ -2211,15 +2265,15 @@ var AstNode = class extends AbstractAstNode {
|
|
|
2211
2265
|
/**
|
|
2212
2266
|
* Writes the node to a string.
|
|
2213
2267
|
*/
|
|
2214
|
-
async toString({ customConfig }) {
|
|
2215
|
-
const
|
|
2216
|
-
this.write(
|
|
2217
|
-
return
|
|
2268
|
+
async toString({ customConfig, formatter }) {
|
|
2269
|
+
const file = new TypeScriptFile({ customConfig, formatter });
|
|
2270
|
+
this.write(file);
|
|
2271
|
+
return await file.toString();
|
|
2218
2272
|
}
|
|
2219
|
-
toStringSync({ customConfig }) {
|
|
2220
|
-
const
|
|
2221
|
-
this.write(
|
|
2222
|
-
return
|
|
2273
|
+
toStringSync({ customConfig, formatter }) {
|
|
2274
|
+
const file = new TypeScriptFile({ customConfig, formatter });
|
|
2275
|
+
this.write(file);
|
|
2276
|
+
return file.toStringSync();
|
|
2223
2277
|
}
|
|
2224
2278
|
};
|
|
2225
2279
|
|
|
@@ -2791,9 +2845,6 @@ var Parameter = class extends AstNode {
|
|
|
2791
2845
|
this.docs = docs;
|
|
2792
2846
|
}
|
|
2793
2847
|
write(writer) {
|
|
2794
|
-
writer.write(`${this.name}`);
|
|
2795
|
-
}
|
|
2796
|
-
writeWithType(writer) {
|
|
2797
2848
|
if (this.docs != null) {
|
|
2798
2849
|
writer.writeNode(new Comment({ docs: this.docs }));
|
|
2799
2850
|
}
|
|
@@ -2846,12 +2897,13 @@ var Function = class extends AstNode {
|
|
|
2846
2897
|
writer.write("()");
|
|
2847
2898
|
return;
|
|
2848
2899
|
}
|
|
2900
|
+
writer.indent();
|
|
2849
2901
|
writer.writeLine("(");
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2902
|
+
for (const parameter2 of this.parameters) {
|
|
2903
|
+
writer.writeNode(parameter2);
|
|
2904
|
+
writer.writeLine(",");
|
|
2905
|
+
}
|
|
2906
|
+
writer.dedent();
|
|
2855
2907
|
writer.write(")");
|
|
2856
2908
|
}
|
|
2857
2909
|
};
|
|
@@ -2674,6 +2674,20 @@ ${indent}`);
|
|
|
2674
2674
|
}
|
|
2675
2675
|
};
|
|
2676
2676
|
|
|
2677
|
+
// ../../browser-compatible-base/lib/ast/AbstractFormatter.js
|
|
2678
|
+
init_process();
|
|
2679
|
+
init_buffer();
|
|
2680
|
+
var AbstractFormatter = class {
|
|
2681
|
+
};
|
|
2682
|
+
var NopFormatter = class extends AbstractFormatter {
|
|
2683
|
+
async format(content) {
|
|
2684
|
+
return content;
|
|
2685
|
+
}
|
|
2686
|
+
formatSync(content) {
|
|
2687
|
+
return content;
|
|
2688
|
+
}
|
|
2689
|
+
};
|
|
2690
|
+
|
|
2677
2691
|
// ../../browser-compatible-base/lib/dynamic-snippets/index.js
|
|
2678
2692
|
init_process();
|
|
2679
2693
|
init_buffer();
|
|
@@ -3201,18 +3215,27 @@ init_buffer();
|
|
|
3201
3215
|
init_process();
|
|
3202
3216
|
init_buffer();
|
|
3203
3217
|
|
|
3218
|
+
// ../ast/lib/ast/core/TypeScriptFile.js
|
|
3219
|
+
init_process();
|
|
3220
|
+
init_buffer();
|
|
3221
|
+
|
|
3204
3222
|
// ../ast/lib/ast/core/Writer.js
|
|
3205
3223
|
init_process();
|
|
3206
3224
|
init_buffer();
|
|
3207
3225
|
var Writer = class extends AbstractWriter {
|
|
3208
|
-
constructor({ customConfig }) {
|
|
3226
|
+
constructor({ customConfig, formatter }) {
|
|
3209
3227
|
super();
|
|
3228
|
+
/* Custom generator config */
|
|
3210
3229
|
__publicField(this, "customConfig");
|
|
3230
|
+
/* Formatter used to format Go source files */
|
|
3231
|
+
__publicField(this, "formatter");
|
|
3232
|
+
/* Import statements */
|
|
3211
3233
|
__publicField(this, "imports", {});
|
|
3212
3234
|
__publicField(this, "defaultImports", {});
|
|
3213
3235
|
__publicField(this, "starImportAliases", {});
|
|
3214
3236
|
__publicField(this, "starImportAliasesInverse", {});
|
|
3215
3237
|
this.customConfig = customConfig;
|
|
3238
|
+
this.formatter = formatter != null ? formatter : new NopFormatter();
|
|
3216
3239
|
}
|
|
3217
3240
|
/**
|
|
3218
3241
|
* Adds the given import under its module name.
|
|
@@ -3290,7 +3313,38 @@ var Writer = class extends AbstractWriter {
|
|
|
3290
3313
|
throw new Error(`Attempted to use alias ${reference2.importFrom.starImportAlias} for more than one module in the same file`);
|
|
3291
3314
|
}
|
|
3292
3315
|
}
|
|
3293
|
-
|
|
3316
|
+
};
|
|
3317
|
+
|
|
3318
|
+
// ../ast/lib/ast/core/TypeScriptFile.js
|
|
3319
|
+
var TypeScriptFile = class extends Writer {
|
|
3320
|
+
constructor({ customConfig, formatter }) {
|
|
3321
|
+
super({ customConfig, formatter });
|
|
3322
|
+
}
|
|
3323
|
+
async toString() {
|
|
3324
|
+
const content = this.getContent();
|
|
3325
|
+
if (this.formatter != null) {
|
|
3326
|
+
try {
|
|
3327
|
+
return this.formatter.format(content);
|
|
3328
|
+
} catch (error) {
|
|
3329
|
+
throw new Error(`Failed to format TypeScript file: ${error}
|
|
3330
|
+
${content}`);
|
|
3331
|
+
}
|
|
3332
|
+
}
|
|
3333
|
+
return content;
|
|
3334
|
+
}
|
|
3335
|
+
toStringSync() {
|
|
3336
|
+
const content = this.getContent();
|
|
3337
|
+
if (this.formatter != null) {
|
|
3338
|
+
try {
|
|
3339
|
+
return this.formatter.formatSync(content);
|
|
3340
|
+
} catch (error) {
|
|
3341
|
+
throw new Error(`Failed to format TypeScript file: ${error}
|
|
3342
|
+
${content}`);
|
|
3343
|
+
}
|
|
3344
|
+
}
|
|
3345
|
+
return content;
|
|
3346
|
+
}
|
|
3347
|
+
getContent() {
|
|
3294
3348
|
const imports = this.stringifyImports();
|
|
3295
3349
|
if (imports.length > 0) {
|
|
3296
3350
|
return imports + "\n" + this.buffer;
|
|
@@ -3344,15 +3398,15 @@ var AstNode = class extends AbstractAstNode {
|
|
|
3344
3398
|
/**
|
|
3345
3399
|
* Writes the node to a string.
|
|
3346
3400
|
*/
|
|
3347
|
-
async toString({ customConfig }) {
|
|
3348
|
-
const
|
|
3349
|
-
this.write(
|
|
3350
|
-
return
|
|
3401
|
+
async toString({ customConfig, formatter }) {
|
|
3402
|
+
const file = new TypeScriptFile({ customConfig, formatter });
|
|
3403
|
+
this.write(file);
|
|
3404
|
+
return await file.toString();
|
|
3351
3405
|
}
|
|
3352
|
-
toStringSync({ customConfig }) {
|
|
3353
|
-
const
|
|
3354
|
-
this.write(
|
|
3355
|
-
return
|
|
3406
|
+
toStringSync({ customConfig, formatter }) {
|
|
3407
|
+
const file = new TypeScriptFile({ customConfig, formatter });
|
|
3408
|
+
this.write(file);
|
|
3409
|
+
return file.toStringSync();
|
|
3356
3410
|
}
|
|
3357
3411
|
};
|
|
3358
3412
|
|
|
@@ -3924,9 +3978,6 @@ var Parameter = class extends AstNode {
|
|
|
3924
3978
|
this.docs = docs;
|
|
3925
3979
|
}
|
|
3926
3980
|
write(writer) {
|
|
3927
|
-
writer.write(`${this.name}`);
|
|
3928
|
-
}
|
|
3929
|
-
writeWithType(writer) {
|
|
3930
3981
|
if (this.docs != null) {
|
|
3931
3982
|
writer.writeNode(new Comment({ docs: this.docs }));
|
|
3932
3983
|
}
|
|
@@ -3979,12 +4030,13 @@ var Function2 = class extends AstNode {
|
|
|
3979
4030
|
writer.write("()");
|
|
3980
4031
|
return;
|
|
3981
4032
|
}
|
|
4033
|
+
writer.indent();
|
|
3982
4034
|
writer.writeLine("(");
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
4035
|
+
for (const parameter2 of this.parameters) {
|
|
4036
|
+
writer.writeNode(parameter2);
|
|
4037
|
+
writer.writeLine(",");
|
|
4038
|
+
}
|
|
4039
|
+
writer.dedent();
|
|
3988
4040
|
writer.write(")");
|
|
3989
4041
|
}
|
|
3990
4042
|
};
|
|
@@ -2001,6 +2001,20 @@ ${indent}`);
|
|
|
2001
2001
|
}
|
|
2002
2002
|
};
|
|
2003
2003
|
|
|
2004
|
+
// ../../browser-compatible-base/lib/ast/AbstractFormatter.js
|
|
2005
|
+
init_process();
|
|
2006
|
+
init_buffer();
|
|
2007
|
+
var AbstractFormatter = class {
|
|
2008
|
+
};
|
|
2009
|
+
var NopFormatter = class extends AbstractFormatter {
|
|
2010
|
+
async format(content) {
|
|
2011
|
+
return content;
|
|
2012
|
+
}
|
|
2013
|
+
formatSync(content) {
|
|
2014
|
+
return content;
|
|
2015
|
+
}
|
|
2016
|
+
};
|
|
2017
|
+
|
|
2004
2018
|
// ../../browser-compatible-base/lib/dynamic-snippets/index.js
|
|
2005
2019
|
init_process();
|
|
2006
2020
|
init_buffer();
|
|
@@ -2058,18 +2072,27 @@ init_buffer();
|
|
|
2058
2072
|
init_process();
|
|
2059
2073
|
init_buffer();
|
|
2060
2074
|
|
|
2075
|
+
// ../ast/lib/ast/core/TypeScriptFile.js
|
|
2076
|
+
init_process();
|
|
2077
|
+
init_buffer();
|
|
2078
|
+
|
|
2061
2079
|
// ../ast/lib/ast/core/Writer.js
|
|
2062
2080
|
init_process();
|
|
2063
2081
|
init_buffer();
|
|
2064
2082
|
var Writer = class extends AbstractWriter {
|
|
2065
|
-
constructor({ customConfig }) {
|
|
2083
|
+
constructor({ customConfig, formatter }) {
|
|
2066
2084
|
super();
|
|
2085
|
+
/* Custom generator config */
|
|
2067
2086
|
__publicField(this, "customConfig");
|
|
2087
|
+
/* Formatter used to format Go source files */
|
|
2088
|
+
__publicField(this, "formatter");
|
|
2089
|
+
/* Import statements */
|
|
2068
2090
|
__publicField(this, "imports", {});
|
|
2069
2091
|
__publicField(this, "defaultImports", {});
|
|
2070
2092
|
__publicField(this, "starImportAliases", {});
|
|
2071
2093
|
__publicField(this, "starImportAliasesInverse", {});
|
|
2072
2094
|
this.customConfig = customConfig;
|
|
2095
|
+
this.formatter = formatter != null ? formatter : new NopFormatter();
|
|
2073
2096
|
}
|
|
2074
2097
|
/**
|
|
2075
2098
|
* Adds the given import under its module name.
|
|
@@ -2147,7 +2170,38 @@ var Writer = class extends AbstractWriter {
|
|
|
2147
2170
|
throw new Error(`Attempted to use alias ${reference2.importFrom.starImportAlias} for more than one module in the same file`);
|
|
2148
2171
|
}
|
|
2149
2172
|
}
|
|
2150
|
-
|
|
2173
|
+
};
|
|
2174
|
+
|
|
2175
|
+
// ../ast/lib/ast/core/TypeScriptFile.js
|
|
2176
|
+
var TypeScriptFile = class extends Writer {
|
|
2177
|
+
constructor({ customConfig, formatter }) {
|
|
2178
|
+
super({ customConfig, formatter });
|
|
2179
|
+
}
|
|
2180
|
+
async toString() {
|
|
2181
|
+
const content = this.getContent();
|
|
2182
|
+
if (this.formatter != null) {
|
|
2183
|
+
try {
|
|
2184
|
+
return this.formatter.format(content);
|
|
2185
|
+
} catch (error) {
|
|
2186
|
+
throw new Error(`Failed to format TypeScript file: ${error}
|
|
2187
|
+
${content}`);
|
|
2188
|
+
}
|
|
2189
|
+
}
|
|
2190
|
+
return content;
|
|
2191
|
+
}
|
|
2192
|
+
toStringSync() {
|
|
2193
|
+
const content = this.getContent();
|
|
2194
|
+
if (this.formatter != null) {
|
|
2195
|
+
try {
|
|
2196
|
+
return this.formatter.formatSync(content);
|
|
2197
|
+
} catch (error) {
|
|
2198
|
+
throw new Error(`Failed to format TypeScript file: ${error}
|
|
2199
|
+
${content}`);
|
|
2200
|
+
}
|
|
2201
|
+
}
|
|
2202
|
+
return content;
|
|
2203
|
+
}
|
|
2204
|
+
getContent() {
|
|
2151
2205
|
const imports = this.stringifyImports();
|
|
2152
2206
|
if (imports.length > 0) {
|
|
2153
2207
|
return imports + "\n" + this.buffer;
|
|
@@ -2201,15 +2255,15 @@ var AstNode = class extends AbstractAstNode {
|
|
|
2201
2255
|
/**
|
|
2202
2256
|
* Writes the node to a string.
|
|
2203
2257
|
*/
|
|
2204
|
-
async toString({ customConfig }) {
|
|
2205
|
-
const
|
|
2206
|
-
this.write(
|
|
2207
|
-
return
|
|
2258
|
+
async toString({ customConfig, formatter }) {
|
|
2259
|
+
const file = new TypeScriptFile({ customConfig, formatter });
|
|
2260
|
+
this.write(file);
|
|
2261
|
+
return await file.toString();
|
|
2208
2262
|
}
|
|
2209
|
-
toStringSync({ customConfig }) {
|
|
2210
|
-
const
|
|
2211
|
-
this.write(
|
|
2212
|
-
return
|
|
2263
|
+
toStringSync({ customConfig, formatter }) {
|
|
2264
|
+
const file = new TypeScriptFile({ customConfig, formatter });
|
|
2265
|
+
this.write(file);
|
|
2266
|
+
return file.toStringSync();
|
|
2213
2267
|
}
|
|
2214
2268
|
};
|
|
2215
2269
|
|
|
@@ -2781,9 +2835,6 @@ var Parameter = class extends AstNode {
|
|
|
2781
2835
|
this.docs = docs;
|
|
2782
2836
|
}
|
|
2783
2837
|
write(writer) {
|
|
2784
|
-
writer.write(`${this.name}`);
|
|
2785
|
-
}
|
|
2786
|
-
writeWithType(writer) {
|
|
2787
2838
|
if (this.docs != null) {
|
|
2788
2839
|
writer.writeNode(new Comment({ docs: this.docs }));
|
|
2789
2840
|
}
|
|
@@ -2836,12 +2887,13 @@ var Function = class extends AstNode {
|
|
|
2836
2887
|
writer.write("()");
|
|
2837
2888
|
return;
|
|
2838
2889
|
}
|
|
2890
|
+
writer.indent();
|
|
2839
2891
|
writer.writeLine("(");
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2892
|
+
for (const parameter2 of this.parameters) {
|
|
2893
|
+
writer.writeNode(parameter2);
|
|
2894
|
+
writer.writeLine(",");
|
|
2895
|
+
}
|
|
2896
|
+
writer.dedent();
|
|
2845
2897
|
writer.write(")");
|
|
2846
2898
|
}
|
|
2847
2899
|
};
|
|
@@ -2046,18 +2046,41 @@ ${indent}`);
|
|
|
2046
2046
|
}
|
|
2047
2047
|
};
|
|
2048
2048
|
|
|
2049
|
+
// ../../browser-compatible-base/lib/ast/AbstractFormatter.js
|
|
2050
|
+
init_process();
|
|
2051
|
+
init_buffer();
|
|
2052
|
+
var AbstractFormatter = class {
|
|
2053
|
+
};
|
|
2054
|
+
var NopFormatter = class extends AbstractFormatter {
|
|
2055
|
+
async format(content) {
|
|
2056
|
+
return content;
|
|
2057
|
+
}
|
|
2058
|
+
formatSync(content) {
|
|
2059
|
+
return content;
|
|
2060
|
+
}
|
|
2061
|
+
};
|
|
2062
|
+
|
|
2063
|
+
// ../ast/lib/ast/core/TypeScriptFile.js
|
|
2064
|
+
init_process();
|
|
2065
|
+
init_buffer();
|
|
2066
|
+
|
|
2049
2067
|
// ../ast/lib/ast/core/Writer.js
|
|
2050
2068
|
init_process();
|
|
2051
2069
|
init_buffer();
|
|
2052
2070
|
var Writer = class extends AbstractWriter {
|
|
2053
|
-
constructor({ customConfig }) {
|
|
2071
|
+
constructor({ customConfig, formatter }) {
|
|
2054
2072
|
super();
|
|
2073
|
+
/* Custom generator config */
|
|
2055
2074
|
__publicField(this, "customConfig");
|
|
2075
|
+
/* Formatter used to format Go source files */
|
|
2076
|
+
__publicField(this, "formatter");
|
|
2077
|
+
/* Import statements */
|
|
2056
2078
|
__publicField(this, "imports", {});
|
|
2057
2079
|
__publicField(this, "defaultImports", {});
|
|
2058
2080
|
__publicField(this, "starImportAliases", {});
|
|
2059
2081
|
__publicField(this, "starImportAliasesInverse", {});
|
|
2060
2082
|
this.customConfig = customConfig;
|
|
2083
|
+
this.formatter = formatter != null ? formatter : new NopFormatter();
|
|
2061
2084
|
}
|
|
2062
2085
|
/**
|
|
2063
2086
|
* Adds the given import under its module name.
|
|
@@ -2135,7 +2158,38 @@ var Writer = class extends AbstractWriter {
|
|
|
2135
2158
|
throw new Error(`Attempted to use alias ${reference2.importFrom.starImportAlias} for more than one module in the same file`);
|
|
2136
2159
|
}
|
|
2137
2160
|
}
|
|
2138
|
-
|
|
2161
|
+
};
|
|
2162
|
+
|
|
2163
|
+
// ../ast/lib/ast/core/TypeScriptFile.js
|
|
2164
|
+
var TypeScriptFile = class extends Writer {
|
|
2165
|
+
constructor({ customConfig, formatter }) {
|
|
2166
|
+
super({ customConfig, formatter });
|
|
2167
|
+
}
|
|
2168
|
+
async toString() {
|
|
2169
|
+
const content = this.getContent();
|
|
2170
|
+
if (this.formatter != null) {
|
|
2171
|
+
try {
|
|
2172
|
+
return this.formatter.format(content);
|
|
2173
|
+
} catch (error) {
|
|
2174
|
+
throw new Error(`Failed to format TypeScript file: ${error}
|
|
2175
|
+
${content}`);
|
|
2176
|
+
}
|
|
2177
|
+
}
|
|
2178
|
+
return content;
|
|
2179
|
+
}
|
|
2180
|
+
toStringSync() {
|
|
2181
|
+
const content = this.getContent();
|
|
2182
|
+
if (this.formatter != null) {
|
|
2183
|
+
try {
|
|
2184
|
+
return this.formatter.formatSync(content);
|
|
2185
|
+
} catch (error) {
|
|
2186
|
+
throw new Error(`Failed to format TypeScript file: ${error}
|
|
2187
|
+
${content}`);
|
|
2188
|
+
}
|
|
2189
|
+
}
|
|
2190
|
+
return content;
|
|
2191
|
+
}
|
|
2192
|
+
getContent() {
|
|
2139
2193
|
const imports = this.stringifyImports();
|
|
2140
2194
|
if (imports.length > 0) {
|
|
2141
2195
|
return imports + "\n" + this.buffer;
|
|
@@ -2189,15 +2243,15 @@ var AstNode = class extends AbstractAstNode {
|
|
|
2189
2243
|
/**
|
|
2190
2244
|
* Writes the node to a string.
|
|
2191
2245
|
*/
|
|
2192
|
-
async toString({ customConfig }) {
|
|
2193
|
-
const
|
|
2194
|
-
this.write(
|
|
2195
|
-
return
|
|
2246
|
+
async toString({ customConfig, formatter }) {
|
|
2247
|
+
const file = new TypeScriptFile({ customConfig, formatter });
|
|
2248
|
+
this.write(file);
|
|
2249
|
+
return await file.toString();
|
|
2196
2250
|
}
|
|
2197
|
-
toStringSync({ customConfig }) {
|
|
2198
|
-
const
|
|
2199
|
-
this.write(
|
|
2200
|
-
return
|
|
2251
|
+
toStringSync({ customConfig, formatter }) {
|
|
2252
|
+
const file = new TypeScriptFile({ customConfig, formatter });
|
|
2253
|
+
this.write(file);
|
|
2254
|
+
return file.toStringSync();
|
|
2201
2255
|
}
|
|
2202
2256
|
};
|
|
2203
2257
|
|
|
@@ -2769,9 +2823,6 @@ var Parameter = class extends AstNode {
|
|
|
2769
2823
|
this.docs = docs;
|
|
2770
2824
|
}
|
|
2771
2825
|
write(writer) {
|
|
2772
|
-
writer.write(`${this.name}`);
|
|
2773
|
-
}
|
|
2774
|
-
writeWithType(writer) {
|
|
2775
2826
|
if (this.docs != null) {
|
|
2776
2827
|
writer.writeNode(new Comment({ docs: this.docs }));
|
|
2777
2828
|
}
|
|
@@ -2824,12 +2875,13 @@ var Function = class extends AstNode {
|
|
|
2824
2875
|
writer.write("()");
|
|
2825
2876
|
return;
|
|
2826
2877
|
}
|
|
2878
|
+
writer.indent();
|
|
2827
2879
|
writer.writeLine("(");
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2880
|
+
for (const parameter2 of this.parameters) {
|
|
2881
|
+
writer.writeNode(parameter2);
|
|
2882
|
+
writer.writeLine(",");
|
|
2883
|
+
}
|
|
2884
|
+
writer.dedent();
|
|
2833
2885
|
writer.write(")");
|
|
2834
2886
|
}
|
|
2835
2887
|
};
|
package/cjs/index.cjs
CHANGED
|
@@ -5977,6 +5977,20 @@ ${indent}`);
|
|
|
5977
5977
|
}
|
|
5978
5978
|
};
|
|
5979
5979
|
|
|
5980
|
+
// ../../browser-compatible-base/lib/ast/AbstractFormatter.js
|
|
5981
|
+
init_process();
|
|
5982
|
+
init_buffer();
|
|
5983
|
+
var AbstractFormatter = class {
|
|
5984
|
+
};
|
|
5985
|
+
var NopFormatter = class extends AbstractFormatter {
|
|
5986
|
+
async format(content) {
|
|
5987
|
+
return content;
|
|
5988
|
+
}
|
|
5989
|
+
formatSync(content) {
|
|
5990
|
+
return content;
|
|
5991
|
+
}
|
|
5992
|
+
};
|
|
5993
|
+
|
|
5980
5994
|
// ../../browser-compatible-base/lib/dynamic-snippets/index.js
|
|
5981
5995
|
init_process();
|
|
5982
5996
|
init_buffer();
|
|
@@ -6558,18 +6572,27 @@ init_buffer();
|
|
|
6558
6572
|
init_process();
|
|
6559
6573
|
init_buffer();
|
|
6560
6574
|
|
|
6575
|
+
// ../ast/lib/ast/core/TypeScriptFile.js
|
|
6576
|
+
init_process();
|
|
6577
|
+
init_buffer();
|
|
6578
|
+
|
|
6561
6579
|
// ../ast/lib/ast/core/Writer.js
|
|
6562
6580
|
init_process();
|
|
6563
6581
|
init_buffer();
|
|
6564
6582
|
var Writer = class extends AbstractWriter {
|
|
6565
|
-
constructor({ customConfig }) {
|
|
6583
|
+
constructor({ customConfig, formatter }) {
|
|
6566
6584
|
super();
|
|
6585
|
+
/* Custom generator config */
|
|
6567
6586
|
__publicField(this, "customConfig");
|
|
6587
|
+
/* Formatter used to format Go source files */
|
|
6588
|
+
__publicField(this, "formatter");
|
|
6589
|
+
/* Import statements */
|
|
6568
6590
|
__publicField(this, "imports", {});
|
|
6569
6591
|
__publicField(this, "defaultImports", {});
|
|
6570
6592
|
__publicField(this, "starImportAliases", {});
|
|
6571
6593
|
__publicField(this, "starImportAliasesInverse", {});
|
|
6572
6594
|
this.customConfig = customConfig;
|
|
6595
|
+
this.formatter = formatter != null ? formatter : new NopFormatter();
|
|
6573
6596
|
}
|
|
6574
6597
|
/**
|
|
6575
6598
|
* Adds the given import under its module name.
|
|
@@ -6647,7 +6670,38 @@ var Writer = class extends AbstractWriter {
|
|
|
6647
6670
|
throw new Error(`Attempted to use alias ${reference2.importFrom.starImportAlias} for more than one module in the same file`);
|
|
6648
6671
|
}
|
|
6649
6672
|
}
|
|
6650
|
-
|
|
6673
|
+
};
|
|
6674
|
+
|
|
6675
|
+
// ../ast/lib/ast/core/TypeScriptFile.js
|
|
6676
|
+
var TypeScriptFile = class extends Writer {
|
|
6677
|
+
constructor({ customConfig, formatter }) {
|
|
6678
|
+
super({ customConfig, formatter });
|
|
6679
|
+
}
|
|
6680
|
+
async toString() {
|
|
6681
|
+
const content = this.getContent();
|
|
6682
|
+
if (this.formatter != null) {
|
|
6683
|
+
try {
|
|
6684
|
+
return this.formatter.format(content);
|
|
6685
|
+
} catch (error) {
|
|
6686
|
+
throw new Error(`Failed to format TypeScript file: ${error}
|
|
6687
|
+
${content}`);
|
|
6688
|
+
}
|
|
6689
|
+
}
|
|
6690
|
+
return content;
|
|
6691
|
+
}
|
|
6692
|
+
toStringSync() {
|
|
6693
|
+
const content = this.getContent();
|
|
6694
|
+
if (this.formatter != null) {
|
|
6695
|
+
try {
|
|
6696
|
+
return this.formatter.formatSync(content);
|
|
6697
|
+
} catch (error) {
|
|
6698
|
+
throw new Error(`Failed to format TypeScript file: ${error}
|
|
6699
|
+
${content}`);
|
|
6700
|
+
}
|
|
6701
|
+
}
|
|
6702
|
+
return content;
|
|
6703
|
+
}
|
|
6704
|
+
getContent() {
|
|
6651
6705
|
const imports = this.stringifyImports();
|
|
6652
6706
|
if (imports.length > 0) {
|
|
6653
6707
|
return imports + "\n" + this.buffer;
|
|
@@ -6701,15 +6755,15 @@ var AstNode = class extends AbstractAstNode {
|
|
|
6701
6755
|
/**
|
|
6702
6756
|
* Writes the node to a string.
|
|
6703
6757
|
*/
|
|
6704
|
-
async toString({ customConfig }) {
|
|
6705
|
-
const
|
|
6706
|
-
this.write(
|
|
6707
|
-
return
|
|
6758
|
+
async toString({ customConfig, formatter }) {
|
|
6759
|
+
const file = new TypeScriptFile({ customConfig, formatter });
|
|
6760
|
+
this.write(file);
|
|
6761
|
+
return await file.toString();
|
|
6708
6762
|
}
|
|
6709
|
-
toStringSync({ customConfig }) {
|
|
6710
|
-
const
|
|
6711
|
-
this.write(
|
|
6712
|
-
return
|
|
6763
|
+
toStringSync({ customConfig, formatter }) {
|
|
6764
|
+
const file = new TypeScriptFile({ customConfig, formatter });
|
|
6765
|
+
this.write(file);
|
|
6766
|
+
return file.toStringSync();
|
|
6713
6767
|
}
|
|
6714
6768
|
};
|
|
6715
6769
|
|
|
@@ -7281,9 +7335,6 @@ var Parameter = class extends AstNode {
|
|
|
7281
7335
|
this.docs = docs;
|
|
7282
7336
|
}
|
|
7283
7337
|
write(writer) {
|
|
7284
|
-
writer.write(`${this.name}`);
|
|
7285
|
-
}
|
|
7286
|
-
writeWithType(writer) {
|
|
7287
7338
|
if (this.docs != null) {
|
|
7288
7339
|
writer.writeNode(new Comment({ docs: this.docs }));
|
|
7289
7340
|
}
|
|
@@ -7336,12 +7387,13 @@ var Function2 = class extends AstNode {
|
|
|
7336
7387
|
writer.write("()");
|
|
7337
7388
|
return;
|
|
7338
7389
|
}
|
|
7390
|
+
writer.indent();
|
|
7339
7391
|
writer.writeLine("(");
|
|
7340
|
-
|
|
7341
|
-
|
|
7342
|
-
|
|
7343
|
-
|
|
7344
|
-
|
|
7392
|
+
for (const parameter2 of this.parameters) {
|
|
7393
|
+
writer.writeNode(parameter2);
|
|
7394
|
+
writer.writeLine(",");
|
|
7395
|
+
}
|
|
7396
|
+
writer.dedent();
|
|
7345
7397
|
writer.write(")");
|
|
7346
7398
|
}
|
|
7347
7399
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DynamicSnippetsGenerator
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-TKT54OF7.js";
|
|
4
|
+
import "./chunk-KUITDN45.js";
|
|
5
|
+
import "./chunk-MR7ZAFRL.js";
|
|
6
|
+
import "./chunk-6Y2IOBCK.js";
|
|
7
|
+
import "./chunk-37WY6L3Q.js";
|
|
8
|
+
import "./chunk-PLZLTFT4.js";
|
|
9
|
+
import "./chunk-WPDO6IRW.js";
|
|
10
10
|
export {
|
|
11
11
|
DynamicSnippetsGenerator
|
|
12
12
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
EndpointSnippetGenerator
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-KUITDN45.js";
|
|
4
|
+
import "./chunk-37WY6L3Q.js";
|
|
5
|
+
import "./chunk-WPDO6IRW.js";
|
|
6
6
|
export {
|
|
7
7
|
EndpointSnippetGenerator
|
|
8
8
|
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Severity
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-37WY6L3Q.js";
|
|
4
4
|
import {
|
|
5
5
|
__publicField,
|
|
6
6
|
assertNever,
|
|
7
7
|
init_buffer,
|
|
8
8
|
init_process,
|
|
9
9
|
typescript_exports
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-WPDO6IRW.js";
|
|
11
11
|
|
|
12
12
|
// src/context/DynamicTypeLiteralMapper.ts
|
|
13
13
|
init_process();
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Scope,
|
|
3
3
|
Severity
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-37WY6L3Q.js";
|
|
5
5
|
import {
|
|
6
6
|
__publicField,
|
|
7
7
|
assertNever,
|
|
8
8
|
init_buffer,
|
|
9
9
|
init_process,
|
|
10
10
|
typescript_exports
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-WPDO6IRW.js";
|
|
12
12
|
|
|
13
13
|
// src/EndpointSnippetGenerator.ts
|
|
14
14
|
init_process();
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DynamicTypeLiteralMapper
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-6Y2IOBCK.js";
|
|
4
4
|
import {
|
|
5
5
|
AbstractDynamicSnippetsGeneratorContext
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-37WY6L3Q.js";
|
|
7
7
|
import {
|
|
8
8
|
FilePropertyMapper
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-PLZLTFT4.js";
|
|
10
10
|
import {
|
|
11
11
|
__publicField,
|
|
12
12
|
init_buffer,
|
|
13
13
|
init_process,
|
|
14
14
|
typescript_exports
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-WPDO6IRW.js";
|
|
16
16
|
|
|
17
17
|
// src/context/DynamicSnippetsGeneratorContext.ts
|
|
18
18
|
init_process();
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
EndpointSnippetGenerator
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-KUITDN45.js";
|
|
4
4
|
import {
|
|
5
5
|
DynamicSnippetsGeneratorContext
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-MR7ZAFRL.js";
|
|
7
7
|
import {
|
|
8
8
|
AbstractDynamicSnippetsGenerator,
|
|
9
9
|
Result
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-37WY6L3Q.js";
|
|
11
11
|
import {
|
|
12
12
|
init_buffer,
|
|
13
13
|
init_process
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-WPDO6IRW.js";
|
|
15
15
|
|
|
16
16
|
// src/DynamicSnippetsGenerator.ts
|
|
17
17
|
init_process();
|
|
@@ -2081,18 +2081,41 @@ ${indent}`);
|
|
|
2081
2081
|
}
|
|
2082
2082
|
};
|
|
2083
2083
|
|
|
2084
|
+
// ../../browser-compatible-base/lib/ast/AbstractFormatter.js
|
|
2085
|
+
init_process();
|
|
2086
|
+
init_buffer();
|
|
2087
|
+
var AbstractFormatter = class {
|
|
2088
|
+
};
|
|
2089
|
+
var NopFormatter = class extends AbstractFormatter {
|
|
2090
|
+
async format(content) {
|
|
2091
|
+
return content;
|
|
2092
|
+
}
|
|
2093
|
+
formatSync(content) {
|
|
2094
|
+
return content;
|
|
2095
|
+
}
|
|
2096
|
+
};
|
|
2097
|
+
|
|
2098
|
+
// ../ast/lib/ast/core/TypeScriptFile.js
|
|
2099
|
+
init_process();
|
|
2100
|
+
init_buffer();
|
|
2101
|
+
|
|
2084
2102
|
// ../ast/lib/ast/core/Writer.js
|
|
2085
2103
|
init_process();
|
|
2086
2104
|
init_buffer();
|
|
2087
2105
|
var Writer = class extends AbstractWriter {
|
|
2088
|
-
constructor({ customConfig }) {
|
|
2106
|
+
constructor({ customConfig, formatter }) {
|
|
2089
2107
|
super();
|
|
2108
|
+
/* Custom generator config */
|
|
2090
2109
|
__publicField(this, "customConfig");
|
|
2110
|
+
/* Formatter used to format Go source files */
|
|
2111
|
+
__publicField(this, "formatter");
|
|
2112
|
+
/* Import statements */
|
|
2091
2113
|
__publicField(this, "imports", {});
|
|
2092
2114
|
__publicField(this, "defaultImports", {});
|
|
2093
2115
|
__publicField(this, "starImportAliases", {});
|
|
2094
2116
|
__publicField(this, "starImportAliasesInverse", {});
|
|
2095
2117
|
this.customConfig = customConfig;
|
|
2118
|
+
this.formatter = formatter != null ? formatter : new NopFormatter();
|
|
2096
2119
|
}
|
|
2097
2120
|
/**
|
|
2098
2121
|
* Adds the given import under its module name.
|
|
@@ -2170,7 +2193,38 @@ var Writer = class extends AbstractWriter {
|
|
|
2170
2193
|
throw new Error(`Attempted to use alias ${reference2.importFrom.starImportAlias} for more than one module in the same file`);
|
|
2171
2194
|
}
|
|
2172
2195
|
}
|
|
2173
|
-
|
|
2196
|
+
};
|
|
2197
|
+
|
|
2198
|
+
// ../ast/lib/ast/core/TypeScriptFile.js
|
|
2199
|
+
var TypeScriptFile = class extends Writer {
|
|
2200
|
+
constructor({ customConfig, formatter }) {
|
|
2201
|
+
super({ customConfig, formatter });
|
|
2202
|
+
}
|
|
2203
|
+
async toString() {
|
|
2204
|
+
const content = this.getContent();
|
|
2205
|
+
if (this.formatter != null) {
|
|
2206
|
+
try {
|
|
2207
|
+
return this.formatter.format(content);
|
|
2208
|
+
} catch (error) {
|
|
2209
|
+
throw new Error(`Failed to format TypeScript file: ${error}
|
|
2210
|
+
${content}`);
|
|
2211
|
+
}
|
|
2212
|
+
}
|
|
2213
|
+
return content;
|
|
2214
|
+
}
|
|
2215
|
+
toStringSync() {
|
|
2216
|
+
const content = this.getContent();
|
|
2217
|
+
if (this.formatter != null) {
|
|
2218
|
+
try {
|
|
2219
|
+
return this.formatter.formatSync(content);
|
|
2220
|
+
} catch (error) {
|
|
2221
|
+
throw new Error(`Failed to format TypeScript file: ${error}
|
|
2222
|
+
${content}`);
|
|
2223
|
+
}
|
|
2224
|
+
}
|
|
2225
|
+
return content;
|
|
2226
|
+
}
|
|
2227
|
+
getContent() {
|
|
2174
2228
|
const imports = this.stringifyImports();
|
|
2175
2229
|
if (imports.length > 0) {
|
|
2176
2230
|
return imports + "\n" + this.buffer;
|
|
@@ -2224,15 +2278,15 @@ var AstNode = class extends AbstractAstNode {
|
|
|
2224
2278
|
/**
|
|
2225
2279
|
* Writes the node to a string.
|
|
2226
2280
|
*/
|
|
2227
|
-
async toString({ customConfig }) {
|
|
2228
|
-
const
|
|
2229
|
-
this.write(
|
|
2230
|
-
return
|
|
2281
|
+
async toString({ customConfig, formatter }) {
|
|
2282
|
+
const file = new TypeScriptFile({ customConfig, formatter });
|
|
2283
|
+
this.write(file);
|
|
2284
|
+
return await file.toString();
|
|
2231
2285
|
}
|
|
2232
|
-
toStringSync({ customConfig }) {
|
|
2233
|
-
const
|
|
2234
|
-
this.write(
|
|
2235
|
-
return
|
|
2286
|
+
toStringSync({ customConfig, formatter }) {
|
|
2287
|
+
const file = new TypeScriptFile({ customConfig, formatter });
|
|
2288
|
+
this.write(file);
|
|
2289
|
+
return file.toStringSync();
|
|
2236
2290
|
}
|
|
2237
2291
|
};
|
|
2238
2292
|
|
|
@@ -2804,9 +2858,6 @@ var Parameter = class extends AstNode {
|
|
|
2804
2858
|
this.docs = docs;
|
|
2805
2859
|
}
|
|
2806
2860
|
write(writer) {
|
|
2807
|
-
writer.write(`${this.name}`);
|
|
2808
|
-
}
|
|
2809
|
-
writeWithType(writer) {
|
|
2810
2861
|
if (this.docs != null) {
|
|
2811
2862
|
writer.writeNode(new Comment({ docs: this.docs }));
|
|
2812
2863
|
}
|
|
@@ -2859,12 +2910,13 @@ var Function = class extends AstNode {
|
|
|
2859
2910
|
writer.write("()");
|
|
2860
2911
|
return;
|
|
2861
2912
|
}
|
|
2913
|
+
writer.indent();
|
|
2862
2914
|
writer.writeLine("(");
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2915
|
+
for (const parameter2 of this.parameters) {
|
|
2916
|
+
writer.writeNode(parameter2);
|
|
2917
|
+
writer.writeLine(",");
|
|
2918
|
+
}
|
|
2919
|
+
writer.dedent();
|
|
2868
2920
|
writer.write(")");
|
|
2869
2921
|
}
|
|
2870
2922
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DynamicSnippetsGeneratorContext
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-MR7ZAFRL.js";
|
|
4
|
+
import "../chunk-6Y2IOBCK.js";
|
|
5
|
+
import "../chunk-37WY6L3Q.js";
|
|
6
|
+
import "../chunk-PLZLTFT4.js";
|
|
7
|
+
import "../chunk-WPDO6IRW.js";
|
|
8
8
|
export {
|
|
9
9
|
DynamicSnippetsGeneratorContext
|
|
10
10
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DynamicTypeLiteralMapper
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-6Y2IOBCK.js";
|
|
4
|
+
import "../chunk-37WY6L3Q.js";
|
|
5
|
+
import "../chunk-WPDO6IRW.js";
|
|
6
6
|
export {
|
|
7
7
|
DynamicTypeLiteralMapper
|
|
8
8
|
};
|
package/esm/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DynamicSnippetsGenerator
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-TKT54OF7.js";
|
|
4
|
+
import "./chunk-KUITDN45.js";
|
|
5
|
+
import "./chunk-MR7ZAFRL.js";
|
|
6
|
+
import "./chunk-6Y2IOBCK.js";
|
|
7
|
+
import "./chunk-37WY6L3Q.js";
|
|
8
|
+
import "./chunk-PLZLTFT4.js";
|
|
9
9
|
import {
|
|
10
10
|
Buffer,
|
|
11
11
|
__commonJS,
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
__toESM,
|
|
16
16
|
init_buffer,
|
|
17
17
|
init_process
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-WPDO6IRW.js";
|
|
19
19
|
|
|
20
20
|
// ../../../node_modules/.pnpm/function-bind@1.1.2/node_modules/function-bind/implementation.js
|
|
21
21
|
var require_implementation = __commonJS({
|