@webflow/webflow-cli 1.2.4 → 1.3.0

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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @webflow/webflow-cli
2
2
 
3
+ ## 1.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Add the ability to serve manifest files from cli and include them in bundling.
8
+
9
+ ## 1.2.5
10
+
11
+ ### Patch Changes
12
+
13
+ - Always use Webflow's prettier config for DevLink components
14
+
3
15
  ## 1.2.4
4
16
 
5
17
  ### Patch Changes
package/dist/index.js CHANGED
@@ -2020,60 +2020,25 @@ var require_public_api = __commonJS({
2020
2020
  var require_package2 = __commonJS({
2021
2021
  "../../node_modules/prettier/package.json"(exports, module2) {
2022
2022
  module2.exports = {
2023
- _from: "prettier@latest",
2024
- _id: "prettier@2.8.8",
2025
- _inBundle: false,
2026
- _integrity: "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==",
2027
- _location: "/prettier",
2028
- _phantomChildren: {},
2029
- _requested: {
2030
- type: "tag",
2031
- registry: true,
2032
- raw: "prettier@latest",
2033
- name: "prettier",
2034
- escapedName: "prettier",
2035
- rawSpec: "latest",
2036
- saveSpec: null,
2037
- fetchSpec: "latest"
2038
- },
2039
- _requiredBy: [
2040
- "#DEV:/"
2041
- ],
2042
- _resolved: "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz",
2043
- _shasum: "e8c5d7e98a4305ffe3de2e1fc4aca1a71c28b1da",
2044
- _spec: "prettier@latest",
2045
- _where: "/Users/federico/source/webflow-cli",
2046
- author: {
2047
- name: "James Long"
2048
- },
2049
- bin: {
2050
- prettier: "bin-prettier.js"
2051
- },
2052
- browser: "./standalone.js",
2053
- bugs: {
2054
- url: "https://github.com/prettier/prettier/issues"
2055
- },
2056
- bundleDependencies: false,
2057
- deprecated: false,
2023
+ name: "prettier",
2024
+ version: "2.8.8",
2058
2025
  description: "Prettier is an opinionated code formatter",
2026
+ bin: "./bin-prettier.js",
2027
+ repository: "prettier/prettier",
2028
+ funding: "https://github.com/prettier/prettier?sponsor=1",
2029
+ homepage: "https://prettier.io",
2030
+ author: "James Long",
2031
+ license: "MIT",
2032
+ main: "./index.js",
2033
+ browser: "./standalone.js",
2034
+ unpkg: "./standalone.js",
2059
2035
  engines: {
2060
2036
  node: ">=10.13.0"
2061
2037
  },
2062
2038
  files: [
2063
2039
  "*.js",
2064
2040
  "esm/*.mjs"
2065
- ],
2066
- funding: "https://github.com/prettier/prettier?sponsor=1",
2067
- homepage: "https://prettier.io",
2068
- license: "MIT",
2069
- main: "./index.js",
2070
- name: "prettier",
2071
- repository: {
2072
- type: "git",
2073
- url: "git+https://github.com/prettier/prettier.git"
2074
- },
2075
- unpkg: "./standalone.js",
2076
- version: "2.8.8"
2041
+ ]
2077
2042
  };
2078
2043
  }
2079
2044
  });
@@ -226263,6 +226228,35 @@ var import_fs = require("fs");
226263
226228
  var import_promises = require("fs/promises");
226264
226229
  var path2 = __toESM(require("path"));
226265
226230
  var import_prettier = __toESM(require_prettier());
226231
+
226232
+ // ../../packages/devlink/src/constants.ts
226233
+ var PRETTIER_CONFIG = {
226234
+ printWidth: 80,
226235
+ tabWidth: 2,
226236
+ useTabs: false,
226237
+ semi: true,
226238
+ singleQuote: false,
226239
+ quoteProps: "as-needed",
226240
+ jsxSingleQuote: false,
226241
+ trailingComma: "es5",
226242
+ bracketSpacing: true,
226243
+ bracketSameLine: false,
226244
+ jsxBracketSameLine: false,
226245
+ arrowParens: "always",
226246
+ requirePragma: false,
226247
+ insertPragma: false,
226248
+ proseWrap: "preserve",
226249
+ htmlWhitespaceSensitivity: "css",
226250
+ vueIndentScriptAndStyle: false,
226251
+ endOfLine: "lf",
226252
+ embeddedLanguageFormatting: "auto",
226253
+ singleAttributePerLine: false,
226254
+ // CLI specific options
226255
+ parser: "babel",
226256
+ pluginSearchDirs: false
226257
+ };
226258
+
226259
+ // ../../packages/devlink/src/fileUtils.ts
226266
226260
  var options = {
226267
226261
  modules: {},
226268
226262
  useClient: true
@@ -226287,15 +226281,8 @@ async function writeComponents(components, config) {
226287
226281
  const absRoot = path2.join(process.cwd(), rootDir);
226288
226282
  if (!(0, import_fs.existsSync)(absRoot))
226289
226283
  await (0, import_promises.mkdir)(absRoot);
226290
- const prettierConfig = await import_prettier.default.resolveConfig(process.cwd()) ?? {};
226291
226284
  exportedModules.forEach((m) => IndexState.addEntry(m.name, m.options));
226292
- await writeSyncedComponents(
226293
- absRoot,
226294
- components,
226295
- config,
226296
- prettierConfig,
226297
- cssModules
226298
- );
226285
+ await writeSyncedComponents(absRoot, components, config, cssModules);
226299
226286
  const componentLookup = components.reduce(
226300
226287
  (result, component) => ({
226301
226288
  ...result,
@@ -226321,7 +226308,7 @@ async function writeComponents(components, config) {
226321
226308
  return Promise.resolve();
226322
226309
  })
226323
226310
  );
226324
- writeIndexFile(IndexState.getFile(), absRoot, prettierConfig);
226311
+ writeIndexFile(IndexState.getFile(), absRoot);
226325
226312
  }
226326
226313
  function replaceEnvVariables(content = "", config) {
226327
226314
  const envVariables = (config == null ? void 0 : config.envVariables) ?? {};
@@ -226333,7 +226320,7 @@ function replaceEnvVariables(content = "", config) {
226333
226320
  });
226334
226321
  return content;
226335
226322
  }
226336
- async function writeSyncedComponents(rootDir, components, config, prettierConfig, cssModules) {
226323
+ async function writeSyncedComponents(rootDir, components, config, cssModules) {
226337
226324
  await Promise.all(
226338
226325
  components.flatMap((c) => {
226339
226326
  const promises = [];
@@ -226343,11 +226330,7 @@ async function writeSyncedComponents(rootDir, components, config, prettierConfig
226343
226330
  }
226344
226331
  if (c.js) {
226345
226332
  const content = replaceEnvVariables(c.js, config);
226346
- const parser = prettierConfig.parser ?? "babel";
226347
- const prettifiedContent = import_prettier.default.format(content, {
226348
- ...prettierConfig,
226349
- parser
226350
- });
226333
+ const prettifiedContent = import_prettier.default.format(content, PRETTIER_CONFIG);
226351
226334
  const shouldReplaceExtension = !devlinkFiles.has(c.name) || ["interactions", "devlinkContext"].includes(c.name);
226352
226335
  const extension2 = shouldReplaceExtension ? config.fileExtensions.js.replace(/\W/gi, "") : DEFAULT_EXTENSIONS.js;
226353
226336
  const pathToWrite = path2.join(rootDir, `${c.name}.${extension2}`);
@@ -226373,7 +226356,7 @@ async function writeSyncedComponents(rootDir, components, config, prettierConfig
226373
226356
  (0, import_fs.writeFileSync)(
226374
226357
  path2.join(rootDir, `${c.name}.d.ts`),
226375
226358
  import_prettier.default.format(c.types, {
226376
- ...prettierConfig,
226359
+ ...PRETTIER_CONFIG,
226377
226360
  parser: "typescript"
226378
226361
  }),
226379
226362
  { flag: "w+" }
@@ -226394,20 +226377,17 @@ async function mkdirRecursive(rootDir, path4) {
226394
226377
  }
226395
226378
  }
226396
226379
  }
226397
- function writeIndexFile(content, rootDir, prettierConfig) {
226380
+ function writeIndexFile(content, rootDir) {
226398
226381
  (0, import_fs.writeFileSync)(
226399
226382
  path2.join(rootDir, "index.js"),
226400
- import_prettier.default.format(content, {
226401
- ...prettierConfig,
226402
- parser: prettierConfig.parser ?? "babel"
226403
- }),
226383
+ import_prettier.default.format(content, PRETTIER_CONFIG),
226404
226384
  { flag: "w+" }
226405
226385
  );
226406
226386
  (0, import_fs.writeFileSync)(
226407
226387
  path2.join(rootDir, "index.d.ts"),
226408
226388
  import_prettier.default.format(content, {
226409
- ...prettierConfig,
226410
- parser: prettierConfig.parser ?? "typescript"
226389
+ ...PRETTIER_CONFIG,
226390
+ parser: "typescript"
226411
226391
  }),
226412
226392
  { flag: "w+" }
226413
226393
  );
@@ -229074,7 +229054,7 @@ var UncaughtErrorHandler = class {
229074
229054
  this.error = error2;
229075
229055
  }
229076
229056
  stripPII(str = "") {
229077
- return str.replace(/\/(.*)webflow-cli/gi, "/REDACTED_PII/webflow-cli/");
229057
+ return str.replace(/\/(.*)webflow-cli/gi, "/REDACTED_PII/webflow-cli/").replace(/\/(.*)node_modules/gi, "/REDACTED_PII/node_modules");
229078
229058
  }
229079
229059
  sendTelemetry() {
229080
229060
  const config = this.config;
@@ -229336,6 +229316,15 @@ var serveExtension = async () => {
229336
229316
  });
229337
229317
  return;
229338
229318
  }
229319
+ if (request.url === "/__webflow") {
229320
+ response.writeHead(200, {
229321
+ "Content-Length": Buffer.byteLength(prettyJson(manifest.config)),
229322
+ "Content-Type": "application/json",
229323
+ "Access-Control-Allow-Origin": "*",
229324
+ "Access-Control-Allow-Headers": "*"
229325
+ });
229326
+ return response.end(prettyJson(manifest.config));
229327
+ }
229339
229328
  (0, import_serve_handler.default)(request, response, {
229340
229329
  public: distDir,
229341
229330
  cleanUrls: false,
@@ -229390,17 +229379,16 @@ button:focus {
229390
229379
  border-color: #1280EE;
229391
229380
  }
229392
229381
  `;
229393
- var indexTs = `document.getElementById("lorem").onsubmit = (event) => {
229382
+ var indexTs = `document.getElementById("lorem").onsubmit = async (event) => {
229394
229383
  event.preventDefault()
229395
- webflow.getSelectedElement().then(el => {
229396
- if (el && el.textContent) {
229397
- el.setTextContent(
229398
- "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do " +
229399
- "eiusmod tempor incididunt ut labore et dolore magna aliqua."
229400
- )
229401
- el.save()
229402
- }
229403
- })
229384
+ const el = await webflow.getSelectedElement();
229385
+ if (el && el.textContent) {
229386
+ el.setTextContent(
229387
+ "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do " +
229388
+ "eiusmod tempor incididunt ut labore et dolore magna aliqua."
229389
+ )
229390
+ el.save()
229391
+ }
229404
229392
  }
229405
229393
  `;
229406
229394
  var readme = `
@@ -229504,6 +229492,7 @@ var bundleExtension = async () => {
229504
229492
  });
229505
229493
  archive.pipe(output);
229506
229494
  archive.directory(import_path.default.join(cwd, distDir), false);
229495
+ archive.file(manifest.filepath, { name: manifestFile });
229507
229496
  archive.finalize();
229508
229497
  });
229509
229498
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webflow/webflow-cli",
3
- "version": "1.2.4",
3
+ "version": "1.3.0",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "bin": {
6
6
  "webflow": "./dist/index.js"