@webflow/webflow-cli 1.2.3 → 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 +12 -0
- package/dist/index.js +41 -25
- 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
|
|
@@ -226270,6 +226299,7 @@ var options = {
|
|
|
226270
226299
|
var IndexState = createIndexFileState(options);
|
|
226271
226300
|
var exportedModules = [
|
|
226272
226301
|
{ name: "_Builtin", options: { as: "_Builtin" } },
|
|
226302
|
+
{ name: "devlinkContext" },
|
|
226273
226303
|
{ name: "interactions" },
|
|
226274
226304
|
{ name: "utils" },
|
|
226275
226305
|
{ name: "devlink" }
|
|
@@ -226286,15 +226316,8 @@ async function writeComponents(components, config) {
|
|
|
226286
226316
|
const absRoot = path2.join(process.cwd(), rootDir);
|
|
226287
226317
|
if (!(0, import_fs.existsSync)(absRoot))
|
|
226288
226318
|
await (0, import_promises.mkdir)(absRoot);
|
|
226289
|
-
const prettierConfig = await import_prettier.default.resolveConfig(process.cwd()) ?? {};
|
|
226290
226319
|
exportedModules.forEach((m) => IndexState.addEntry(m.name, m.options));
|
|
226291
|
-
await writeSyncedComponents(
|
|
226292
|
-
absRoot,
|
|
226293
|
-
components,
|
|
226294
|
-
config,
|
|
226295
|
-
prettierConfig,
|
|
226296
|
-
cssModules
|
|
226297
|
-
);
|
|
226320
|
+
await writeSyncedComponents(absRoot, components, config, cssModules);
|
|
226298
226321
|
const componentLookup = components.reduce(
|
|
226299
226322
|
(result, component) => ({
|
|
226300
226323
|
...result,
|
|
@@ -226320,7 +226343,7 @@ async function writeComponents(components, config) {
|
|
|
226320
226343
|
return Promise.resolve();
|
|
226321
226344
|
})
|
|
226322
226345
|
);
|
|
226323
|
-
writeIndexFile(IndexState.getFile(), absRoot
|
|
226346
|
+
writeIndexFile(IndexState.getFile(), absRoot);
|
|
226324
226347
|
}
|
|
226325
226348
|
function replaceEnvVariables(content = "", config) {
|
|
226326
226349
|
const envVariables = (config == null ? void 0 : config.envVariables) ?? {};
|
|
@@ -226332,7 +226355,7 @@ function replaceEnvVariables(content = "", config) {
|
|
|
226332
226355
|
});
|
|
226333
226356
|
return content;
|
|
226334
226357
|
}
|
|
226335
|
-
async function writeSyncedComponents(rootDir, components, config,
|
|
226358
|
+
async function writeSyncedComponents(rootDir, components, config, cssModules) {
|
|
226336
226359
|
await Promise.all(
|
|
226337
226360
|
components.flatMap((c) => {
|
|
226338
226361
|
const promises = [];
|
|
@@ -226342,12 +226365,8 @@ async function writeSyncedComponents(rootDir, components, config, prettierConfig
|
|
|
226342
226365
|
}
|
|
226343
226366
|
if (c.js) {
|
|
226344
226367
|
const content = replaceEnvVariables(c.js, config);
|
|
226345
|
-
const
|
|
226346
|
-
const
|
|
226347
|
-
...prettierConfig,
|
|
226348
|
-
parser
|
|
226349
|
-
});
|
|
226350
|
-
const shouldReplaceExtension = !devlinkFiles.has(c.name) || ["interactions"].includes(c.name);
|
|
226368
|
+
const prettifiedContent = import_prettier.default.format(content, PRETTIER_CONFIG);
|
|
226369
|
+
const shouldReplaceExtension = !devlinkFiles.has(c.name) || ["interactions", "devlinkContext"].includes(c.name);
|
|
226351
226370
|
const extension2 = shouldReplaceExtension ? config.fileExtensions.js.replace(/\W/gi, "") : DEFAULT_EXTENSIONS.js;
|
|
226352
226371
|
const pathToWrite = path2.join(rootDir, `${c.name}.${extension2}`);
|
|
226353
226372
|
promises.push(
|
|
@@ -226372,7 +226391,7 @@ async function writeSyncedComponents(rootDir, components, config, prettierConfig
|
|
|
226372
226391
|
(0, import_fs.writeFileSync)(
|
|
226373
226392
|
path2.join(rootDir, `${c.name}.d.ts`),
|
|
226374
226393
|
import_prettier.default.format(c.types, {
|
|
226375
|
-
...
|
|
226394
|
+
...PRETTIER_CONFIG,
|
|
226376
226395
|
parser: "typescript"
|
|
226377
226396
|
}),
|
|
226378
226397
|
{ flag: "w+" }
|
|
@@ -226393,20 +226412,17 @@ async function mkdirRecursive(rootDir, path4) {
|
|
|
226393
226412
|
}
|
|
226394
226413
|
}
|
|
226395
226414
|
}
|
|
226396
|
-
function writeIndexFile(content, rootDir
|
|
226415
|
+
function writeIndexFile(content, rootDir) {
|
|
226397
226416
|
(0, import_fs.writeFileSync)(
|
|
226398
226417
|
path2.join(rootDir, "index.js"),
|
|
226399
|
-
import_prettier.default.format(content,
|
|
226400
|
-
...prettierConfig,
|
|
226401
|
-
parser: prettierConfig.parser ?? "babel"
|
|
226402
|
-
}),
|
|
226418
|
+
import_prettier.default.format(content, PRETTIER_CONFIG),
|
|
226403
226419
|
{ flag: "w+" }
|
|
226404
226420
|
);
|
|
226405
226421
|
(0, import_fs.writeFileSync)(
|
|
226406
226422
|
path2.join(rootDir, "index.d.ts"),
|
|
226407
226423
|
import_prettier.default.format(content, {
|
|
226408
|
-
...
|
|
226409
|
-
parser:
|
|
226424
|
+
...PRETTIER_CONFIG,
|
|
226425
|
+
parser: "typescript"
|
|
226410
226426
|
}),
|
|
226411
226427
|
{ flag: "w+" }
|
|
226412
226428
|
);
|
|
@@ -229073,7 +229089,7 @@ var UncaughtErrorHandler = class {
|
|
|
229073
229089
|
this.error = error2;
|
|
229074
229090
|
}
|
|
229075
229091
|
stripPII(str = "") {
|
|
229076
|
-
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");
|
|
229077
229093
|
}
|
|
229078
229094
|
sendTelemetry() {
|
|
229079
229095
|
const config = this.config;
|