@diagonal-hq/cli 0.43.3 → 0.45.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.
@@ -4,7 +4,7 @@ import {
4
4
  frontMatterUidInsertion,
5
5
  readDefinitionUid,
6
6
  require_dist
7
- } from "./cli-chunk-KRD6O5UC.mjs";
7
+ } from "./cli-chunk-5LB73PFA.mjs";
8
8
  import {
9
9
  SourceError,
10
10
  characterCount,
@@ -12,7 +12,7 @@ import {
12
12
  diagnosticAt,
13
13
  diagnosticFromError,
14
14
  withoutDevInfix
15
- } from "./cli-chunk-KP2RSHLJ.mjs";
15
+ } from "./cli-chunk-LJLGXFPO.mjs";
16
16
  import {
17
17
  __toESM
18
18
  } from "./cli-chunk-LRS5IEI3.mjs";
@@ -3,7 +3,7 @@ const require = __diagonalCreateRequire(import.meta.url);
3
3
  import {
4
4
  SourceError,
5
5
  propertyKey
6
- } from "./cli-chunk-KP2RSHLJ.mjs";
6
+ } from "./cli-chunk-LJLGXFPO.mjs";
7
7
  import {
8
8
  __commonJS,
9
9
  __require,
@@ -7,7 +7,7 @@ import {
7
7
  assetsBinding,
8
8
  buildAssets,
9
9
  isAssetKey
10
- } from "./cli-chunk-LBQOYO4G.mjs";
10
+ } from "./cli-chunk-ZPBVMA7R.mjs";
11
11
  import {
12
12
  SourceError,
13
13
  bindsName,
@@ -18,7 +18,7 @@ import {
18
18
  staticObject,
19
19
  studlyName,
20
20
  traverse
21
- } from "./cli-chunk-KP2RSHLJ.mjs";
21
+ } from "./cli-chunk-LJLGXFPO.mjs";
22
22
 
23
23
  // scripts/lib/runtime-build/api-cli.mjs
24
24
  import { existsSync, readFileSync } from "node:fs";
@@ -20,7 +20,7 @@ import {
20
20
  testSourceImportMessage,
21
21
  unsupportedImportMessage,
22
22
  withoutDevInfix
23
- } from "./cli-chunk-KP2RSHLJ.mjs";
23
+ } from "./cli-chunk-LJLGXFPO.mjs";
24
24
  import {
25
25
  __commonJS,
26
26
  __export,
@@ -2,15 +2,15 @@ import { createRequire as __diagonalCreateRequire } from 'node:module';
2
2
  const require = __diagonalCreateRequire(import.meta.url);
3
3
  import {
4
4
  stringFacts
5
- } from "./cli-chunk-EHIY7LHO.mjs";
5
+ } from "./cli-chunk-DZ3RH64Z.mjs";
6
6
  import {
7
7
  readUid
8
- } from "./cli-chunk-KRD6O5UC.mjs";
8
+ } from "./cli-chunk-5LB73PFA.mjs";
9
9
  import {
10
10
  SourceError,
11
11
  declaredSlug,
12
12
  propertyKey
13
- } from "./cli-chunk-KP2RSHLJ.mjs";
13
+ } from "./cli-chunk-LJLGXFPO.mjs";
14
14
 
15
15
  // scripts/lib/runtime-build/workflow-config.mjs
16
16
  var WORKFLOW_STAGE = "workflow";
@@ -4,10 +4,10 @@ import {
4
4
  SystemPermissions,
5
5
  isTimezone,
6
6
  isUrl
7
- } from "./cli-chunk-EHIY7LHO.mjs";
7
+ } from "./cli-chunk-DZ3RH64Z.mjs";
8
8
  import {
9
9
  UID_PATTERN
10
- } from "./cli-chunk-KRD6O5UC.mjs";
10
+ } from "./cli-chunk-5LB73PFA.mjs";
11
11
  import {
12
12
  AUTHORING_MODULE,
13
13
  BUILT_IN_RESOURCE_SLUGS,
@@ -29,7 +29,7 @@ import {
29
29
  staticValue,
30
30
  studlyName,
31
31
  withoutDevInfix
32
- } from "./cli-chunk-KP2RSHLJ.mjs";
32
+ } from "./cli-chunk-LJLGXFPO.mjs";
33
33
 
34
34
  // packages/cli/workspace-settings-catalog.json
