@walkeros/cli 1.1.0-next-1769691037535 → 1.1.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 +3 -3
- package/dist/index.js +13 -9
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @walkeros/cli
|
|
2
2
|
|
|
3
|
-
## 1.1.0
|
|
3
|
+
## 1.1.0
|
|
4
4
|
|
|
5
5
|
### Minor Changes
|
|
6
6
|
|
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
|
|
47
47
|
- Updated dependencies [f39d9fb]
|
|
48
48
|
- Updated dependencies [888bbdf]
|
|
49
|
-
- @walkeros/core@1.2.0
|
|
50
|
-
- @walkeros/server-core@1.0.2
|
|
49
|
+
- @walkeros/core@1.2.0
|
|
50
|
+
- @walkeros/server-core@1.0.2
|
|
51
51
|
|
|
52
52
|
## 1.0.2
|
|
53
53
|
|
package/dist/index.js
CHANGED
|
@@ -808,7 +808,7 @@ async function getCachedBuild(configContent, tmpDir) {
|
|
|
808
808
|
|
|
809
809
|
// src/commands/bundle/bundler.ts
|
|
810
810
|
function isInlineCode(code) {
|
|
811
|
-
return code !== null && typeof code === "object" && "push" in code;
|
|
811
|
+
return code !== null && typeof code === "object" && !Array.isArray(code) && "push" in code;
|
|
812
812
|
}
|
|
813
813
|
function validateReference(type, name, ref) {
|
|
814
814
|
const hasPackage = !!ref.package;
|
|
@@ -822,7 +822,7 @@ 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) {
|
|
825
|
+
function generateInlineCode(inline, config, env) {
|
|
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}',` : "";
|
|
@@ -834,10 +834,10 @@ function generateInlineCode(inline, config) {
|
|
|
834
834
|
push: ${pushFn}
|
|
835
835
|
}),
|
|
836
836
|
config: ${JSON.stringify(config || {})},
|
|
837
|
-
env: {}
|
|
837
|
+
env: ${JSON.stringify(env || {})}
|
|
838
838
|
}`;
|
|
839
839
|
}
|
|
840
|
-
function generateInlineDestinationCode(inline, config) {
|
|
840
|
+
function generateInlineDestinationCode(inline, config, env) {
|
|
841
841
|
const pushFn = inline.push.replace("$code:", "");
|
|
842
842
|
const initFn = inline.init ? inline.init.replace("$code:", "") : void 0;
|
|
843
843
|
const typeLine = inline.type ? `type: '${inline.type}',` : "";
|
|
@@ -849,7 +849,7 @@ function generateInlineDestinationCode(inline, config) {
|
|
|
849
849
|
push: ${pushFn}
|
|
850
850
|
},
|
|
851
851
|
config: ${JSON.stringify(config || {})},
|
|
852
|
-
env: {}
|
|
852
|
+
env: ${JSON.stringify(env || {})}
|
|
853
853
|
}`;
|
|
854
854
|
}
|
|
855
855
|
async function copyIncludes(includes, sourceDir, outputDir, logger2) {
|
|
@@ -1338,7 +1338,11 @@ async function createEntryPoint(flowConfig, buildOptions, packagePaths) {
|
|
|
1338
1338
|
explicitCodeImports
|
|
1339
1339
|
);
|
|
1340
1340
|
const importsCode = importStatements.join("\n");
|
|
1341
|
-
const hasFlow =
|
|
1341
|
+
const hasFlow = Object.values(flowConfig.sources || {}).some(
|
|
1342
|
+
(s) => s.package || isInlineCode(s.code)
|
|
1343
|
+
) || Object.values(flowConfig.destinations || {}).some(
|
|
1344
|
+
(d) => d.package || isInlineCode(d.code)
|
|
1345
|
+
);
|
|
1342
1346
|
if (!hasFlow) {
|
|
1343
1347
|
const userCode = buildOptions.code || "";
|
|
1344
1348
|
return importsCode ? `${importsCode}
|
|
@@ -1402,7 +1406,7 @@ function buildConfigObject(flowConfig, explicitCodeImports) {
|
|
|
1402
1406
|
([, source]) => source.code !== true && (source.package || isInlineCode(source.code))
|
|
1403
1407
|
).map(([key, source]) => {
|
|
1404
1408
|
if (isInlineCode(source.code)) {
|
|
1405
|
-
return ` ${key}: ${generateInlineCode(source.code, source.config || {})}`;
|
|
1409
|
+
return ` ${key}: ${generateInlineCode(source.code, source.config || {}, source.env)}`;
|
|
1406
1410
|
}
|
|
1407
1411
|
let codeVar;
|
|
1408
1412
|
if (source.code && typeof source.code === "string" && explicitCodeImports.has(source.package)) {
|
|
@@ -1422,7 +1426,7 @@ function buildConfigObject(flowConfig, explicitCodeImports) {
|
|
|
1422
1426
|
([, dest]) => dest.code !== true && (dest.package || isInlineCode(dest.code))
|
|
1423
1427
|
).map(([key, dest]) => {
|
|
1424
1428
|
if (isInlineCode(dest.code)) {
|
|
1425
|
-
return ` ${key}: ${generateInlineDestinationCode(dest.code, dest.config || {})}`;
|
|
1429
|
+
return ` ${key}: ${generateInlineDestinationCode(dest.code, dest.config || {}, dest.env)}`;
|
|
1426
1430
|
}
|
|
1427
1431
|
let codeVar;
|
|
1428
1432
|
if (dest.code && typeof dest.code === "string" && explicitCodeImports.has(dest.package)) {
|
|
@@ -1446,7 +1450,7 @@ function buildConfigObject(flowConfig, explicitCodeImports) {
|
|
|
1446
1450
|
...transformer.config || {},
|
|
1447
1451
|
next: transformer.next
|
|
1448
1452
|
} : transformer.config || {};
|
|
1449
|
-
return ` ${key}: ${generateInlineCode(transformer.code, configWithNext2)}`;
|
|
1453
|
+
return ` ${key}: ${generateInlineCode(transformer.code, configWithNext2, transformer.env)}`;
|
|
1450
1454
|
}
|
|
1451
1455
|
let codeVar;
|
|
1452
1456
|
if (transformer.code && typeof transformer.code === "string" && explicitCodeImports.has(transformer.package)) {
|