@webflow/webflow-cli 1.2.4 → 1.2.5
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/CHANGELOG.md +6 -0
- package/dist/index.js +39 -24
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -226263,6 +226263,35 @@ var import_fs = require("fs");
|
|
|
226263
226263
|
var import_promises = require("fs/promises");
|
|
226264
226264
|
var path2 = __toESM(require("path"));
|
|
226265
226265
|
var import_prettier = __toESM(require_prettier());
|
|
226266
|
+
|
|
226267
|
+
// ../../packages/devlink/src/constants.ts
|
|
226268
|
+
var PRETTIER_CONFIG = {
|
|
226269
|
+
printWidth: 80,
|
|
226270
|
+
tabWidth: 2,
|
|
226271
|
+
useTabs: false,
|
|
226272
|
+
semi: true,
|
|
226273
|
+
singleQuote: false,
|
|
226274
|
+
quoteProps: "as-needed",
|
|
226275
|
+
jsxSingleQuote: false,
|
|
226276
|
+
trailingComma: "es5",
|
|
226277
|
+
bracketSpacing: true,
|
|
226278
|
+
bracketSameLine: false,
|
|
226279
|
+
jsxBracketSameLine: false,
|
|
226280
|
+
arrowParens: "always",
|
|
226281
|
+
requirePragma: false,
|
|
226282
|
+
insertPragma: false,
|
|
226283
|
+
proseWrap: "preserve",
|
|
226284
|
+
htmlWhitespaceSensitivity: "css",
|
|
226285
|
+
vueIndentScriptAndStyle: false,
|
|
226286
|
+
endOfLine: "lf",
|
|
226287
|
+
embeddedLanguageFormatting: "auto",
|
|
226288
|
+
singleAttributePerLine: false,
|
|
226289
|
+
// CLI specific options
|
|
226290
|
+
parser: "babel",
|
|
226291
|
+
pluginSearchDirs: false
|
|
226292
|
+
};
|
|
226293
|
+
|
|
226294
|
+
// ../../packages/devlink/src/fileUtils.ts
|
|
226266
226295
|
var options = {
|
|
226267
226296
|
modules: {},
|
|
226268
226297
|
useClient: true
|
|
@@ -226287,15 +226316,8 @@ async function writeComponents(components, config) {
|
|
|
226287
226316
|
const absRoot = path2.join(process.cwd(), rootDir);
|
|
226288
226317
|
if (!(0, import_fs.existsSync)(absRoot))
|
|
226289
226318
|
await (0, import_promises.mkdir)(absRoot);
|
|
226290
|
-
const prettierConfig = await import_prettier.default.resolveConfig(process.cwd()) ?? {};
|
|
226291
226319
|
exportedModules.forEach((m) => IndexState.addEntry(m.name, m.options));
|
|
226292
|
-
await writeSyncedComponents(
|
|
226293
|
-
absRoot,
|
|
226294
|
-
components,
|
|
226295
|
-
config,
|
|
226296
|
-
prettierConfig,
|
|
226297
|
-
cssModules
|
|
226298
|
-
);
|
|
226320
|
+
await writeSyncedComponents(absRoot, components, config, cssModules);
|
|
226299
226321
|
const componentLookup = components.reduce(
|
|
226300
226322
|
(result, component) => ({
|
|
226301
226323
|
...result,
|
|
@@ -226321,7 +226343,7 @@ async function writeComponents(components, config) {
|
|
|
226321
226343
|
return Promise.resolve();
|
|
226322
226344
|
})
|
|
226323
226345
|
);
|
|
226324
|
-
writeIndexFile(IndexState.getFile(), absRoot
|
|
226346
|
+
writeIndexFile(IndexState.getFile(), absRoot);
|
|
226325
226347
|
}
|
|
226326
226348
|
function replaceEnvVariables(content = "", config) {
|
|
226327
226349
|
const envVariables = (config == null ? void 0 : config.envVariables) ?? {};
|
|
@@ -226333,7 +226355,7 @@ function replaceEnvVariables(content = "", config) {
|
|
|
226333
226355
|
});
|
|
226334
226356
|
return content;
|
|
226335
226357
|
}
|
|
226336
|
-
async function writeSyncedComponents(rootDir, components, config,
|
|
226358
|
+
async function writeSyncedComponents(rootDir, components, config, cssModules) {
|
|
226337
226359
|
await Promise.all(
|
|
226338
226360
|
components.flatMap((c) => {
|
|
226339
226361
|
const promises = [];
|
|
@@ -226343,11 +226365,7 @@ async function writeSyncedComponents(rootDir, components, config, prettierConfig
|
|
|
226343
226365
|
}
|
|
226344
226366
|
if (c.js) {
|
|
226345
226367
|
const content = replaceEnvVariables(c.js, config);
|
|
226346
|
-
const
|
|
226347
|
-
const prettifiedContent = import_prettier.default.format(content, {
|
|
226348
|
-
...prettierConfig,
|
|
226349
|
-
parser
|
|
226350
|
-
});
|
|
226368
|
+
const prettifiedContent = import_prettier.default.format(content, PRETTIER_CONFIG);
|
|
226351
226369
|
const shouldReplaceExtension = !devlinkFiles.has(c.name) || ["interactions", "devlinkContext"].includes(c.name);
|
|
226352
226370
|
const extension2 = shouldReplaceExtension ? config.fileExtensions.js.replace(/\W/gi, "") : DEFAULT_EXTENSIONS.js;
|
|
226353
226371
|
const pathToWrite = path2.join(rootDir, `${c.name}.${extension2}`);
|
|
@@ -226373,7 +226391,7 @@ async function writeSyncedComponents(rootDir, components, config, prettierConfig
|
|
|
226373
226391
|
(0, import_fs.writeFileSync)(
|
|
226374
226392
|
path2.join(rootDir, `${c.name}.d.ts`),
|
|
226375
226393
|
import_prettier.default.format(c.types, {
|
|
226376
|
-
...
|
|
226394
|
+
...PRETTIER_CONFIG,
|
|
226377
226395
|
parser: "typescript"
|
|
226378
226396
|
}),
|
|
226379
226397
|
{ flag: "w+" }
|
|
@@ -226394,20 +226412,17 @@ async function mkdirRecursive(rootDir, path4) {
|
|
|
226394
226412
|
}
|
|
226395
226413
|
}
|
|
226396
226414
|
}
|
|
226397
|
-
function writeIndexFile(content, rootDir
|
|
226415
|
+
function writeIndexFile(content, rootDir) {
|
|
226398
226416
|
(0, import_fs.writeFileSync)(
|
|
226399
226417
|
path2.join(rootDir, "index.js"),
|
|
226400
|
-
import_prettier.default.format(content,
|
|
226401
|
-
...prettierConfig,
|
|
226402
|
-
parser: prettierConfig.parser ?? "babel"
|
|
226403
|
-
}),
|
|
226418
|
+
import_prettier.default.format(content, PRETTIER_CONFIG),
|
|
226404
226419
|
{ flag: "w+" }
|
|
226405
226420
|
);
|
|
226406
226421
|
(0, import_fs.writeFileSync)(
|
|
226407
226422
|
path2.join(rootDir, "index.d.ts"),
|
|
226408
226423
|
import_prettier.default.format(content, {
|
|
226409
|
-
...
|
|
226410
|
-
parser:
|
|
226424
|
+
...PRETTIER_CONFIG,
|
|
226425
|
+
parser: "typescript"
|
|
226411
226426
|
}),
|
|
226412
226427
|
{ flag: "w+" }
|
|
226413
226428
|
);
|
|
@@ -229074,7 +229089,7 @@ var UncaughtErrorHandler = class {
|
|
|
229074
229089
|
this.error = error2;
|
|
229075
229090
|
}
|
|
229076
229091
|
stripPII(str = "") {
|
|
229077
|
-
return str.replace(/\/(.*)webflow-cli/gi, "/REDACTED_PII/webflow-cli/");
|
|
229092
|
+
return str.replace(/\/(.*)webflow-cli/gi, "/REDACTED_PII/webflow-cli/").replace(/\/(.*)node_modules/gi, "/REDACTED_PII/node_modules");
|
|
229078
229093
|
}
|
|
229079
229094
|
sendTelemetry() {
|
|
229080
229095
|
const config = this.config;
|