@awsless/awsless 0.0.21 → 0.0.23
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 +30 -23
- package/dist/bin.js +14 -7
- package/package.json +1 -1
package/dist/bin.cjs
CHANGED
|
@@ -522,7 +522,7 @@ var Stack = class {
|
|
|
522
522
|
}
|
|
523
523
|
}
|
|
524
524
|
};
|
|
525
|
-
for (const resource of this) {
|
|
525
|
+
for (const resource of this.resources) {
|
|
526
526
|
const json2 = resource.toJSON();
|
|
527
527
|
walk(json2);
|
|
528
528
|
Object.assign(resources, json2);
|
|
@@ -827,6 +827,7 @@ var import_rollup_plugin_swc3 = require("rollup-plugin-swc3");
|
|
|
827
827
|
var import_plugin_json = __toESM(require("@rollup/plugin-json"), 1);
|
|
828
828
|
var import_plugin_commonjs = __toESM(require("@rollup/plugin-commonjs"), 1);
|
|
829
829
|
var import_plugin_node_resolve = __toESM(require("@rollup/plugin-node-resolve"), 1);
|
|
830
|
+
var import_path = require("path");
|
|
830
831
|
var rollupBundle = async (input) => {
|
|
831
832
|
const bundle = await (0, import_rollup.rollup)({
|
|
832
833
|
input,
|
|
@@ -846,7 +847,10 @@ var rollupBundle = async (input) => {
|
|
|
846
847
|
}),
|
|
847
848
|
(0, import_rollup_plugin_swc3.swc)({
|
|
848
849
|
minify: true,
|
|
849
|
-
jsc: {
|
|
850
|
+
jsc: {
|
|
851
|
+
baseUrl: (0, import_path.dirname)(input),
|
|
852
|
+
minify: { sourceMap: true }
|
|
853
|
+
},
|
|
850
854
|
sourceMaps: true
|
|
851
855
|
}),
|
|
852
856
|
(0, import_plugin_json.default)()
|
|
@@ -4048,7 +4052,7 @@ var toApp = async (config, filters) => {
|
|
|
4048
4052
|
};
|
|
4049
4053
|
|
|
4050
4054
|
// src/config.ts
|
|
4051
|
-
var
|
|
4055
|
+
var import_path5 = require("path");
|
|
4052
4056
|
|
|
4053
4057
|
// src/util/account.ts
|
|
4054
4058
|
var import_client_sts = require("@aws-sdk/client-sts");
|
|
@@ -4135,26 +4139,26 @@ var AppSchema = import_zod23.z.object({
|
|
|
4135
4139
|
var import_rollup3 = require("rollup");
|
|
4136
4140
|
var import_rollup_plugin_swc32 = require("rollup-plugin-swc3");
|
|
4137
4141
|
var import_rollup_plugin_replace = __toESM(require("rollup-plugin-replace"), 1);
|
|
4138
|
-
var
|
|
4142
|
+
var import_path3 = require("path");
|
|
4139
4143
|
var import_promises5 = require("fs/promises");
|
|
4140
4144
|
|
|
4141
4145
|
// src/util/path.ts
|
|
4142
4146
|
var import_promises4 = require("fs/promises");
|
|
4143
|
-
var
|
|
4147
|
+
var import_path2 = require("path");
|
|
4144
4148
|
var root = process.cwd();
|
|
4145
4149
|
var directories = {
|
|
4146
4150
|
root,
|
|
4147
4151
|
get output() {
|
|
4148
|
-
return (0,
|
|
4152
|
+
return (0, import_path2.join)(this.root, ".awsless");
|
|
4149
4153
|
},
|
|
4150
4154
|
get cache() {
|
|
4151
|
-
return (0,
|
|
4155
|
+
return (0, import_path2.join)(this.output, "cache");
|
|
4152
4156
|
},
|
|
4153
4157
|
get asset() {
|
|
4154
|
-
return (0,
|
|
4158
|
+
return (0, import_path2.join)(this.output, "asset");
|
|
4155
4159
|
},
|
|
4156
4160
|
get template() {
|
|
4157
|
-
return (0,
|
|
4161
|
+
return (0, import_path2.join)(this.output, "template");
|
|
4158
4162
|
}
|
|
4159
4163
|
};
|
|
4160
4164
|
var setRoot = (path = root) => {
|
|
@@ -4164,12 +4168,12 @@ var findRootDir = async (path, configFile, level = 5) => {
|
|
|
4164
4168
|
if (!level) {
|
|
4165
4169
|
throw new TypeError("No awsless project found");
|
|
4166
4170
|
}
|
|
4167
|
-
const file = (0,
|
|
4171
|
+
const file = (0, import_path2.join)(path, configFile);
|
|
4168
4172
|
const exists = await fileExist(file);
|
|
4169
4173
|
if (exists) {
|
|
4170
4174
|
return path;
|
|
4171
4175
|
}
|
|
4172
|
-
return findRootDir((0,
|
|
4176
|
+
return findRootDir((0, import_path2.normalize)((0, import_path2.join)(path, "..")), configFile, level - 1);
|
|
4173
4177
|
};
|
|
4174
4178
|
var fileExist = async (file) => {
|
|
4175
4179
|
try {
|
|
@@ -4188,14 +4192,17 @@ var importFile = async (path) => {
|
|
|
4188
4192
|
input: path,
|
|
4189
4193
|
plugins: [
|
|
4190
4194
|
(0, import_rollup_plugin_replace.default)({
|
|
4191
|
-
__dirname: (id) => `'${(0,
|
|
4195
|
+
__dirname: (id) => `'${(0, import_path3.dirname)(id)}'`
|
|
4192
4196
|
}),
|
|
4193
4197
|
(0, import_rollup_plugin_swc32.swc)({
|
|
4194
|
-
minify: false
|
|
4198
|
+
minify: false,
|
|
4199
|
+
jsc: {
|
|
4200
|
+
baseUrl: (0, import_path3.dirname)(path)
|
|
4201
|
+
}
|
|
4195
4202
|
})
|
|
4196
4203
|
]
|
|
4197
4204
|
});
|
|
4198
|
-
const outputFile = (0,
|
|
4205
|
+
const outputFile = (0, import_path3.join)(directories.cache, "config.js");
|
|
4199
4206
|
const result = await bundle.generate({
|
|
4200
4207
|
format: "esm",
|
|
4201
4208
|
exports: "default"
|
|
@@ -4216,7 +4223,7 @@ var importConfig = async (options) => {
|
|
|
4216
4223
|
setRoot(root2);
|
|
4217
4224
|
debug("CWD:", style.info(root2));
|
|
4218
4225
|
debug("Import config file");
|
|
4219
|
-
const fileName = (0,
|
|
4226
|
+
const fileName = (0, import_path5.join)(root2, configFile);
|
|
4220
4227
|
const module2 = await importFile(fileName);
|
|
4221
4228
|
const appConfig = typeof module2.default === "function" ? await module2.default(options) : module2.default;
|
|
4222
4229
|
debug("Validate config file");
|
|
@@ -4739,7 +4746,7 @@ var flexLine = (term, left, right, reserveSpace = 0) => {
|
|
|
4739
4746
|
};
|
|
4740
4747
|
|
|
4741
4748
|
// src/cli/ui/complex/builder.ts
|
|
4742
|
-
var
|
|
4749
|
+
var import_path8 = require("path");
|
|
4743
4750
|
var assetBuilder = (app) => {
|
|
4744
4751
|
return async (term) => {
|
|
4745
4752
|
const assets = [];
|
|
@@ -4798,8 +4805,8 @@ var assetBuilder = (app) => {
|
|
|
4798
4805
|
const timer = createTimer();
|
|
4799
4806
|
const data = await asset.build({
|
|
4800
4807
|
async write(file, data2) {
|
|
4801
|
-
const fullpath = (0,
|
|
4802
|
-
const basepath = (0,
|
|
4808
|
+
const fullpath = (0, import_path8.join)(directories.asset, asset.type, app.name, stack.name, asset.id, file);
|
|
4809
|
+
const basepath = (0, import_path8.dirname)(fullpath);
|
|
4803
4810
|
await (0, import_promises6.mkdir)(basepath, { recursive: true });
|
|
4804
4811
|
await (0, import_promises6.writeFile)(fullpath, data2);
|
|
4805
4812
|
}
|
|
@@ -4838,14 +4845,14 @@ var cleanUp = async () => {
|
|
|
4838
4845
|
|
|
4839
4846
|
// src/cli/ui/complex/template.ts
|
|
4840
4847
|
var import_promises8 = require("fs/promises");
|
|
4841
|
-
var
|
|
4848
|
+
var import_path11 = require("path");
|
|
4842
4849
|
var templateBuilder = (app) => {
|
|
4843
4850
|
return async (term) => {
|
|
4844
4851
|
const done = term.out.write(loadingDialog("Building stack templates..."));
|
|
4845
4852
|
await Promise.all(app.stacks.map(async (stack) => {
|
|
4846
4853
|
const template = stack.toString(true);
|
|
4847
|
-
const path = (0,
|
|
4848
|
-
const file = (0,
|
|
4854
|
+
const path = (0, import_path11.join)(directories.template, app.name);
|
|
4855
|
+
const file = (0, import_path11.join)(path, `${stack.name}.json`);
|
|
4849
4856
|
await (0, import_promises8.mkdir)(path, { recursive: true });
|
|
4850
4857
|
await (0, import_promises8.writeFile)(file, template);
|
|
4851
4858
|
}));
|
|
@@ -5308,7 +5315,7 @@ var status = (program2) => {
|
|
|
5308
5315
|
|
|
5309
5316
|
// src/cli/ui/complex/publisher.ts
|
|
5310
5317
|
var import_promises9 = require("fs/promises");
|
|
5311
|
-
var
|
|
5318
|
+
var import_path13 = require("path");
|
|
5312
5319
|
var import_client_s32 = require("@aws-sdk/client-s3");
|
|
5313
5320
|
var assetPublisher = (config, app) => {
|
|
5314
5321
|
const client = new import_client_s32.S3Client({
|
|
@@ -5321,7 +5328,7 @@ var assetPublisher = (config, app) => {
|
|
|
5321
5328
|
await Promise.all([...stack.assets].map(async (asset) => {
|
|
5322
5329
|
await asset.publish?.({
|
|
5323
5330
|
async read(file) {
|
|
5324
|
-
const path = (0,
|
|
5331
|
+
const path = (0, import_path13.join)(directories.asset, asset.type, app.name, stack.name, asset.id, file);
|
|
5325
5332
|
const data = await (0, import_promises9.readFile)(path);
|
|
5326
5333
|
return data;
|
|
5327
5334
|
},
|
package/dist/bin.js
CHANGED
|
@@ -502,7 +502,7 @@ var Stack = class {
|
|
|
502
502
|
}
|
|
503
503
|
}
|
|
504
504
|
};
|
|
505
|
-
for (const resource of this) {
|
|
505
|
+
for (const resource of this.resources) {
|
|
506
506
|
const json2 = resource.toJSON();
|
|
507
507
|
walk(json2);
|
|
508
508
|
Object.assign(resources, json2);
|
|
@@ -804,6 +804,7 @@ import { swc } from "rollup-plugin-swc3";
|
|
|
804
804
|
import json from "@rollup/plugin-json";
|
|
805
805
|
import commonjs from "@rollup/plugin-commonjs";
|
|
806
806
|
import nodeResolve from "@rollup/plugin-node-resolve";
|
|
807
|
+
import { dirname } from "path";
|
|
807
808
|
var rollupBundle = async (input) => {
|
|
808
809
|
const bundle = await rollup({
|
|
809
810
|
input,
|
|
@@ -823,7 +824,10 @@ var rollupBundle = async (input) => {
|
|
|
823
824
|
}),
|
|
824
825
|
swc({
|
|
825
826
|
minify: true,
|
|
826
|
-
jsc: {
|
|
827
|
+
jsc: {
|
|
828
|
+
baseUrl: dirname(input),
|
|
829
|
+
minify: { sourceMap: true }
|
|
830
|
+
},
|
|
827
831
|
sourceMaps: true
|
|
828
832
|
}),
|
|
829
833
|
json()
|
|
@@ -4112,7 +4116,7 @@ var AppSchema = z23.object({
|
|
|
4112
4116
|
import { rollup as rollup2 } from "rollup";
|
|
4113
4117
|
import { swc as swc2 } from "rollup-plugin-swc3";
|
|
4114
4118
|
import replace from "rollup-plugin-replace";
|
|
4115
|
-
import { dirname, join as join2 } from "path";
|
|
4119
|
+
import { dirname as dirname2, join as join2 } from "path";
|
|
4116
4120
|
import { mkdir, writeFile } from "fs/promises";
|
|
4117
4121
|
|
|
4118
4122
|
// src/util/path.ts
|
|
@@ -4165,10 +4169,13 @@ var importFile = async (path) => {
|
|
|
4165
4169
|
input: path,
|
|
4166
4170
|
plugins: [
|
|
4167
4171
|
replace({
|
|
4168
|
-
__dirname: (id) => `'${
|
|
4172
|
+
__dirname: (id) => `'${dirname2(id)}'`
|
|
4169
4173
|
}),
|
|
4170
4174
|
swc2({
|
|
4171
|
-
minify: false
|
|
4175
|
+
minify: false,
|
|
4176
|
+
jsc: {
|
|
4177
|
+
baseUrl: dirname2(path)
|
|
4178
|
+
}
|
|
4172
4179
|
})
|
|
4173
4180
|
]
|
|
4174
4181
|
});
|
|
@@ -4716,7 +4723,7 @@ var flexLine = (term, left, right, reserveSpace = 0) => {
|
|
|
4716
4723
|
};
|
|
4717
4724
|
|
|
4718
4725
|
// src/cli/ui/complex/builder.ts
|
|
4719
|
-
import { dirname as
|
|
4726
|
+
import { dirname as dirname3, join as join4 } from "path";
|
|
4720
4727
|
var assetBuilder = (app) => {
|
|
4721
4728
|
return async (term) => {
|
|
4722
4729
|
const assets = [];
|
|
@@ -4776,7 +4783,7 @@ var assetBuilder = (app) => {
|
|
|
4776
4783
|
const data = await asset.build({
|
|
4777
4784
|
async write(file, data2) {
|
|
4778
4785
|
const fullpath = join4(directories.asset, asset.type, app.name, stack.name, asset.id, file);
|
|
4779
|
-
const basepath =
|
|
4786
|
+
const basepath = dirname3(fullpath);
|
|
4780
4787
|
await mkdir2(basepath, { recursive: true });
|
|
4781
4788
|
await writeFile2(fullpath, data2);
|
|
4782
4789
|
}
|