35
35
  var workspace_settings_catalog_default = {
@@ -428,6 +428,7 @@ var PAGE_SDK_EXPORTS = Object.freeze({
428
428
  DeleteResourceRecord: ["Components", "DeleteResourceRecord"],
429
429
  Dnd: ["Dnd"],
430
430
  DropdownMenu: ["Components", "DropdownMenu"],
431
+ EmailBuilder: ["Components", "EmailBuilder"],
431
432
  EmailComposer: ["Components", "EmailComposer"],
432
433
  EmailMessages: ["Components", "EmailMessages"],
433
434
  EmptyState: ["Components", "EmptyState"],
@@ -724,6 +725,7 @@ var PAGE_SDK_TYPES = {
724
725
  EmailAttemptEvent: { "parameters": "", "arguments": "" },
725
726
  EmailAttemptRecipients: { "parameters": "", "arguments": "" },
726
727
  EmailAttemptStatus: { "parameters": "", "arguments": "" },
728
+ EmailDocument: { "parameters": "", "arguments": "" },
727
729
  EmailMessage: { "parameters": "", "arguments": "" },
728
730
  EmailMessages: { "parameters": "", "arguments": "" },
729
731
  EmailMessagesFilters: { "parameters": "", "arguments": "" },
@@ -764,6 +766,7 @@ var PAGE_SDK_TYPES = {
764
766
  NavigateOptions: { "parameters": "", "arguments": "" },
765
767
  NavigationMenu: { "parameters": "", "arguments": "" },
766
768
  NavigationMenuCatalog: { "parameters": "", "arguments": "" },
769
+ NavigationMenuModule: { "parameters": "", "arguments": "" },
767
770
  NotificationChannel: { "parameters": "", "arguments": "" },
768
771
  NotificationChannelAvailability: { "parameters": "", "arguments": "" },
769
772
  NotificationChannelUnavailableReason: { "parameters": "", "arguments": "" },
@@ -7,7 +7,7 @@ import {
7
7
  expectDefineCall,
8
8
  generatedBindingLocal,
9
9
  staticObject
10
- } from "./cli-chunk-KP2RSHLJ.mjs";
10
+ } from "./cli-chunk-LJLGXFPO.mjs";
11
11
 
12
12
  // scripts/lib/runtime-build/assets.mjs
13
13
  var ASSET_KEY = /^[a-z][A-Za-z0-9]*$/;
@@ -10,9 +10,9 @@ import {
10
10
  skillFrontMatter,
11
11
  skillUidDefinition,
12
12
  writeSkillFile
13
- } from "./cli-chunk-3LF7KYRH.mjs";
14
- import "./cli-chunk-KRD6O5UC.mjs";
15
- import "./cli-chunk-KP2RSHLJ.mjs";
13
+ } from "./cli-chunk-2U4B6MFK.mjs";
14
+ import "./cli-chunk-5LB73PFA.mjs";
15
+ import "./cli-chunk-LJLGXFPO.mjs";
16
16
  import "./cli-chunk-LRS5IEI3.mjs";
17
17
  export {
18
18
  SKILL_DESCRIPTION_MAX_LENGTH,
@@ -3,7 +3,7 @@ const require = __diagonalCreateRequire(import.meta.url);
3
3
  import {
4
4
  WORKFLOW_STAGE,
5
5
  stripTypes
6
- } from "./cli-chunk-ZCZKOXUH.mjs";
6
+ } from "./cli-chunk-I2TWWQ3W.mjs";
7
7
  import {
8
8
  scriptSdkRuntimeFiles
9
9
  } from "./cli-chunk-6HPUF67L.mjs";
@@ -15,11 +15,11 @@ import {
15
15
  appModuleClosure,
16
16
  isAppSpecifier,
17
17
  resolveAppSpecifier
18
- } from "./cli-chunk-EHIY7LHO.mjs";
19
- import "./cli-chunk-KRD6O5UC.mjs";
18
+ } from "./cli-chunk-DZ3RH64Z.mjs";
19
+ import "./cli-chunk-5LB73PFA.mjs";
20
20
  import {
21
21
  GENERATED_ASSETS_PATH
22
- } from "./cli-chunk-LBQOYO4G.mjs";
22
+ } from "./cli-chunk-ZPBVMA7R.mjs";
23
23
  import {
24
24
  AUTHORING_MODULE,
25
25
  SourceError,
@@ -28,7 +28,7 @@ import {
28
28
  diagnosticAt,
29
29
  diagnosticFromError,
30
30
  parseSource
31
- } from "./cli-chunk-KP2RSHLJ.mjs";
31
+ } from "./cli-chunk-LJLGXFPO.mjs";
32
32
  import "./cli-chunk-LRS5IEI3.mjs";
33
33
 
34
34
  // scripts/lib/runtime-build/workflows.mjs
package/dist/cli.mjs CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  buildSkill,
6
6
  isSkillPath,
7
7
  writeSkillFile
8
- } from "./cli-chunk-3LF7KYRH.mjs";
8
+ } from "./cli-chunk-2U4B6MFK.mjs";
9
9
  import {
10
10
  DOMAINS_EXPORT,
11
11
  DOMAIN_REFERENCE_MESSAGE,
@@ -46,7 +46,7 @@ import {
46
46
  routeBindingsSource,
47
47
  routeParamNames,
48
48
  workspace_settings_catalog_default
49
- } from "./cli-chunk-HQJJ3ZAJ.mjs";
49
+ } from "./cli-chunk-IUHDCZQP.mjs";
50
50
  import {
51
51
  TRIGGER_TYPES,
52
52
  compareVersions,
@@ -58,7 +58,7 @@ import {
58
58
  workflowConfigObject,
59
59
  workflowMetadata,
60
60
  workspaceBuildNeeds
61
- } from "./cli-chunk-ZCZKOXUH.mjs";
61
+ } from "./cli-chunk-I2TWWQ3W.mjs";
62
62
  import {
63
63
  GENERATED_NOTIFICATION_TYPES_MODULE,
64
64
  GENERATED_WORKFLOWS_MODULE,
@@ -79,12 +79,12 @@ import {
79
79
  templateSlugOf,
80
80
  workflowEntries,
81
81
  workflowNames
82
- } from "./cli-chunk-EHIY7LHO.mjs";
82
+ } from "./cli-chunk-DZ3RH64Z.mjs";
83
83
  import {
84
84
  isUid,
85
85
  readDefinitionUid,
86
86
  readUid
87
- } from "./cli-chunk-KRD6O5UC.mjs";
87
+ } from "./cli-chunk-5LB73PFA.mjs";
88
88
  import {
89
89
  ASSETS_LIST_USAGE,
90
90
  ASSETS_PATH,
@@ -105,14 +105,14 @@ import {
105
105
  withWorkspaceEnv,
106
106
  writeAssetCatalog,
107
107
  writeAssetEntry
108
- } from "./cli-chunk-FR2ZNG34.mjs";
108
+ } from "./cli-chunk-ASQLI5JT.mjs";
109
109
  import {
110
110
  ASSETS_EXPORT,
111
111
  GENERATED_ASSETS_MODULE,
112
112
  assetKeyMessage,
113
113
  assetsBinding,
114
114
  isAssetKey
115
- } from "./cli-chunk-LBQOYO4G.mjs";
115
+ } from "./cli-chunk-ZPBVMA7R.mjs";
116
116
  import {
117
117
  APP_PREFIX,
118
118
  AUTHORING_MODULE,
@@ -181,7 +181,7 @@ import {
181
181
  traverse,
182
182
  usesImplicitName,
183
183
  withoutDevInfix
184
- } from "./cli-chunk-KP2RSHLJ.mjs";
184
+ } from "./cli-chunk-LJLGXFPO.mjs";
185
185
  import {
186
186
  __commonJS,
187
187
  __require,
@@ -9216,12 +9216,13 @@ ${code}
9216
9216
  previous = bindPackageSource(previous, vendorFile(previousPath)?.path ?? previousPath, bindings);
9217
9217
  }
