@plasmicapp/cli 0.1.301 → 0.1.303
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/sync.d.ts +1 -0
- package/dist/index.js +37 -10
- package/dist/lib.d.ts +1 -0
- package/dist/lib.js +417 -297
- package/package.json +2 -2
- package/src/actions/sync.ts +10 -3
- package/src/index.ts +6 -0
- package/src/lib.ts +4 -0
- package/src/utils/code-utils.ts +28 -8
package/dist/actions/sync.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export interface SyncArgs extends CommonArgs {
|
|
|
13
13
|
allFiles?: boolean;
|
|
14
14
|
loaderConfig?: string;
|
|
15
15
|
skipFormatting?: boolean;
|
|
16
|
+
skipBuffering?: boolean;
|
|
16
17
|
}
|
|
17
18
|
/**
|
|
18
19
|
* Sync will always try to sync down a set of components that are version-consistent among specified projects.
|
package/dist/index.js
CHANGED
|
@@ -735439,6 +735439,7 @@ async function fixAllImportStatements(context, baseDir, summary) {
|
|
|
735439
735439
|
logger.info("Fixing import statements...");
|
|
735440
735440
|
const config = context.config;
|
|
735441
735441
|
const fixImportContext = mkFixImportContext(config);
|
|
735442
|
+
let lastError = void 0;
|
|
735442
735443
|
for (const project of config.projects) {
|
|
735443
735444
|
for (const compConfig of project.components) {
|
|
735444
735445
|
const compSummary = summary == null ? void 0 : summary.get(compConfig.id);
|
|
@@ -735447,17 +735448,34 @@ async function fixAllImportStatements(context, baseDir, summary) {
|
|
|
735447
735448
|
}
|
|
735448
735449
|
const fixSkeletonModule = compSummary ? compSummary.skeletonModuleModified : true;
|
|
735449
735450
|
if (!summary || compSummary) {
|
|
735450
|
-
|
|
735451
|
-
|
|
735452
|
-
|
|
735453
|
-
|
|
735454
|
-
|
|
735455
|
-
|
|
735456
|
-
|
|
735451
|
+
try {
|
|
735452
|
+
await fixComponentImportStatements(
|
|
735453
|
+
context,
|
|
735454
|
+
compConfig,
|
|
735455
|
+
fixImportContext,
|
|
735456
|
+
fixSkeletonModule,
|
|
735457
|
+
baseDir
|
|
735458
|
+
);
|
|
735459
|
+
} catch (err) {
|
|
735460
|
+
logger.error(
|
|
735461
|
+
`Error encountered while fixing imports for ${compConfig.name}: ${err}`
|
|
735462
|
+
);
|
|
735463
|
+
lastError = err;
|
|
735464
|
+
}
|
|
735457
735465
|
}
|
|
735458
735466
|
}
|
|
735459
735467
|
}
|
|
735460
|
-
|
|
735468
|
+
try {
|
|
735469
|
+
fixGlobalContextImportStatements(context, fixImportContext, baseDir);
|
|
735470
|
+
} catch (err) {
|
|
735471
|
+
logger.error(
|
|
735472
|
+
`Error encountered while fixing imports for global contexts: ${err}`
|
|
735473
|
+
);
|
|
735474
|
+
lastError = err;
|
|
735475
|
+
}
|
|
735476
|
+
if (lastError) {
|
|
735477
|
+
throw lastError;
|
|
735478
|
+
}
|
|
735461
735479
|
}
|
|
735462
735480
|
async function fixComponentImportStatements(context, compConfig, fixImportContext, fixSkeletonModule, baseDir) {
|
|
735463
735481
|
if (compConfig.type !== "mapped" && isLocalModulePath(compConfig.importSpec.modulePath) && fixSkeletonModule) {
|
|
@@ -738943,7 +738961,7 @@ async function sync(opts, metadataDefaults) {
|
|
|
738943
738961
|
context.api.attachProjectIdsAndTokens(projectIdsAndTokens);
|
|
738944
738962
|
const externalNpmPackages = /* @__PURE__ */ new Set();
|
|
738945
738963
|
const externalCssImports = /* @__PURE__ */ new Set();
|
|
738946
|
-
|
|
738964
|
+
const doSync = async () => {
|
|
738947
738965
|
var _a2;
|
|
738948
738966
|
for (const projectMeta of projectsToSync) {
|
|
738949
738967
|
await syncProject(
|
|
@@ -739012,7 +739030,12 @@ async function sync(opts, metadataDefaults) {
|
|
|
739012
739030
|
}
|
|
739013
739031
|
});
|
|
739014
739032
|
await updateConfig(context, context.config, baseDir);
|
|
739015
|
-
}
|
|
739033
|
+
};
|
|
739034
|
+
if (opts.skipBuffering) {
|
|
739035
|
+
await doSync();
|
|
739036
|
+
} else {
|
|
739037
|
+
await withBufferedFs(doSync);
|
|
739038
|
+
}
|
|
739016
739039
|
await checkExternalPkgs(
|
|
739017
739040
|
context,
|
|
739018
739041
|
baseDir,
|
|
@@ -739778,6 +739801,10 @@ function configureSyncArgs(yags, includeQuietOption = true) {
|
|
|
739778
739801
|
type: "boolean",
|
|
739779
739802
|
describe: "Disables formatting on generated code",
|
|
739780
739803
|
default: false
|
|
739804
|
+
}).option("skip-buffering", {
|
|
739805
|
+
type: "boolean",
|
|
739806
|
+
describe: "Write files directly to disk, instead of buffering and only writing if sync completes successfully",
|
|
739807
|
+
default: false
|
|
739781
739808
|
}).option("all-files", {
|
|
739782
739809
|
type: "boolean",
|
|
739783
739810
|
describe: "Sync all files, including those that haven't changed since last sync",
|
package/dist/lib.d.ts
CHANGED
|
@@ -8,3 +8,4 @@ export { WatchArgs, watchProjects } from "./actions/watch";
|
|
|
8
8
|
export { logger } from "./deps";
|
|
9
9
|
export { HandledError, handleError } from "./utils/error";
|
|
10
10
|
export { Metadata, setMetadataEnv } from "./utils/get-context";
|
|
11
|
+
export { localizationStrings, LocalizationStringsArgs, } from "./actions/localization-strings";
|