@awsless/awsless 0.0.22 → 0.0.24
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/dist/bin.cjs +40 -25
- package/dist/bin.js +24 -9
- package/dist/index.d.ts +2 -0
- package/package.json +1 -1
package/dist/bin.cjs
CHANGED
|
@@ -453,10 +453,15 @@ var Stack = class {
|
|
|
453
453
|
this.name = name;
|
|
454
454
|
this.region = region;
|
|
455
455
|
}
|
|
456
|
+
app;
|
|
456
457
|
exports = /* @__PURE__ */ new Map();
|
|
457
458
|
resources = /* @__PURE__ */ new Set();
|
|
458
459
|
tags = /* @__PURE__ */ new Map();
|
|
459
460
|
assets = /* @__PURE__ */ new Set();
|
|
461
|
+
setApp(app) {
|
|
462
|
+
this.app = app;
|
|
463
|
+
return this;
|
|
464
|
+
}
|
|
460
465
|
add(...resources) {
|
|
461
466
|
for (const item of resources) {
|
|
462
467
|
if (item instanceof Asset) {
|
|
@@ -530,7 +535,9 @@ var Stack = class {
|
|
|
530
535
|
for (const [name, value] of this.exports.entries()) {
|
|
531
536
|
Object.assign(outputs, {
|
|
532
537
|
[formatLogicalId(name)]: {
|
|
533
|
-
Export: {
|
|
538
|
+
Export: {
|
|
539
|
+
Name: `${this.app?.name || "default"}-${name}`
|
|
540
|
+
},
|
|
534
541
|
Value: value
|
|
535
542
|
}
|
|
536
543
|
});
|
|
@@ -827,6 +834,7 @@ var import_rollup_plugin_swc3 = require("rollup-plugin-swc3");
|
|
|
827
834
|
var import_plugin_json = __toESM(require("@rollup/plugin-json"), 1);
|
|
828
835
|
var import_plugin_commonjs = __toESM(require("@rollup/plugin-commonjs"), 1);
|
|
829
836
|
var import_plugin_node_resolve = __toESM(require("@rollup/plugin-node-resolve"), 1);
|
|
837
|
+
var import_path = require("path");
|
|
830
838
|
var rollupBundle = async (input) => {
|
|
831
839
|
const bundle = await (0, import_rollup.rollup)({
|
|
832
840
|
input,
|
|
@@ -846,7 +854,10 @@ var rollupBundle = async (input) => {
|
|
|
846
854
|
}),
|
|
847
855
|
(0, import_rollup_plugin_swc3.swc)({
|
|
848
856
|
minify: true,
|
|
849
|
-
jsc: {
|
|
857
|
+
jsc: {
|
|
858
|
+
baseUrl: (0, import_path.dirname)(input),
|
|
859
|
+
minify: { sourceMap: true }
|
|
860
|
+
},
|
|
850
861
|
sourceMaps: true
|
|
851
862
|
}),
|
|
852
863
|
(0, import_plugin_json.default)()
|
|
@@ -3827,7 +3838,10 @@ var App = class {
|
|
|
3827
3838
|
}
|
|
3828
3839
|
list = /* @__PURE__ */ new Map();
|
|
3829
3840
|
add(...stacks) {
|
|
3830
|
-
stacks.forEach((stack) =>
|
|
3841
|
+
stacks.forEach((stack) => {
|
|
3842
|
+
this.list.set(stack.name, stack);
|
|
3843
|
+
stack.setApp(this);
|
|
3844
|
+
});
|
|
3831
3845
|
return this;
|
|
3832
3846
|
}
|
|
3833
3847
|
find(resourceType) {
|
|
@@ -4048,7 +4062,7 @@ var toApp = async (config, filters) => {
|
|
|
4048
4062
|
};
|
|
4049
4063
|
|
|
4050
4064
|
// src/config.ts
|
|
4051
|
-
var
|
|
4065
|
+
var import_path5 = require("path");
|
|
4052
4066
|
|
|
4053
4067
|
// src/util/account.ts
|
|
4054
4068
|
var import_client_sts = require("@aws-sdk/client-sts");
|
|
@@ -4135,26 +4149,26 @@ var AppSchema = import_zod23.z.object({
|
|
|
4135
4149
|
var import_rollup3 = require("rollup");
|
|
4136
4150
|
var import_rollup_plugin_swc32 = require("rollup-plugin-swc3");
|
|
4137
4151
|
var import_rollup_plugin_replace = __toESM(require("rollup-plugin-replace"), 1);
|
|
4138
|
-
var
|
|
4152
|
+
var import_path3 = require("path");
|
|
4139
4153
|
var import_promises5 = require("fs/promises");
|
|
4140
4154
|
|
|
4141
4155
|
// src/util/path.ts
|
|
4142
4156
|
var import_promises4 = require("fs/promises");
|
|
4143
|
-
var
|
|
4157
|
+
var import_path2 = require("path");
|
|
4144
4158
|
var root = process.cwd();
|
|
4145
4159
|
var directories = {
|
|
4146
4160
|
root,
|
|
4147
4161
|
get output() {
|
|
4148
|
-
return (0,
|
|
4162
|
+
return (0, import_path2.join)(this.root, ".awsless");
|
|
4149
4163
|
},
|
|
4150
4164
|
get cache() {
|
|
4151
|
-
return (0,
|
|
4165
|
+
return (0, import_path2.join)(this.output, "cache");
|
|
4152
4166
|
},
|
|
4153
4167
|
get asset() {
|
|
4154
|
-
return (0,
|
|
4168
|
+
return (0, import_path2.join)(this.output, "asset");
|
|
4155
4169
|
},
|
|
4156
4170
|
get template() {
|
|
4157
|
-
return (0,
|
|
4171
|
+
return (0, import_path2.join)(this.output, "template");
|
|
4158
4172
|
}
|
|
4159
4173
|
};
|
|
4160
4174
|
var setRoot = (path = root) => {
|
|
@@ -4164,12 +4178,12 @@ var findRootDir = async (path, configFile, level = 5) => {
|
|
|
4164
4178
|
if (!level) {
|
|
4165
4179
|
throw new TypeError("No awsless project found");
|
|
4166
4180
|
}
|
|
4167
|
-
const file = (0,
|
|
4181
|
+
const file = (0, import_path2.join)(path, configFile);
|
|
4168
4182
|
const exists = await fileExist(file);
|
|
4169
4183
|
if (exists) {
|
|
4170
4184
|
return path;
|
|
4171
4185
|
}
|
|
4172
|
-
return findRootDir((0,
|
|
4186
|
+
return findRootDir((0, import_path2.normalize)((0, import_path2.join)(path, "..")), configFile, level - 1);
|
|
4173
4187
|
};
|
|
4174
4188
|
var fileExist = async (file) => {
|
|
4175
4189
|
try {
|
|
@@ -4188,17 +4202,17 @@ var importFile = async (path) => {
|
|
|
4188
4202
|
input: path,
|
|
4189
4203
|
plugins: [
|
|
4190
4204
|
(0, import_rollup_plugin_replace.default)({
|
|
4191
|
-
__dirname: (id) => `'${(0,
|
|
4205
|
+
__dirname: (id) => `'${(0, import_path3.dirname)(id)}'`
|
|
4192
4206
|
}),
|
|
4193
4207
|
(0, import_rollup_plugin_swc32.swc)({
|
|
4194
4208
|
minify: false,
|
|
4195
4209
|
jsc: {
|
|
4196
|
-
baseUrl: (0,
|
|
4210
|
+
baseUrl: (0, import_path3.dirname)(path)
|
|
4197
4211
|
}
|
|
4198
4212
|
})
|
|
4199
4213
|
]
|
|
4200
4214
|
});
|
|
4201
|
-
const outputFile = (0,
|
|
4215
|
+
const outputFile = (0, import_path3.join)(directories.cache, "config.js");
|
|
4202
4216
|
const result = await bundle.generate({
|
|
4203
4217
|
format: "esm",
|
|
4204
4218
|
exports: "default"
|
|
@@ -4219,7 +4233,7 @@ var importConfig = async (options) => {
|
|
|
4219
4233
|
setRoot(root2);
|
|
4220
4234
|
debug("CWD:", style.info(root2));
|
|
4221
4235
|
debug("Import config file");
|
|
4222
|
-
const fileName = (0,
|
|
4236
|
+
const fileName = (0, import_path5.join)(root2, configFile);
|
|
4223
4237
|
const module2 = await importFile(fileName);
|
|
4224
4238
|
const appConfig = typeof module2.default === "function" ? await module2.default(options) : module2.default;
|
|
4225
4239
|
debug("Validate config file");
|
|
@@ -4615,6 +4629,7 @@ var Renderer = class {
|
|
|
4615
4629
|
}
|
|
4616
4630
|
}
|
|
4617
4631
|
}
|
|
4632
|
+
await this.setCursor(0, size - start);
|
|
4618
4633
|
this.screen = screen;
|
|
4619
4634
|
this.flushing = false;
|
|
4620
4635
|
}
|
|
@@ -4742,7 +4757,7 @@ var flexLine = (term, left, right, reserveSpace = 0) => {
|
|
|
4742
4757
|
};
|
|
4743
4758
|
|
|
4744
4759
|
// src/cli/ui/complex/builder.ts
|
|
4745
|
-
var
|
|
4760
|
+
var import_path8 = require("path");
|
|
4746
4761
|
var assetBuilder = (app) => {
|
|
4747
4762
|
return async (term) => {
|
|
4748
4763
|
const assets = [];
|
|
@@ -4801,8 +4816,8 @@ var assetBuilder = (app) => {
|
|
|
4801
4816
|
const timer = createTimer();
|
|
4802
4817
|
const data = await asset.build({
|
|
4803
4818
|
async write(file, data2) {
|
|
4804
|
-
const fullpath = (0,
|
|
4805
|
-
const basepath = (0,
|
|
4819
|
+
const fullpath = (0, import_path8.join)(directories.asset, asset.type, app.name, stack.name, asset.id, file);
|
|
4820
|
+
const basepath = (0, import_path8.dirname)(fullpath);
|
|
4806
4821
|
await (0, import_promises6.mkdir)(basepath, { recursive: true });
|
|
4807
4822
|
await (0, import_promises6.writeFile)(fullpath, data2);
|
|
4808
4823
|
}
|
|
@@ -4841,14 +4856,14 @@ var cleanUp = async () => {
|
|
|
4841
4856
|
|
|
4842
4857
|
// src/cli/ui/complex/template.ts
|
|
4843
4858
|
var import_promises8 = require("fs/promises");
|
|
4844
|
-
var
|
|
4859
|
+
var import_path11 = require("path");
|
|
4845
4860
|
var templateBuilder = (app) => {
|
|
4846
4861
|
return async (term) => {
|
|
4847
4862
|
const done = term.out.write(loadingDialog("Building stack templates..."));
|
|
4848
4863
|
await Promise.all(app.stacks.map(async (stack) => {
|
|
4849
4864
|
const template = stack.toString(true);
|
|
4850
|
-
const path = (0,
|
|
4851
|
-
const file = (0,
|
|
4865
|
+
const path = (0, import_path11.join)(directories.template, app.name);
|
|
4866
|
+
const file = (0, import_path11.join)(path, `${stack.name}.json`);
|
|
4852
4867
|
await (0, import_promises8.mkdir)(path, { recursive: true });
|
|
4853
4868
|
await (0, import_promises8.writeFile)(file, template);
|
|
4854
4869
|
}));
|
|
@@ -4910,7 +4925,7 @@ var StackClient = class {
|
|
|
4910
4925
|
maxWaitTime = 60 * 30;
|
|
4911
4926
|
// 30 minutes
|
|
4912
4927
|
maxDelay = 30;
|
|
4913
|
-
//
|
|
4928
|
+
// 10 seconds
|
|
4914
4929
|
assetBucketName;
|
|
4915
4930
|
getClient(region) {
|
|
4916
4931
|
return new import_client_cloudformation.CloudFormationClient({
|
|
@@ -5311,7 +5326,7 @@ var status = (program2) => {
|
|
|
5311
5326
|
|
|
5312
5327
|
// src/cli/ui/complex/publisher.ts
|
|
5313
5328
|
var import_promises9 = require("fs/promises");
|
|
5314
|
-
var
|
|
5329
|
+
var import_path13 = require("path");
|
|
5315
5330
|
var import_client_s32 = require("@aws-sdk/client-s3");
|
|
5316
5331
|
var assetPublisher = (config, app) => {
|
|
5317
5332
|
const client = new import_client_s32.S3Client({
|
|
@@ -5324,7 +5339,7 @@ var assetPublisher = (config, app) => {
|
|
|
5324
5339
|
await Promise.all([...stack.assets].map(async (asset) => {
|
|
5325
5340
|
await asset.publish?.({
|
|
5326
5341
|
async read(file) {
|
|
5327
|
-
const path = (0,
|
|
5342
|
+
const path = (0, import_path13.join)(directories.asset, asset.type, app.name, stack.name, asset.id, file);
|
|
5328
5343
|
const data = await (0, import_promises9.readFile)(path);
|
|
5329
5344
|
return data;
|
|
5330
5345
|
},
|
package/dist/bin.js
CHANGED
|
@@ -433,10 +433,15 @@ var Stack = class {
|
|
|
433
433
|
this.name = name;
|
|
434
434
|
this.region = region;
|
|
435
435
|
}
|
|
436
|
+
app;
|
|
436
437
|
exports = /* @__PURE__ */ new Map();
|
|
437
438
|
resources = /* @__PURE__ */ new Set();
|
|
438
439
|
tags = /* @__PURE__ */ new Map();
|
|
439
440
|
assets = /* @__PURE__ */ new Set();
|
|
441
|
+
setApp(app) {
|
|
442
|
+
this.app = app;
|
|
443
|
+
return this;
|
|
444
|
+
}
|
|
440
445
|
add(...resources) {
|
|
441
446
|
for (const item of resources) {
|
|
442
447
|
if (item instanceof Asset) {
|
|
@@ -510,7 +515,9 @@ var Stack = class {
|
|
|
510
515
|
for (const [name, value] of this.exports.entries()) {
|
|
511
516
|
Object.assign(outputs, {
|
|
512
517
|
[formatLogicalId(name)]: {
|
|
513
|
-
Export: {
|
|
518
|
+
Export: {
|
|
519
|
+
Name: `${this.app?.name || "default"}-${name}`
|
|
520
|
+
},
|
|
514
521
|
Value: value
|
|
515
522
|
}
|
|
516
523
|
});
|
|
@@ -804,6 +811,7 @@ import { swc } from "rollup-plugin-swc3";
|
|
|
804
811
|
import json from "@rollup/plugin-json";
|
|
805
812
|
import commonjs from "@rollup/plugin-commonjs";
|
|
806
813
|
import nodeResolve from "@rollup/plugin-node-resolve";
|
|
814
|
+
import { dirname } from "path";
|
|
807
815
|
var rollupBundle = async (input) => {
|
|
808
816
|
const bundle = await rollup({
|
|
809
817
|
input,
|
|
@@ -823,7 +831,10 @@ var rollupBundle = async (input) => {
|
|
|
823
831
|
}),
|
|
824
832
|
swc({
|
|
825
833
|
minify: true,
|
|
826
|
-
jsc: {
|
|
834
|
+
jsc: {
|
|
835
|
+
baseUrl: dirname(input),
|
|
836
|
+
minify: { sourceMap: true }
|
|
837
|
+
},
|
|
827
838
|
sourceMaps: true
|
|
828
839
|
}),
|
|
829
840
|
json()
|
|
@@ -3804,7 +3815,10 @@ var App = class {
|
|
|
3804
3815
|
}
|
|
3805
3816
|
list = /* @__PURE__ */ new Map();
|
|
3806
3817
|
add(...stacks) {
|
|
3807
|
-
stacks.forEach((stack) =>
|
|
3818
|
+
stacks.forEach((stack) => {
|
|
3819
|
+
this.list.set(stack.name, stack);
|
|
3820
|
+
stack.setApp(this);
|
|
3821
|
+
});
|
|
3808
3822
|
return this;
|
|
3809
3823
|
}
|
|
3810
3824
|
find(resourceType) {
|
|
@@ -4112,7 +4126,7 @@ var AppSchema = z23.object({
|
|
|
4112
4126
|
import { rollup as rollup2 } from "rollup";
|
|
4113
4127
|
import { swc as swc2 } from "rollup-plugin-swc3";
|
|
4114
4128
|
import replace from "rollup-plugin-replace";
|
|
4115
|
-
import { dirname, join as join2 } from "path";
|
|
4129
|
+
import { dirname as dirname2, join as join2 } from "path";
|
|
4116
4130
|
import { mkdir, writeFile } from "fs/promises";
|
|
4117
4131
|
|
|
4118
4132
|
// src/util/path.ts
|
|
@@ -4165,12 +4179,12 @@ var importFile = async (path) => {
|
|
|
4165
4179
|
input: path,
|
|
4166
4180
|
plugins: [
|
|
4167
4181
|
replace({
|
|
4168
|
-
__dirname: (id) => `'${
|
|
4182
|
+
__dirname: (id) => `'${dirname2(id)}'`
|
|
4169
4183
|
}),
|
|
4170
4184
|
swc2({
|
|
4171
4185
|
minify: false,
|
|
4172
4186
|
jsc: {
|
|
4173
|
-
baseUrl:
|
|
4187
|
+
baseUrl: dirname2(path)
|
|
4174
4188
|
}
|
|
4175
4189
|
})
|
|
4176
4190
|
]
|
|
@@ -4592,6 +4606,7 @@ var Renderer = class {
|
|
|
4592
4606
|
}
|
|
4593
4607
|
}
|
|
4594
4608
|
}
|
|
4609
|
+
await this.setCursor(0, size - start);
|
|
4595
4610
|
this.screen = screen;
|
|
4596
4611
|
this.flushing = false;
|
|
4597
4612
|
}
|
|
@@ -4719,7 +4734,7 @@ var flexLine = (term, left, right, reserveSpace = 0) => {
|
|
|
4719
4734
|
};
|
|
4720
4735
|
|
|
4721
4736
|
// src/cli/ui/complex/builder.ts
|
|
4722
|
-
import { dirname as
|
|
4737
|
+
import { dirname as dirname3, join as join4 } from "path";
|
|
4723
4738
|
var assetBuilder = (app) => {
|
|
4724
4739
|
return async (term) => {
|
|
4725
4740
|
const assets = [];
|
|
@@ -4779,7 +4794,7 @@ var assetBuilder = (app) => {
|
|
|
4779
4794
|
const data = await asset.build({
|
|
4780
4795
|
async write(file, data2) {
|
|
4781
4796
|
const fullpath = join4(directories.asset, asset.type, app.name, stack.name, asset.id, file);
|
|
4782
|
-
const basepath =
|
|
4797
|
+
const basepath = dirname3(fullpath);
|
|
4783
4798
|
await mkdir2(basepath, { recursive: true });
|
|
4784
4799
|
await writeFile2(fullpath, data2);
|
|
4785
4800
|
}
|
|
@@ -4887,7 +4902,7 @@ var StackClient = class {
|
|
|
4887
4902
|
maxWaitTime = 60 * 30;
|
|
4888
4903
|
// 30 minutes
|
|
4889
4904
|
maxDelay = 30;
|
|
4890
|
-
//
|
|
4905
|
+
// 10 seconds
|
|
4891
4906
|
assetBucketName;
|
|
4892
4907
|
getClient(region) {
|
|
4893
4908
|
return new CloudFormationClient({
|
package/dist/index.d.ts
CHANGED
|
@@ -2320,11 +2320,13 @@ type ConstructorOf<C> = {
|
|
|
2320
2320
|
declare class Stack {
|
|
2321
2321
|
readonly name: string;
|
|
2322
2322
|
readonly region: Region;
|
|
2323
|
+
private app?;
|
|
2323
2324
|
readonly exports: Map<string, string>;
|
|
2324
2325
|
readonly resources: Set<Resource>;
|
|
2325
2326
|
readonly tags: Map<string, string>;
|
|
2326
2327
|
readonly assets: Set<Asset>;
|
|
2327
2328
|
constructor(name: string, region: Region);
|
|
2329
|
+
setApp(app: App): this;
|
|
2328
2330
|
add(...resources: (Resource | Asset | Group)[]): this;
|
|
2329
2331
|
export(name: string, value: string): this;
|
|
2330
2332
|
get(name: string): string;
|