9218
9218
  const parts = () => {
9219
- const { helpers, component } = splitFactoryBody(code);
9219
+ const { statements: codeImports, rest: factoryCode } = leadingImports(code);
9220
+ const { helpers, component } = splitFactoryBody(factoryCode);
9220
9221
  let imports = previous === null ? [DEFAULT_IMPORT, ...extraImports].join("\n") : importsOf(previous);
9221
9222
  if (previousPath !== null && posix3.dirname(previousPath) !== posix3.dirname(path)) {
9222
9223
  imports = rebasedImports(imports, previousPath, path);
9223
9224
  }
9224
- return { imports, helpers, component, trailing: "" };
9225
+ return { imports: withCodeImports(imports, codeImports), helpers, component, trailing: "" };
9225
9226
  };
9226
9227
  return writeParts(path, options, parts, {
9227
9228
  previous,
@@ -9775,6 +9776,50 @@ function unboundElementsOnly(ast, name) {
9775
9776
  );
9776
9777
  return [...new Set(rendered)].filter((local) => !otherUses.has(local) && !bindsName(ast, local));
9777
9778
  }
9779
+ var LEADING_IMPORT = /^\s*import\s+(?:[\s\S]*?\s+from\s+)?['"][^'"]+['"];?[ \t]*\n?/;
9780
+ function leadingImports(code) {
9781
+ const statements = [];
9782
+ let rest = code;
9783
+ let match = LEADING_IMPORT.exec(rest);
9784
+ while (match !== null) {
9785
+ statements.push(match[0].trim());
9786
+ rest = rest.slice(match[0].length);
9787
+ match = LEADING_IMPORT.exec(rest);
9788
+ }
9789
+ return { statements, rest: statements.length === 0 ? code : rest.replace(/^\s*\n/, "") };
9790
+ }
9791
+ function importBinding2(module, specifier) {
9792
+ const imported = specifier.type === "ImportSpecifier" ? specifier.imported.name ?? specifier.imported.value : null;
9793
+ return JSON.stringify([module, specifier.type, imported]);
9794
+ }
9795
+ function withCodeImports(imports, statements) {
9796
+ for (const statement of statements) {
9797
+ const bound = new Map(
9798
+ parseSource(imports, { jsx: false }).program.body.filter((node) => node.type === "ImportDeclaration").flatMap((node) => node.specifiers.map((specifier) => [specifier.local.name, importBinding2(node.source.value, specifier)]))
9799
+ );
9800
+ const declaration = parseSource(statement, { jsx: false }).program.body[0];
9801
+ const module = declaration.source.value;
9802
+ for (const specifier of declaration.specifiers) {
9803
+ const existing = bound.get(specifier.local.name);
9804
+ if (existing !== void 0 && existing !== importBinding2(module, specifier)) {
9805
+ throw new SourceError(
9806
+ `The code imports ${specifier.local.name} from '${module}', but the page file already imports ${specifier.local.name} from another module or export. Use another local name.`,
9807
+ null
9808
+ );
9809
+ }
9810
+ }
9811
+ const unbound = declaration.specifiers.filter((specifier) => !bound.has(specifier.local.name));
9812
+ if (declaration.importKind === "type" || unbound.some((specifier) => specifier.type !== "ImportSpecifier")) {
9813
+ imports = unbound.length === 0 ? imports : `${imports}
9814
+ ${statement.replace(/;?$/, ";")}`;
9815
+ continue;
9816
+ }
9817
+ for (const specifier of unbound) {
9818
+ imports = withNamedImport(imports, module, specifier.imported.name ?? specifier.imported.value, specifier.local.name);
9819
+ }
9820
+ }
9821
+ return imports;
9822
+ }
9778
9823
  function withNamedImport(imports, module, name, local) {
9779
9824
  const named = parseSource(imports, { jsx: false }).program.body.filter(
9780
9825
  (statement) => statement.type === "ImportDeclaration" && statement.source.value === module && statement.importKind !== "type"
@@ -13890,7 +13935,7 @@ async function checkSources() {
13890
13935
  if (existsSync4(DATA_FILE) && existsSync4(SDK_FILE)) {
13891
13936
  return { dataFile: DATA_FILE, sdkFile: SDK_FILE };
13892
13937
  }
13893
- const { checkData, scriptSdk } = await import("./cli-check-data-EFGW2377.mjs");
13938
+ const { checkData, scriptSdk } = await import("./cli-check-data-T6OVGKWP.mjs");
13894
13939
  return { data: checkData(), sdk: scriptSdk() };
13895
13940
  }
13896
13941
  function isScriptTestPath(path) {
@@ -13910,8 +13955,8 @@ function holdsSkills(root, plan) {
13910
13955
  async function checkCheckout(root, options) {
13911
13956
  const sources = await checkSources();
13912
13957
  const plan = composePackages(root);
13913
- const testRunner = async () => (await import("./cli-workflows-KJH52NZ5.mjs")).runBuildTests;
13914
- const skillReader = async () => (await import("./cli-skill-file-PHFXSLAU.mjs")).skillFrontMatter;
13958
+ const testRunner = async () => (await import("./cli-workflows-HBMQQ4SP.mjs")).runBuildTests;
13959
+ const skillReader = async () => (await import("./cli-skill-file-C2WAUJGV.mjs")).skillFrontMatter;
13915
13960
  const finish = (checkoutRoot, buildPlan, answer, runTests2) => {
13916
13961
  const run = hasScriptTests(answer) ? runTests2(checkoutRoot, answer.tests) : null;
13917
13962
  const diagnostics = finishedDiagnostics(withTestDiagnostics(answer, run), buildPlan);
@@ -13996,9 +14041,9 @@ async function main(argv, io) {
13996
14041
  case "assets": {
13997
14042
  const [subcommand, ...assetArgs] = args;
13998
14043
  if (subcommand === "upload")
13999
- return (await import("./cli-assets-cli-KPJWOWLD.mjs")).uploadAsset(assetArgs, withWorkspaceEnv(io));
14044
+ return (await import("./cli-assets-cli-QIFVUAWF.mjs")).uploadAsset(assetArgs, withWorkspaceEnv(io));
14000
14045
  if (subcommand === "list")
14001
- return (await import("./cli-assets-cli-KPJWOWLD.mjs")).listAssets(assetArgs, withWorkspaceEnv(io));
14046
+ return (await import("./cli-assets-cli-QIFVUAWF.mjs")).listAssets(assetArgs, withWorkspaceEnv(io));
14002
14047
  io.stderr.write(`${ASSETS_UPLOAD_USAGE}
14003
14048
  ${ASSETS_LIST_USAGE}
14004
14049
  `);