@walkeros/cli 1.1.1 → 1.1.3

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,23 @@
1
1
  # @walkeros/cli
2
2
 
3
+ ## 1.1.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 6fcfaf5: Fix chain property handling for all component types in bundler.
8
+ Sources now correctly output `next` property for pre-collector transformer
9
+ chains. Unified inline code generation for sources, destinations, and
10
+ transformers. Standardized transformer `next` as top-level property
11
+ (consistent with destination `before`).
12
+
13
+ ## 1.1.2
14
+
15
+ ### Patch Changes
16
+
17
+ - Updated dependencies [7ad6cfb]
18
+ - @walkeros/core@1.2.2
19
+ - @walkeros/server-core@1.0.4
20
+
3
21
  ## 1.1.1
4
22
 
5
23
  ### Patch Changes
package/dist/index.js CHANGED
@@ -822,34 +822,34 @@ function validateReference(type, name, ref) {
822
822
  throw new Error(`${type} "${name}": Must specify either package or code.`);
823
823
  }
824
824
  }
825
- function generateInlineCode(inline, config, env) {
825
+ function generateInlineCode(inline, config, env, chain, chainPropertyName, isDestination) {
826
826
  const pushFn = inline.push.replace("$code:", "");
827
827
  const initFn = inline.init ? inline.init.replace("$code:", "") : void 0;
828
828
  const typeLine = inline.type ? `type: '${inline.type}',` : "";
829
- return `{
830
- code: async (context) => ({
829
+ const chainLine = chain && chainPropertyName ? `${chainPropertyName}: ${JSON.stringify(chain)},` : "";
830
+ if (isDestination) {
831
+ return `{
832
+ code: {
831
833
  ${typeLine}
832
- config: context.config,
834
+ config: ${JSON.stringify(config || {})},
833
835
  ${initFn ? `init: ${initFn},` : ""}
834
836
  push: ${pushFn}
835
- }),
837
+ },
836
838
  config: ${JSON.stringify(config || {})},
837
- env: ${JSON.stringify(env || {})}
839
+ env: ${JSON.stringify(env || {})}${chain ? `,
840
+ ${chainLine.slice(0, -1)}` : ""}
838
841
  }`;
839
- }
840
- function generateInlineDestinationCode(inline, config, env) {
841
- const pushFn = inline.push.replace("$code:", "");
842
- const initFn = inline.init ? inline.init.replace("$code:", "") : void 0;
843
- const typeLine = inline.type ? `type: '${inline.type}',` : "";
842
+ }
844
843
  return `{
845
- code: {
844
+ code: async (context) => ({
846
845
  ${typeLine}
847
- config: ${JSON.stringify(config || {})},
846
+ config: context.config,
848
847
  ${initFn ? `init: ${initFn},` : ""}
849
848
  push: ${pushFn}
850
- },
849
+ }),
851
850
  config: ${JSON.stringify(config || {})},
852
- env: ${JSON.stringify(env || {})}
851
+ env: ${JSON.stringify(env || {})}${chain ? `,
852
+ ${chainLine.slice(0, -1)}` : ""}
853
853
  }`;
854
854
  }
855
855
  async function copyIncludes(includes, sourceDir, outputDir, logger2) {
@@ -1406,7 +1406,7 @@ function buildConfigObject(flowConfig, explicitCodeImports) {
1406
1406
  ([, source]) => source.code !== true && (source.package || isInlineCode(source.code))
1407
1407
  ).map(([key, source]) => {
1408
1408
  if (isInlineCode(source.code)) {
1409
- return ` ${key}: ${generateInlineCode(source.code, source.config || {}, source.env)}`;
1409
+ return ` ${key}: ${generateInlineCode(source.code, source.config || {}, source.env, source.next, "next")}`;
1410
1410
  }
1411
1411
  let codeVar;
1412
1412
  if (source.code && typeof source.code === "string" && explicitCodeImports.has(source.package)) {
@@ -1417,16 +1417,18 @@ function buildConfigObject(flowConfig, explicitCodeImports) {
1417
1417
  const configStr = source.config ? processConfigValue(source.config) : "{}";
1418
1418
  const envStr = source.env ? `,
