@plasmicapp/cli 0.1.307 → 0.1.308
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/export.d.ts +1 -3
- package/dist/index.js +178 -179
- package/dist/lib.d.ts +1 -0
- package/dist/lib.js +3404 -3139
- package/package.json +2 -2
- package/src/actions/export.ts +9 -14
- package/src/index.ts +6 -6
- package/src/lib.ts +4 -0
package/dist/actions/export.d.ts
CHANGED
|
@@ -5,9 +5,7 @@ export interface ExportArgs extends CommonArgs {
|
|
|
5
5
|
platform: "" | "react" | "nextjs" | "gatsby";
|
|
6
6
|
codeLang: "" | "ts" | "js";
|
|
7
7
|
styleScheme: "" | "css" | "css-modules";
|
|
8
|
-
imagesScheme: "" | "inlined" | "files"
|
|
9
|
-
imagesPublicDir: string;
|
|
10
|
-
imagesPublicUrlPrefix: string;
|
|
8
|
+
imagesScheme: "" | "inlined" | "files";
|
|
11
9
|
i18NKeyScheme: "" | I18NConfig["keyScheme"];
|
|
12
10
|
i18NTagPrefix: "" | I18NConfig["tagPrefix"];
|
|
13
11
|
skipFormatting?: boolean;
|
package/dist/index.js
CHANGED
|
@@ -11549,8 +11549,8 @@ var require_winston_transport = __commonJS({
|
|
|
11549
11549
|
}
|
|
11550
11550
|
return callback(null);
|
|
11551
11551
|
};
|
|
11552
|
-
TransportStream.prototype._accept = function _accept(
|
|
11553
|
-
const info =
|
|
11552
|
+
TransportStream.prototype._accept = function _accept(write) {
|
|
11553
|
+
const info = write.chunk;
|
|
11554
11554
|
if (this.silent) {
|
|
11555
11555
|
return false;
|
|
11556
11556
|
}
|
|
@@ -12509,7 +12509,7 @@ var require_diagnostics = __commonJS({
|
|
|
12509
12509
|
modifiers.push(fn);
|
|
12510
12510
|
return true;
|
|
12511
12511
|
}
|
|
12512
|
-
function
|
|
12512
|
+
function write() {
|
|
12513
12513
|
logger2.apply(logger2, arguments);
|
|
12514
12514
|
}
|
|
12515
12515
|
function process2(message) {
|
|
@@ -12539,7 +12539,7 @@ var require_diagnostics = __commonJS({
|
|
|
12539
12539
|
function yep(options) {
|
|
12540
12540
|
function diagnostics() {
|
|
12541
12541
|
var args = Array.prototype.slice.call(arguments, 0);
|
|
12542
|
-
|
|
12542
|
+
write.call(write, options, process2(args, options));
|
|
12543
12543
|
return true;
|
|
12544
12544
|
}
|
|
12545
12545
|
options.enabled = true;
|
|
@@ -12553,7 +12553,7 @@ var require_diagnostics = __commonJS({
|
|
|
12553
12553
|
diagnostics.enabled = enabled;
|
|
12554
12554
|
diagnostics.process = process2;
|
|
12555
12555
|
diagnostics.modify = modify;
|
|
12556
|
-
diagnostics.write =
|
|
12556
|
+
diagnostics.write = write;
|
|
12557
12557
|
diagnostics.nope = nope;
|
|
12558
12558
|
diagnostics.yep = yep;
|
|
12559
12559
|
diagnostics.set = set;
|
|
@@ -17471,8 +17471,8 @@ var require_through = __commonJS({
|
|
|
17471
17471
|
var Stream = require("stream");
|
|
17472
17472
|
exports = module2.exports = through;
|
|
17473
17473
|
through.through = through;
|
|
17474
|
-
function through(
|
|
17475
|
-
|
|
17474
|
+
function through(write, end, opts) {
|
|
17475
|
+
write = write || function(data) {
|
|
17476
17476
|
this.queue(data);
|
|
17477
17477
|
};
|
|
17478
17478
|
end = end || function() {
|
|
@@ -17484,7 +17484,7 @@ var require_through = __commonJS({
|
|
|
17484
17484
|
stream.paused = false;
|
|
17485
17485
|
stream.autoDestroy = !(opts && opts.autoDestroy === false);
|
|
17486
17486
|
stream.write = function(data) {
|
|
17487
|
-
|
|
17487
|
+
write.call(this, data);
|
|
17488
17488
|
return !stream.paused;
|
|
17489
17489
|
};
|
|
17490
17490
|
function drain() {
|
|
@@ -53296,7 +53296,7 @@ var require_cookies = __commonJS({
|
|
|
53296
53296
|
// Standard browser envs support document.cookie
|
|
53297
53297
|
function standardBrowserEnv() {
|
|
53298
53298
|
return {
|
|
53299
|
-
write: function
|
|
53299
|
+
write: function write(name, value, expires, path15, domain, secure) {
|
|
53300
53300
|
var cookie = [];
|
|
53301
53301
|
cookie.push(name + "=" + encodeURIComponent(value));
|
|
53302
53302
|
if (utils.isNumber(expires)) {
|
|
@@ -53326,7 +53326,7 @@ var require_cookies = __commonJS({
|
|
|
53326
53326
|
// Non standard browser env (web workers, react-native) lack needed support.
|
|
53327
53327
|
function nonStandardBrowserEnv() {
|
|
53328
53328
|
return {
|
|
53329
|
-
write: function
|
|
53329
|
+
write: function write() {
|
|
53330
53330
|
},
|
|
53331
53331
|
read: function read() {
|
|
53332
53332
|
return null;
|
|
@@ -551499,7 +551499,7 @@ var require_typescript15 = __commonJS({
|
|
|
551499
551499
|
updateLineCountAndPosFor(s);
|
|
551500
551500
|
}
|
|
551501
551501
|
}
|
|
551502
|
-
function
|
|
551502
|
+
function write(s) {
|
|
551503
551503
|
if (s)
|
|
551504
551504
|
hasTrailingComment = false;
|
|
551505
551505
|
writeText(s);
|
|
@@ -551526,7 +551526,7 @@ var require_typescript15 = __commonJS({
|
|
|
551526
551526
|
}
|
|
551527
551527
|
function writeLiteral(s) {
|
|
551528
551528
|
if (s && s.length) {
|
|
551529
|
-
|
|
551529
|
+
write(s);
|
|
551530
551530
|
}
|
|
551531
551531
|
}
|
|
551532
551532
|
function writeLine(force) {
|
|
@@ -551543,7 +551543,7 @@ var require_typescript15 = __commonJS({
|
|
|
551543
551543
|
}
|
|
551544
551544
|
reset();
|
|
551545
551545
|
return {
|
|
551546
|
-
write
|
|
551546
|
+
write,
|
|
551547
551547
|
rawWrite,
|
|
551548
551548
|
writeLiteral,
|
|
551549
551549
|
writeLine,
|
|
@@ -551584,17 +551584,17 @@ var require_typescript15 = __commonJS({
|
|
|
551584
551584
|
trackSymbol: function() {
|
|
551585
551585
|
return false;
|
|
551586
551586
|
},
|
|
551587
|
-
writeKeyword:
|
|
551588
|
-
writeOperator:
|
|
551589
|
-
writeParameter:
|
|
551590
|
-
writeProperty:
|
|
551591
|
-
writePunctuation:
|
|
551592
|
-
writeSpace:
|
|
551593
|
-
writeStringLiteral:
|
|
551587
|
+
writeKeyword: write,
|
|
551588
|
+
writeOperator: write,
|
|
551589
|
+
writeParameter: write,
|
|
551590
|
+
writeProperty: write,
|
|
551591
|
+
writePunctuation: write,
|
|
551592
|
+
writeSpace: write,
|
|
551593
|
+
writeStringLiteral: write,
|
|
551594
551594
|
writeSymbol: function(s, _) {
|
|
551595
|
-
return
|
|
551595
|
+
return write(s);
|
|
551596
551596
|
},
|
|
551597
|
-
writeTrailingSemicolon:
|
|
551597
|
+
writeTrailingSemicolon: write,
|
|
551598
551598
|
writeComment,
|
|
551599
551599
|
getTextPosWithWriteLine
|
|
551600
551600
|
};
|
|
@@ -646006,7 +646006,7 @@ var require_typescript15 = __commonJS({
|
|
|
646006
646006
|
var nextListElementPos;
|
|
646007
646007
|
var writer;
|
|
646008
646008
|
var ownWriter;
|
|
646009
|
-
var
|
|
646009
|
+
var write = writeBase;
|
|
646010
646010
|
var isOwnFileEmit;
|
|
646011
646011
|
var bundleFileInfo = printerOptions.writeBundleFileInfo ? { sections: [] } : void 0;
|
|
646012
646012
|
var relativeToBuildInfo = bundleFileInfo ? ts3.Debug.checkDefined(printerOptions.relativeToBuildInfo) : void 0;
|
|
@@ -647016,7 +647016,7 @@ var require_typescript15 = __commonJS({
|
|
|
647016
647016
|
nonEscapingWrite("$".concat(snippet.order));
|
|
647017
647017
|
}
|
|
647018
647018
|
function emitIdentifier(node) {
|
|
647019
|
-
var writeText = node.symbol ? writeSymbol :
|
|
647019
|
+
var writeText = node.symbol ? writeSymbol : write;
|
|
647020
647020
|
writeText(getTextOfNode(
|
|
647021
647021
|
node,
|
|
647022
647022
|
/*includeTrivia*/
|
|
@@ -647030,7 +647030,7 @@ var require_typescript15 = __commonJS({
|
|
|
647030
647030
|
);
|
|
647031
647031
|
}
|
|
647032
647032
|
function emitPrivateIdentifier(node) {
|
|
647033
|
-
var writeText = node.symbol ? writeSymbol :
|
|
647033
|
+
var writeText = node.symbol ? writeSymbol : write;
|
|
647034
647034
|
writeText(getTextOfNode(
|
|
647035
647035
|
node,
|
|
647036
647036
|
/*includeTrivia*/
|
|
@@ -648715,7 +648715,7 @@ var require_typescript15 = __commonJS({
|
|
|
648715
648715
|
emitInitializer(node.initializer, node.name.end, node, parenthesizer.parenthesizeExpressionForDisallowedComma);
|
|
648716
648716
|
}
|
|
648717
648717
|
function emitJSDoc(node) {
|
|
648718
|
-
|
|
648718
|
+
write("/**");
|
|
648719
648719
|
if (node.comment) {
|
|
648720
648720
|
var text = ts3.getTextOfJSDocComment(node.comment);
|
|
648721
648721
|
if (text) {
|
|
@@ -648726,7 +648726,7 @@ var require_typescript15 = __commonJS({
|
|
|
648726
648726
|
writeSpace();
|
|
648727
648727
|
writePunctuation("*");
|
|
648728
648728
|
writeSpace();
|
|
648729
|
-
|
|
648729
|
+
write(line);
|
|
648730
648730
|
}
|
|
648731
648731
|
}
|
|
648732
648732
|
}
|
|
@@ -648744,7 +648744,7 @@ var require_typescript15 = __commonJS({
|
|
|
648744
648744
|
}
|
|
648745
648745
|
}
|
|
648746
648746
|
writeSpace();
|
|
648747
|
-
|
|
648747
|
+
write("*/");
|
|
648748
648748
|
}
|
|
648749
648749
|
function emitJSDocSimpleTypedTag(tag) {
|
|
648750
648750
|
emitJSDocTagName(tag.tagName);
|
|
@@ -648790,7 +648790,7 @@ var require_typescript15 = __commonJS({
|
|
|
648790
648790
|
} else {
|
|
648791
648791
|
writeSpace();
|
|
648792
648792
|
writePunctuation("{");
|
|
648793
|
-
|
|
648793
|
+
write("Object");
|
|
648794
648794
|
if (tag.typeExpression.isArrayType) {
|
|
648795
648795
|
writePunctuation("[");
|
|
648796
648796
|
writePunctuation("]");
|
|
@@ -648874,7 +648874,7 @@ var require_typescript15 = __commonJS({
|
|
|
648874
648874
|
var text = ts3.getTextOfJSDocComment(comment);
|
|
648875
648875
|
if (text) {
|
|
648876
648876
|
writeSpace();
|
|
648877
|
-
|
|
648877
|
+
write(text);
|
|
648878
648878
|
}
|
|
648879
648879
|
}
|
|
648880
648880
|
function emitJSDocTypeExpression(typeExpression) {
|
|
@@ -649124,10 +649124,10 @@ var require_typescript15 = __commonJS({
|
|
|
649124
649124
|
function emitNodeWithWriter(node, writer2) {
|
|
649125
649125
|
if (!node)
|
|
649126
649126
|
return;
|
|
649127
|
-
var savedWrite =
|
|
649128
|
-
|
|
649127
|
+
var savedWrite = write;
|
|
649128
|
+
write = writer2;
|
|
649129
649129
|
emit(node);
|
|
649130
|
-
|
|
649130
|
+
write = savedWrite;
|
|
649131
649131
|
}
|
|
649132
649132
|
function emitDecoratorsAndModifiers(node, modifiers) {
|
|
649133
649133
|
if (modifiers === null || modifiers === void 0 ? void 0 : modifiers.length) {
|
|
@@ -649542,7 +649542,7 @@ var require_typescript15 = __commonJS({
|
|
|
649542
649542
|
var line = indentation ? lineText.slice(indentation) : lineText;
|
|
649543
649543
|
if (line.length) {
|
|
649544
649544
|
writeLine();
|
|
649545
|
-
|
|
649545
|
+
write(line);
|
|
649546
649546
|
}
|
|
649547
649547
|
}
|
|
649548
649548
|
}
|
|
@@ -658443,18 +658443,18 @@ var require_typescript15 = __commonJS({
|
|
|
658443
658443
|
return !!program.getState;
|
|
658444
658444
|
}
|
|
658445
658445
|
ts3.isBuilderProgram = isBuilderProgram;
|
|
658446
|
-
function listFiles(program,
|
|
658446
|
+
function listFiles(program, write) {
|
|
658447
658447
|
var options = program.getCompilerOptions();
|
|
658448
658448
|
if (options.explainFiles) {
|
|
658449
|
-
explainFiles(isBuilderProgram(program) ? program.getProgram() : program,
|
|
658449
|
+
explainFiles(isBuilderProgram(program) ? program.getProgram() : program, write);
|
|
658450
658450
|
} else if (options.listFiles || options.listFilesOnly) {
|
|
658451
658451
|
ts3.forEach(program.getSourceFiles(), function(file) {
|
|
658452
|
-
|
|
658452
|
+
write(file.fileName);
|
|
658453
658453
|
});
|
|
658454
658454
|
}
|
|
658455
658455
|
}
|
|
658456
658456
|
ts3.listFiles = listFiles;
|
|
658457
|
-
function explainFiles(program,
|
|
658457
|
+
function explainFiles(program, write) {
|
|
658458
658458
|
var _a, _b;
|
|
658459
658459
|
var reasons = program.getFileIncludeReasons();
|
|
658460
658460
|
var getCanonicalFileName = ts3.createGetCanonicalFileName(program.useCaseSensitiveFileNames());
|
|
@@ -658463,12 +658463,12 @@ var require_typescript15 = __commonJS({
|
|
|
658463
658463
|
};
|
|
658464
658464
|
for (var _i = 0, _c = program.getSourceFiles(); _i < _c.length; _i++) {
|
|
658465
658465
|
var file = _c[_i];
|
|
658466
|
-
|
|
658466
|
+
write("".concat(toFileName(file, relativeFileName)));
|
|
658467
658467
|
(_a = reasons.get(file.path)) === null || _a === void 0 ? void 0 : _a.forEach(function(reason) {
|
|
658468
|
-
return
|
|
658468
|
+
return write(" ".concat(fileIncludeReasonToDiagnostics(program, reason, relativeFileName).messageText));
|
|
658469
658469
|
});
|
|
658470
658470
|
(_b = explainIfFileIsRedirectAndImpliedFormat(file, relativeFileName)) === null || _b === void 0 ? void 0 : _b.forEach(function(d) {
|
|
658471
|
-
return
|
|
658471
|
+
return write(" ".concat(d.messageText));
|
|
658472
658472
|
});
|
|
658473
658473
|
}
|
|
658474
658474
|
}
|
|
@@ -658683,7 +658683,7 @@ var require_typescript15 = __commonJS({
|
|
|
658683
658683
|
var fileName = ts3.isString(file) ? file : file.fileName;
|
|
658684
658684
|
return fileNameConvertor ? fileNameConvertor(fileName) : fileName;
|
|
658685
658685
|
}
|
|
658686
|
-
function emitFilesAndReportErrors(program, reportDiagnostic,
|
|
658686
|
+
function emitFilesAndReportErrors(program, reportDiagnostic, write, reportSummary, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) {
|
|
658687
658687
|
var isListFilesOnly = !!program.getCompilerOptions().listFilesOnly;
|
|
658688
658688
|
var allDiagnostics = program.getConfigFileParsingDiagnostics().slice();
|
|
658689
658689
|
var configFileParsingDiagnosticsLength = allDiagnostics.length;
|
|
@@ -658717,13 +658717,13 @@ var require_typescript15 = __commonJS({
|
|
|
658717
658717
|
ts3.addRange(allDiagnostics, emitDiagnostics);
|
|
658718
658718
|
var diagnostics = ts3.sortAndDeduplicateDiagnostics(allDiagnostics);
|
|
658719
658719
|
diagnostics.forEach(reportDiagnostic);
|
|
658720
|
-
if (
|
|
658720
|
+
if (write) {
|
|
658721
658721
|
var currentDir_1 = program.getCurrentDirectory();
|
|
658722
658722
|
ts3.forEach(emittedFiles, function(file) {
|
|
658723
658723
|
var filepath = ts3.getNormalizedAbsolutePath(file, currentDir_1);
|
|
658724
|
-
|
|
658724
|
+
write("TSFILE: ".concat(filepath));
|
|
658725
658725
|
});
|
|
658726
|
-
listFiles(program,
|
|
658726
|
+
listFiles(program, write);
|
|
658727
658727
|
}
|
|
658728
658728
|
if (reportSummary) {
|
|
658729
658729
|
reportSummary(getErrorCountForSummary(diagnostics), getFilesInErrorForSummary(diagnostics));
|
|
@@ -658734,8 +658734,8 @@ var require_typescript15 = __commonJS({
|
|
|
658734
658734
|
};
|
|
658735
658735
|
}
|
|
658736
658736
|
ts3.emitFilesAndReportErrors = emitFilesAndReportErrors;
|
|
658737
|
-
function emitFilesAndReportErrorsAndGetExitStatus(program, reportDiagnostic,
|
|
658738
|
-
var _a = emitFilesAndReportErrors(program, reportDiagnostic,
|
|
658737
|
+
function emitFilesAndReportErrorsAndGetExitStatus(program, reportDiagnostic, write, reportSummary, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) {
|
|
658738
|
+
var _a = emitFilesAndReportErrors(program, reportDiagnostic, write, reportSummary, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers), emitResult = _a.emitResult, diagnostics = _a.diagnostics;
|
|
658739
658739
|
if (emitResult.emitSkipped && diagnostics.length > 0) {
|
|
658740
658740
|
return ts3.ExitStatus.DiagnosticsPresent_OutputsSkipped;
|
|
658741
658741
|
} else if (diagnostics.length > 0) {
|
|
@@ -658944,7 +658944,7 @@ var require_typescript15 = __commonJS({
|
|
|
658944
658944
|
if (system === void 0) {
|
|
658945
658945
|
system = ts3.sys;
|
|
658946
658946
|
}
|
|
658947
|
-
var
|
|
658947
|
+
var write = function(s) {
|
|
658948
658948
|
return system.write(s + system.newLine);
|
|
658949
658949
|
};
|
|
658950
658950
|
var result = createProgramHost(system, createProgram);
|
|
@@ -658954,7 +658954,7 @@ var require_typescript15 = __commonJS({
|
|
|
658954
658954
|
var newLine = ts3.getNewLineCharacter(compilerOptions, function() {
|
|
658955
658955
|
return system.newLine;
|
|
658956
658956
|
});
|
|
658957
|
-
emitFilesAndReportErrors(builderProgram, reportDiagnostic,
|
|
658957
|
+
emitFilesAndReportErrors(builderProgram, reportDiagnostic, write, function(errorCount) {
|
|
658958
658958
|
return result.onWatchStatusChange(ts3.createCompilerDiagnostic(getWatchErrorSummaryDiagnosticMessage(errorCount), errorCount), newLine, compilerOptions, errorCount);
|
|
658959
658959
|
});
|
|
658960
658960
|
};
|
|
@@ -660682,9 +660682,9 @@ var require_typescript15 = __commonJS({
|
|
|
660682
660682
|
return createInvalidatedProjectWithInfo(state, info, buildOrder);
|
|
660683
660683
|
}
|
|
660684
660684
|
function listEmittedFile(_a, proj, file) {
|
|
660685
|
-
var
|
|
660686
|
-
if (
|
|
660687
|
-
|
|
660685
|
+
var write = _a.write;
|
|
660686
|
+
if (write && proj.options.listEmittedFiles) {
|
|
660687
|
+
write("TSFILE: ".concat(file));
|
|
660688
660688
|
}
|
|
660689
660689
|
}
|
|
660690
660690
|
function getOldProgram(_a, proj, parsed) {
|
|
@@ -668850,15 +668850,15 @@ var require_typescript15 = __commonJS({
|
|
|
668850
668850
|
printSnippetList,
|
|
668851
668851
|
printAndFormatSnippetList
|
|
668852
668852
|
};
|
|
668853
|
-
function escapingWrite(s,
|
|
668853
|
+
function escapingWrite(s, write) {
|
|
668854
668854
|
var escaped = ts3.escapeSnippetText(s);
|
|
668855
668855
|
if (escaped !== s) {
|
|
668856
668856
|
var start = baseWriter.getTextPos();
|
|
668857
|
-
|
|
668857
|
+
write();
|
|
668858
668858
|
var end = baseWriter.getTextPos();
|
|
668859
668859
|
escapes = ts3.append(escapes || (escapes = []), { newText: escaped, span: { start, length: end - start } });
|
|
668860
668860
|
} else {
|
|
668861
|
-
|
|
668861
|
+
write();
|
|
668862
668862
|
}
|
|
668863
668863
|
}
|
|
668864
668864
|
function printSnippetList(format2, list, sourceFile) {
|
|
@@ -686355,7 +686355,7 @@ var require_typescript15 = __commonJS({
|
|
|
686355
686355
|
lastNonTriviaPosition -= i;
|
|
686356
686356
|
}
|
|
686357
686357
|
}
|
|
686358
|
-
function
|
|
686358
|
+
function write(s) {
|
|
686359
686359
|
writer.write(s);
|
|
686360
686360
|
setLastNonTriviaPosition(
|
|
686361
686361
|
s,
|
|
@@ -686492,7 +686492,7 @@ var require_typescript15 = __commonJS({
|
|
|
686492
686492
|
onAfterEmitNodeArray,
|
|
686493
686493
|
onBeforeEmitToken,
|
|
686494
686494
|
onAfterEmitToken,
|
|
686495
|
-
write
|
|
686495
|
+
write,
|
|
686496
686496
|
writeComment,
|
|
686497
686497
|
writeKeyword,
|
|
686498
686498
|
writeOperator,
|
|
@@ -737895,7 +737895,7 @@ async function printProjectInfo(opts) {
|
|
|
737895
737895
|
|
|
737896
737896
|
// src/actions/localization-strings.ts
|
|
737897
737897
|
var import_chalk7 = __toESM(require_source());
|
|
737898
|
-
var
|
|
737898
|
+
var import_lodash20 = __toESM(require_lodash());
|
|
737899
737899
|
|
|
737900
737900
|
// src/actions/project-token.ts
|
|
737901
737901
|
var import_chalk4 = __toESM(require_source());
|
|
@@ -739453,118 +739453,9 @@ function asyncOneAtATime(f, bounceValue) {
|
|
|
739453
739453
|
};
|
|
739454
739454
|
}
|
|
739455
739455
|
|
|
739456
|
-
// src/actions/localization-strings.ts
|
|
739457
|
-
function getLocalizationYargs(key) {
|
|
739458
|
-
if (key === "key-scheme") {
|
|
739459
|
-
return {
|
|
739460
|
-
describe: "What value to use as message keys; `content` uses the message content itself, `hash` uses a hash of the content, and `path` uses a a hierarchical string containing the project id, component name, element name, and related variants, and does not encode the text content in the key. Defaults to whatever is specified in plasmic.json, or `content`",
|
|
739461
|
-
type: "string",
|
|
739462
|
-
choices: ["content", "hash", "path"]
|
|
739463
|
-
};
|
|
739464
|
-
} else if (key === "tag-prefix") {
|
|
739465
|
-
return {
|
|
739466
|
-
describe: "By default, rich text with markup tags look like '<0>hello</0>'. If your localization framework requires num-numeric tags, then specify a prefix; for example a prefix of 'n' turns it into '<n0>hello</n0>'.",
|
|
739467
|
-
type: "string"
|
|
739468
|
-
};
|
|
739469
|
-
} else {
|
|
739470
|
-
throw new Error(`Unexpected localization option ${key}`);
|
|
739471
|
-
}
|
|
739472
|
-
}
|
|
739473
|
-
async function localizationStrings(opts) {
|
|
739474
|
-
var _a, _b, _c;
|
|
739475
|
-
if (!opts.baseDir) {
|
|
739476
|
-
opts.baseDir = process.cwd();
|
|
739477
|
-
}
|
|
739478
|
-
const maybeConfigFile = opts.config || findConfigFile(opts.baseDir, { traverseParents: true });
|
|
739479
|
-
let projectSpecs = opts.projects;
|
|
739480
|
-
let keyScheme = opts.keyScheme;
|
|
739481
|
-
let tagPrefix = opts.tagPrefix;
|
|
739482
|
-
const projectTokensFromConfig = [];
|
|
739483
|
-
if (maybeConfigFile) {
|
|
739484
|
-
logger.info(`Using settings from ${maybeConfigFile}...`);
|
|
739485
|
-
const context = await getContext(opts, { enableSkipAuth: true });
|
|
739486
|
-
context.config.projects.forEach((p) => {
|
|
739487
|
-
projectTokensFromConfig.push((0, import_lodash19.pick)(p, "projectId", "projectApiToken"));
|
|
739488
|
-
});
|
|
739489
|
-
if (!projectSpecs || projectSpecs.length === 0) {
|
|
739490
|
-
projectSpecs = context.config.projects.map(
|
|
739491
|
-
(p) => p.projectId + (p.version === "latest" ? "" : `@${p.version}`)
|
|
739492
|
-
);
|
|
739493
|
-
}
|
|
739494
|
-
if (!keyScheme) {
|
|
739495
|
-
keyScheme = (_a = context.config.i18n) == null ? void 0 : _a.keyScheme;
|
|
739496
|
-
}
|
|
739497
|
-
if (!tagPrefix) {
|
|
739498
|
-
tagPrefix = (_b = context.config.i18n) == null ? void 0 : _b.tagPrefix;
|
|
739499
|
-
}
|
|
739500
|
-
}
|
|
739501
|
-
if (!projectSpecs || projectSpecs.length === 0) {
|
|
739502
|
-
throw new HandledError(`Missing projects.`);
|
|
739503
|
-
}
|
|
739504
|
-
const parsedProjectTokens = ((_c = opts.projectTokens) != null ? _c : []).map((val) => {
|
|
739505
|
-
const [projectId, projectApiToken] = val.split(":");
|
|
739506
|
-
if (!projectId || !projectApiToken) {
|
|
739507
|
-
throw new Error(
|
|
739508
|
-
`Invalid value passed to '--project-tokens': ${val}
|
|
739509
|
-
Please provide the API tokens with the format PROJECT_ID:PROJECT_API_TOKEN`
|
|
739510
|
-
);
|
|
739511
|
-
}
|
|
739512
|
-
return {
|
|
739513
|
-
projectId: projectId.trim(),
|
|
739514
|
-
projectApiToken: projectApiToken.trim()
|
|
739515
|
-
};
|
|
739516
|
-
});
|
|
739517
|
-
const output = !opts.output ? opts.format === "po" ? "data.po" : "data.json" : opts.output;
|
|
739518
|
-
const auth2 = await getCurrentAuth(opts.auth);
|
|
739519
|
-
const projectIdsAndTokens = [
|
|
739520
|
-
...parsedProjectTokens,
|
|
739521
|
-
...projectTokensFromConfig
|
|
739522
|
-
].filter((v) => !!v && !!v.projectId && !!v.projectApiToken);
|
|
739523
|
-
if (auth2 || projectIdsAndTokens.length > 0) {
|
|
739524
|
-
const api = new PlasmicApi(
|
|
739525
|
-
auth2 != null ? auth2 : {
|
|
739526
|
-
host: DEFAULT_HOST,
|
|
739527
|
-
user: "",
|
|
739528
|
-
token: ""
|
|
739529
|
-
}
|
|
739530
|
-
);
|
|
739531
|
-
logger.info(
|
|
739532
|
-
`Generating localization strings for ${import_chalk7.default.bold(
|
|
739533
|
-
projectSpecs.join(", ")
|
|
739534
|
-
)}...`
|
|
739535
|
-
);
|
|
739536
|
-
const data = await api.genLocalizationStrings(
|
|
739537
|
-
projectSpecs,
|
|
739538
|
-
opts.format,
|
|
739539
|
-
keyScheme != null ? keyScheme : "content",
|
|
739540
|
-
tagPrefix,
|
|
739541
|
-
projectIdsAndTokens,
|
|
739542
|
-
opts.excludeDeps
|
|
739543
|
-
);
|
|
739544
|
-
if (existsBuffered(output)) {
|
|
739545
|
-
const overwrite = await confirmWithUser(
|
|
739546
|
-
`File ${output} already exists. Do you want to overwrite?`,
|
|
739547
|
-
opts.forceOverwrite || opts.yes
|
|
739548
|
-
);
|
|
739549
|
-
if (!overwrite) {
|
|
739550
|
-
throw new HandledError(
|
|
739551
|
-
`Cannot write to ${output}; file already exists.`
|
|
739552
|
-
);
|
|
739553
|
-
}
|
|
739554
|
-
}
|
|
739555
|
-
writeFileText(output, data);
|
|
739556
|
-
logger.info(`Localization strings have been written to ${output}`);
|
|
739557
|
-
} else {
|
|
739558
|
-
logger.error(`Missing auth information. You can follow any of the steps below to fix it:
|
|
739559
|
-
- Run 'plasmic auth'
|
|
739560
|
-
- Provide the project API token to 'plasmic.json'
|
|
739561
|
-
- Or provide the project API token through '--project-tokens' flag`);
|
|
739562
|
-
}
|
|
739563
|
-
}
|
|
739564
|
-
|
|
739565
739456
|
// src/actions/export.ts
|
|
739566
|
-
var import_lodash20 = __toESM(require_lodash());
|
|
739567
739457
|
var import_fs3 = require("fs");
|
|
739458
|
+
var import_lodash19 = __toESM(require_lodash());
|
|
739568
739459
|
var import_path2 = __toESM(require("path"));
|
|
739569
739460
|
async function exportProjectsCli(opts) {
|
|
739570
739461
|
var _a, _b;
|
|
@@ -739575,7 +739466,7 @@ async function exportProjectsCli(opts) {
|
|
|
739575
739466
|
opts.baseDir = process.cwd();
|
|
739576
739467
|
let configFile = opts.config || findConfigFile(opts.baseDir, { traverseParents: true });
|
|
739577
739468
|
let context = configFile ? await getContext(opts, { enableSkipAuth: true }) : void 0;
|
|
739578
|
-
const projectConfigMap = (0,
|
|
739469
|
+
const projectConfigMap = (0, import_lodash19.keyBy)(
|
|
739579
739470
|
(_a = context == null ? void 0 : context.config.projects) != null ? _a : [],
|
|
739580
739471
|
(p) => p.projectId
|
|
739581
739472
|
);
|
|
@@ -739620,7 +739511,7 @@ async function exportProjectsCli(opts) {
|
|
|
739620
739511
|
if (typeof content === "string" && !opts.skipFormatting) {
|
|
739621
739512
|
content = formatAsLocal(content, fileName, opts.outDir);
|
|
739622
739513
|
}
|
|
739623
|
-
const projectName = (0,
|
|
739514
|
+
const projectName = (0, import_lodash19.snakeCase)(bundle.projectConfig.projectName);
|
|
739624
739515
|
promises.push(
|
|
739625
739516
|
(async () => {
|
|
739626
739517
|
await import_fs3.promises.mkdir(import_path2.default.join(outPath, projectName), { recursive: true });
|
|
@@ -739670,9 +739561,7 @@ async function exportProjectsCli(opts) {
|
|
|
739670
739561
|
reactRuntime: "classic"
|
|
739671
739562
|
},
|
|
739672
739563
|
images: {
|
|
739673
|
-
scheme: opts.imagesScheme || "files"
|
|
739674
|
-
publicDir: opts.imagesPublicDir,
|
|
739675
|
-
publicUrlPrefix: opts.imagesPublicUrlPrefix
|
|
739564
|
+
scheme: opts.imagesScheme || "files"
|
|
739676
739565
|
},
|
|
739677
739566
|
style: {
|
|
739678
739567
|
scheme: opts.styleScheme || "css-modules",
|
|
@@ -739681,7 +739570,7 @@ async function exportProjectsCli(opts) {
|
|
|
739681
739570
|
tokens: {},
|
|
739682
739571
|
globalVariants: {
|
|
739683
739572
|
variantGroups: result.flatMap((bundle) => {
|
|
739684
|
-
const projectName = (0,
|
|
739573
|
+
const projectName = (0, import_lodash19.snakeCase)(bundle.projectConfig.projectName);
|
|
739685
739574
|
return bundle.globalVariants.map((gv) => ({
|
|
739686
739575
|
id: gv.id,
|
|
739687
739576
|
name: gv.name,
|
|
@@ -739691,7 +739580,7 @@ async function exportProjectsCli(opts) {
|
|
|
739691
739580
|
})
|
|
739692
739581
|
},
|
|
739693
739582
|
projects: result.map((bundle) => {
|
|
739694
|
-
const projectName = (0,
|
|
739583
|
+
const projectName = (0, import_lodash19.snakeCase)(bundle.projectConfig.projectName);
|
|
739695
739584
|
return {
|
|
739696
739585
|
projectId: bundle.projectConfig.projectId,
|
|
739697
739586
|
projectName: bundle.projectConfig.projectName,
|
|
@@ -739826,6 +739715,115 @@ async function exportProjects(api, opts) {
|
|
|
739826
739715
|
return result;
|
|
739827
739716
|
}
|
|
739828
739717
|
|
|
739718
|
+
// src/actions/localization-strings.ts
|
|
739719
|
+
function getLocalizationYargs(key) {
|
|
739720
|
+
if (key === "key-scheme") {
|
|
739721
|
+
return {
|
|
739722
|
+
describe: "What value to use as message keys; `content` uses the message content itself, `hash` uses a hash of the content, and `path` uses a a hierarchical string containing the project id, component name, element name, and related variants, and does not encode the text content in the key. Defaults to whatever is specified in plasmic.json, or `content`",
|
|
739723
|
+
type: "string",
|
|
739724
|
+
choices: ["content", "hash", "path"]
|
|
739725
|
+
};
|
|
739726
|
+
} else if (key === "tag-prefix") {
|
|
739727
|
+
return {
|
|
739728
|
+
describe: "By default, rich text with markup tags look like '<0>hello</0>'. If your localization framework requires num-numeric tags, then specify a prefix; for example a prefix of 'n' turns it into '<n0>hello</n0>'.",
|
|
739729
|
+
type: "string"
|
|
739730
|
+
};
|
|
739731
|
+
} else {
|
|
739732
|
+
throw new Error(`Unexpected localization option ${key}`);
|
|
739733
|
+
}
|
|
739734
|
+
}
|
|
739735
|
+
async function localizationStrings(opts) {
|
|
739736
|
+
var _a, _b, _c;
|
|
739737
|
+
if (!opts.baseDir) {
|
|
739738
|
+
opts.baseDir = process.cwd();
|
|
739739
|
+
}
|
|
739740
|
+
const maybeConfigFile = opts.config || findConfigFile(opts.baseDir, { traverseParents: true });
|
|
739741
|
+
let projectSpecs = opts.projects;
|
|
739742
|
+
let keyScheme = opts.keyScheme;
|
|
739743
|
+
let tagPrefix = opts.tagPrefix;
|
|
739744
|
+
const projectTokensFromConfig = [];
|
|
739745
|
+
if (maybeConfigFile) {
|
|
739746
|
+
logger.info(`Using settings from ${maybeConfigFile}...`);
|
|
739747
|
+
const context = await getContext(opts, { enableSkipAuth: true });
|
|
739748
|
+
context.config.projects.forEach((p) => {
|
|
739749
|
+
projectTokensFromConfig.push((0, import_lodash20.pick)(p, "projectId", "projectApiToken"));
|
|
739750
|
+
});
|
|
739751
|
+
if (!projectSpecs || projectSpecs.length === 0) {
|
|
739752
|
+
projectSpecs = context.config.projects.map(
|
|
739753
|
+
(p) => p.projectId + (p.version === "latest" ? "" : `@${p.version}`)
|
|
739754
|
+
);
|
|
739755
|
+
}
|
|
739756
|
+
if (!keyScheme) {
|
|
739757
|
+
keyScheme = (_a = context.config.i18n) == null ? void 0 : _a.keyScheme;
|
|
739758
|
+
}
|
|
739759
|
+
if (!tagPrefix) {
|
|
739760
|
+
tagPrefix = (_b = context.config.i18n) == null ? void 0 : _b.tagPrefix;
|
|
739761
|
+
}
|
|
739762
|
+
}
|
|
739763
|
+
if (!projectSpecs || projectSpecs.length === 0) {
|
|
739764
|
+
throw new HandledError(`Missing projects.`);
|
|
739765
|
+
}
|
|
739766
|
+
const parsedProjectTokens = ((_c = opts.projectTokens) != null ? _c : []).map((val) => {
|
|
739767
|
+
const [projectId, projectApiToken] = val.split(":");
|
|
739768
|
+
if (!projectId || !projectApiToken) {
|
|
739769
|
+
throw new Error(
|
|
739770
|
+
`Invalid value passed to '--project-tokens': ${val}
|
|
739771
|
+
Please provide the API tokens with the format PROJECT_ID:PROJECT_API_TOKEN`
|
|
739772
|
+
);
|
|
739773
|
+
}
|
|
739774
|
+
return {
|
|
739775
|
+
projectId: projectId.trim(),
|
|
739776
|
+
projectApiToken: projectApiToken.trim()
|
|
739777
|
+
};
|
|
739778
|
+
});
|
|
739779
|
+
const output = !opts.output ? opts.format === "po" ? "data.po" : "data.json" : opts.output;
|
|
739780
|
+
const auth2 = await getCurrentAuth(opts.auth);
|
|
739781
|
+
const projectIdsAndTokens = [
|
|
739782
|
+
...parsedProjectTokens,
|
|
739783
|
+
...projectTokensFromConfig
|
|
739784
|
+
].filter((v) => !!v && !!v.projectId && !!v.projectApiToken);
|
|
739785
|
+
if (auth2 || projectIdsAndTokens.length > 0) {
|
|
739786
|
+
const api = new PlasmicApi(
|
|
739787
|
+
auth2 != null ? auth2 : {
|
|
739788
|
+
host: DEFAULT_HOST,
|
|
739789
|
+
user: "",
|
|
739790
|
+
token: ""
|
|
739791
|
+
}
|
|
739792
|
+
);
|
|
739793
|
+
logger.info(
|
|
739794
|
+
`Generating localization strings for ${import_chalk7.default.bold(
|
|
739795
|
+
projectSpecs.join(", ")
|
|
739796
|
+
)}...`
|
|
739797
|
+
);
|
|
739798
|
+
const data = await api.genLocalizationStrings(
|
|
739799
|
+
projectSpecs,
|
|
739800
|
+
opts.format,
|
|
739801
|
+
keyScheme != null ? keyScheme : "content",
|
|
739802
|
+
tagPrefix,
|
|
739803
|
+
projectIdsAndTokens,
|
|
739804
|
+
opts.excludeDeps
|
|
739805
|
+
);
|
|
739806
|
+
if (existsBuffered(output)) {
|
|
739807
|
+
const overwrite = await confirmWithUser(
|
|
739808
|
+
`File ${output} already exists. Do you want to overwrite?`,
|
|
739809
|
+
opts.forceOverwrite || opts.yes
|
|
739810
|
+
);
|
|
739811
|
+
if (!overwrite) {
|
|
739812
|
+
throw new HandledError(
|
|
739813
|
+
`Cannot write to ${output}; file already exists.`
|
|
739814
|
+
);
|
|
739815
|
+
}
|
|
739816
|
+
}
|
|
739817
|
+
writeFileText(output, data);
|
|
739818
|
+
logger.info(`Localization strings have been written to ${output}`);
|
|
739819
|
+
} else {
|
|
739820
|
+
logger.error(`Missing auth information. You can follow any of the steps below to fix it:
|
|
739821
|
+
- Run 'plasmic auth'
|
|
739822
|
+
- Provide the project API token to 'plasmic.json'
|
|
739823
|
+
- Or provide the project API token through '--project-tokens' flag`);
|
|
739824
|
+
}
|
|
739825
|
+
}
|
|
739826
|
+
|
|
739829
739827
|
// src/index.ts
|
|
739830
739828
|
if (process.env.DEBUG_CHDIR) {
|
|
739831
739829
|
process.chdir(process.env.DEBUG_CHDIR);
|
|
@@ -740030,10 +740028,11 @@ import_yargs.default.usage("Usage: $0 <command> [options]").option("auth", {
|
|
|
740030
740028
|
alias: "o",
|
|
740031
740029
|
describe: "Folder to output exported code to",
|
|
740032
740030
|
type: "string"
|
|
740033
|
-
}).option("platform", getYargsOption("platform")).option("code-lang", getYargsOption("codeLang")).option("code-scheme", getYargsOption("codeScheme")).option("style-scheme", getYargsOption("styleScheme")).option("images-scheme",
|
|
740034
|
-
"images-
|
|
740035
|
-
|
|
740036
|
-
|
|
740031
|
+
}).option("platform", getYargsOption("platform")).option("code-lang", getYargsOption("codeLang")).option("code-scheme", getYargsOption("codeScheme")).option("style-scheme", getYargsOption("styleScheme")).option("images-scheme", {
|
|
740032
|
+
describe: "How to reference used images in designs; either `inlined`, which puts base64-encoded images directly into the React component files, or `files`, which puts images on disk and imports them from component files.",
|
|
740033
|
+
type: "string",
|
|
740034
|
+
choices: ["inlined", "files"]
|
|
740035
|
+
}).option("i18n-key-scheme", getLocalizationYargs("key-scheme")).option("i18n-tag-prefix", getLocalizationYargs("tag-prefix")),
|
|
740037
740036
|
(argv) => handleError(exportProjectsCli(argv))
|
|
740038
740037
|
).demandCommand().strict().help("h").alias("h", "help").argv;
|
|
740039
740038
|
function configureSyncArgs(yags, includeQuietOption = true) {
|