@awsless/awsless 0.0.22 → 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 +26 -22
- package/dist/bin.js +10 -6
- package/package.json +1 -1
package/dist/bin.cjs
CHANGED
|
@@ -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,17 +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
4198
|
minify: false,
|
|
4195
4199
|
jsc: {
|
|
4196
|
-
baseUrl: (0,
|
|
4200
|
+
baseUrl: (0, import_path3.dirname)(path)
|
|
4197
4201
|
}
|
|
4198
4202
|
})
|
|
4199
4203
|
]
|
|
4200
4204
|
});
|
|
4201
|
-
const outputFile = (0,
|
|
4205
|
+
const outputFile = (0, import_path3.join)(directories.cache, "config.js");
|
|
4202
4206
|
const result = await bundle.generate({
|
|
4203
4207
|
format: "esm",
|
|
4204
4208
|
exports: "default"
|
|
@@ -4219,7 +4223,7 @@ var importConfig = async (options) => {
|
|
|
4219
4223
|
setRoot(root2);
|
|
4220
4224
|
debug("CWD:", style.info(root2));
|
|
4221
4225
|
debug("Import config file");
|
|
4222
|
-
const fileName = (0,
|
|
4226
|
+
const fileName = (0, import_path5.join)(root2, configFile);
|
|
4223
4227
|
const module2 = await importFile(fileName);
|
|
4224
4228
|
const appConfig = typeof module2.default === "function" ? await module2.default(options) : module2.default;
|
|
4225
4229
|
debug("Validate config file");
|
|
@@ -4742,7 +4746,7 @@ var flexLine = (term, left, right, reserveSpace = 0) => {
|
|
|
4742
4746
|
};
|
|
4743
4747
|
|
|
4744
4748
|
// src/cli/ui/complex/builder.ts
|
|
4745
|
-
var
|
|
4749
|
+
var import_path8 = require("path");
|
|
4746
4750
|
var assetBuilder = (app) => {
|
|
4747
4751
|
return async (term) => {
|
|
4748
4752
|
const assets = [];
|
|
@@ -4801,8 +4805,8 @@ var assetBuilder = (app) => {
|
|
|
4801
4805
|
const timer = createTimer();
|
|
4802
4806
|
const data = await asset.build({
|
|
4803
4807
|
async write(file, data2) {
|
|
4804
|
-
const fullpath = (0,
|
|
4805
|
-
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);
|
|
4806
4810
|
await (0, import_promises6.mkdir)(basepath, { recursive: true });
|
|
4807
4811
|
await (0, import_promises6.writeFile)(fullpath, data2);
|
|
4808
4812
|
}
|
|
@@ -4841,14 +4845,14 @@ var cleanUp = async () => {
|
|
|
4841
4845
|
|
|
4842
4846
|
// src/cli/ui/complex/template.ts
|
|
4843
4847
|
var import_promises8 = require("fs/promises");
|
|
4844
|
-
var
|
|
4848
|
+
var import_path11 = require("path");
|
|
4845
4849
|
var templateBuilder = (app) => {
|
|
4846
4850
|
return async (term) => {
|
|
4847
4851
|
const done = term.out.write(loadingDialog("Building stack templates..."));
|
|
4848
4852
|
await Promise.all(app.stacks.map(async (stack) => {
|
|
4849
4853
|
const template = stack.toString(true);
|
|
4850
|
-
const path = (0,
|
|
4851
|
-
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`);
|
|
4852
4856
|
await (0, import_promises8.mkdir)(path, { recursive: true });
|
|
4853
4857
|
await (0, import_promises8.writeFile)(file, template);
|
|
4854
4858
|
}));
|
|
@@ -5311,7 +5315,7 @@ var status = (program2) => {
|
|
|
5311
5315
|
|
|
5312
5316
|
// src/cli/ui/complex/publisher.ts
|
|
5313
5317
|
var import_promises9 = require("fs/promises");
|
|
5314
|
-
var
|
|
5318
|
+
var import_path13 = require("path");
|
|
5315
5319
|
var import_client_s32 = require("@aws-sdk/client-s3");
|
|
5316
5320
|
var assetPublisher = (config, app) => {
|
|
5317
5321
|
const client = new import_client_s32.S3Client({
|
|
@@ -5324,7 +5328,7 @@ var assetPublisher = (config, app) => {
|
|
|
5324
5328
|
await Promise.all([...stack.assets].map(async (asset) => {
|
|
5325
5329
|
await asset.publish?.({
|
|
5326
5330
|
async read(file) {
|
|
5327
|
-
const path = (0,
|
|
5331
|
+
const path = (0, import_path13.join)(directories.asset, asset.type, app.name, stack.name, asset.id, file);
|
|
5328
5332
|
const data = await (0, import_promises9.readFile)(path);
|
|
5329
5333
|
return data;
|
|
5330
5334
|
},
|
package/dist/bin.js
CHANGED
|
@@ -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,12 +4169,12 @@ 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
4175
|
minify: false,
|
|
4172
4176
|
jsc: {
|
|
4173
|
-
baseUrl:
|
|
4177
|
+
baseUrl: dirname2(path)
|
|
4174
4178
|
}
|
|
4175
4179
|
})
|
|
4176
4180
|
]
|
|
@@ -4719,7 +4723,7 @@ var flexLine = (term, left, right, reserveSpace = 0) => {
|
|
|
4719
4723
|
};
|
|
4720
4724
|
|
|
4721
4725
|
// src/cli/ui/complex/builder.ts
|
|
4722
|
-
import { dirname as
|
|
4726
|
+
import { dirname as dirname3, join as join4 } from "path";
|
|
4723
4727
|
var assetBuilder = (app) => {
|
|
4724
4728
|
return async (term) => {
|
|
4725
4729
|
const assets = [];
|
|
@@ -4779,7 +4783,7 @@ var assetBuilder = (app) => {
|
|
|
4779
4783
|
const data = await asset.build({
|
|
4780
4784
|
async write(file, data2) {
|
|
4781
4785
|
const fullpath = join4(directories.asset, asset.type, app.name, stack.name, asset.id, file);
|
|
4782
|
-
const basepath =
|
|
4786
|
+
const basepath = dirname3(fullpath);
|
|
4783
4787
|
await mkdir2(basepath, { recursive: true });
|
|
4784
4788
|
await writeFile2(fullpath, data2);
|
|
4785
4789
|
}
|