1419
1419
  env: ${processConfigValue(source.env)}` : "";
1420
+ const nextStr = source.next ? `,
1421
+ next: ${JSON.stringify(source.next)}` : "";
1420
1422
  return ` ${key}: {
1421
1423
  code: ${codeVar},
1422
- config: ${configStr}${envStr}
1424
+ config: ${configStr}${envStr}${nextStr}
1423
1425
  }`;
1424
1426
  });
1425
1427
  const destinationsEntries = Object.entries(destinations).filter(
1426
1428
  ([, dest]) => dest.code !== true && (dest.package || isInlineCode(dest.code))
1427
1429
  ).map(([key, dest]) => {
1428
1430
  if (isInlineCode(dest.code)) {
1429
- return ` ${key}: ${generateInlineDestinationCode(dest.code, dest.config || {}, dest.env)}`;
1431
+ return ` ${key}: ${generateInlineCode(dest.code, dest.config || {}, dest.env, dest.before, "before", true)}`;
1430
1432
  }
1431
1433
  let codeVar;
1432
1434
  if (dest.code && typeof dest.code === "string" && explicitCodeImports.has(dest.package)) {
@@ -1437,20 +1439,18 @@ function buildConfigObject(flowConfig, explicitCodeImports) {
1437
1439
  const configStr = dest.config ? processConfigValue(dest.config) : "{}";
1438
1440
  const envStr = dest.env ? `,
1439
1441
  env: ${processConfigValue(dest.env)}` : "";
1442
+ const beforeStr = dest.before ? `,
1443
+ before: ${JSON.stringify(dest.before)}` : "";
1440
1444
  return ` ${key}: {
1441
1445
  code: ${codeVar},
1442
- config: ${configStr}${envStr}
1446
+ config: ${configStr}${envStr}${beforeStr}
1443
1447
  }`;
1444
1448
  });
1445
1449
  const transformersEntries = Object.entries(transformers).filter(
1446
1450
  ([, transformer]) => transformer.code !== true && (transformer.package || isInlineCode(transformer.code))
1447
1451
  ).map(([key, transformer]) => {
1448
1452
  if (isInlineCode(transformer.code)) {
1449
- const configWithNext2 = transformer.next ? {
1450
- ...transformer.config || {},
1451
- next: transformer.next
1452
- } : transformer.config || {};
1453
- return ` ${key}: ${generateInlineCode(transformer.code, configWithNext2, transformer.env)}`;
1453
+ return ` ${key}: ${generateInlineCode(transformer.code, transformer.config || {}, transformer.env, transformer.next, "next")}`;
1454
1454
  }
1455
1455
  let codeVar;
1456
1456
  if (transformer.code && typeof transformer.code === "string" && explicitCodeImports.has(transformer.package)) {
@@ -1458,13 +1458,14 @@ function buildConfigObject(flowConfig, explicitCodeImports) {
1458
1458
  } else {
1459
1459
  codeVar = packageNameToVariable(transformer.package);
1460
1460
  }
1461
- const configWithNext = transformer.next ? { ...transformer.config || {}, next: transformer.next } : transformer.config;
1462
- const configStr = configWithNext ? processConfigValue(configWithNext) : "{}";
1461
+ const configStr = transformer.config ? processConfigValue(transformer.config) : "{}";
1463
1462
  const envStr = transformer.env ? `,
1464
1463
  env: ${processConfigValue(transformer.env)}` : "";
1464
+ const nextStr = transformer.next ? `,
1465
+ next: ${JSON.stringify(transformer.next)}` : "";
1465
1466
  return ` ${key}: {
1466
1467
  code: ${codeVar},
1467
- config: ${configStr}${envStr}
1468
+ config: ${configStr}${envStr}${nextStr}
1468
1469
  }`;
1469
1470
  });
1470
1471
  const collectorStr = flowWithProps.collector ? `,