@intra-mart/accel 0.3.0 → 0.4.0-dev.202607140628

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.
Files changed (67) hide show
  1. package/README.md +55 -12
  2. package/dist/asset/asset-tree.d.ts +5 -0
  3. package/dist/asset/asset-tree.js +7 -0
  4. package/dist/asset/deployer.d.ts +2 -1
  5. package/dist/asset/deployer.js +32 -59
  6. package/dist/asset/file-provider.js +19 -18
  7. package/dist/asset/git-provider.d.ts +14 -0
  8. package/dist/asset/git-provider.js +198 -0
  9. package/dist/asset/installer.d.ts +6 -0
  10. package/dist/asset/installer.js +31 -0
  11. package/dist/asset/renderer.d.ts +2 -0
  12. package/dist/asset/renderer.js +22 -0
  13. package/dist/asset/types.d.ts +1 -1
  14. package/dist/asset/updater.d.ts +52 -0
  15. package/dist/asset/updater.js +301 -0
  16. package/dist/asset/walker.d.ts +3 -2
  17. package/dist/asset/walker.js +67 -45
  18. package/dist/commands/asset-provider.d.ts +7 -0
  19. package/dist/commands/asset-provider.js +9 -0
  20. package/dist/commands/attach.d.ts +0 -4
  21. package/dist/commands/attach.js +11 -20
  22. package/dist/commands/deploy.d.ts +11 -6
  23. package/dist/commands/deploy.js +77 -23
  24. package/dist/commands/init.d.ts +0 -4
  25. package/dist/commands/init.js +11 -20
  26. package/dist/commands/update.d.ts +86 -0
  27. package/dist/commands/update.js +438 -0
  28. package/dist/core/constants.d.ts +3 -3
  29. package/dist/core/constants.js +4 -2
  30. package/dist/core/types.d.ts +11 -0
  31. package/dist/deploy/api-client.d.ts +6 -2
  32. package/dist/deploy/api-client.js +8 -4
  33. package/dist/deploy/deploy-files.d.ts +20 -0
  34. package/dist/deploy/deploy-files.js +37 -0
  35. package/dist/git/errors.d.ts +6 -0
  36. package/dist/git/errors.js +9 -0
  37. package/dist/git/http.d.ts +3 -0
  38. package/dist/git/http.js +58 -0
  39. package/dist/git/object-store.d.ts +13 -0
  40. package/dist/git/object-store.js +79 -0
  41. package/dist/git/pkt-line.d.ts +13 -0
  42. package/dist/git/pkt-line.js +41 -0
  43. package/dist/git/smart-http.d.ts +18 -0
  44. package/dist/git/smart-http.js +109 -0
  45. package/dist/i18n/en.js +50 -7
  46. package/dist/i18n/ja.js +50 -7
  47. package/dist/i18n/zh_CN.js +50 -7
  48. package/dist/index.js +4 -1
  49. package/dist/interactive/progress.js +1 -0
  50. package/dist/interactive/prompts.d.ts +7 -1
  51. package/dist/interactive/prompts.js +63 -64
  52. package/dist/markdown/section-replacement.js +34 -8
  53. package/dist/utils/args.d.ts +1 -0
  54. package/dist/utils/args.js +4 -0
  55. package/dist/utils/fs-list.d.ts +1 -0
  56. package/dist/utils/fs-list.js +11 -0
  57. package/dist/utils/merge-file.d.ts +6 -0
  58. package/dist/utils/merge-file.js +20 -0
  59. package/package.json +6 -8
  60. package/dist/asset/github-provider.d.ts +0 -2
  61. package/dist/asset/github-provider.js +0 -37
  62. package/dist/asset/local-provider.d.ts +0 -2
  63. package/dist/asset/local-provider.js +0 -24
  64. package/dist/utils/archive.d.ts +0 -3
  65. package/dist/utils/archive.js +0 -20
  66. package/dist/utils/https.d.ts +0 -2
  67. package/dist/utils/https.js +0 -44
@@ -1,44 +0,0 @@
1
- import { get as httpGet } from "node:http";
2
- import { get as httpsGet } from "node:https";
3
- import { createWriteStream } from "node:fs";
4
- const MAX_REDIRECTS = 5;
5
- export const isInsecureRedirect = (from, location) => {
6
- if (!from.startsWith("https:"))
7
- return false;
8
- return new URL(location, from).protocol === "http:";
9
- };
10
- export const downloadFile = (url, destPath, redirectsLeft = MAX_REDIRECTS) => {
11
- const requester = url.startsWith("http:") ? httpGet : httpsGet;
12
- return new Promise((resolve, reject) => {
13
- requester(url, (response) => {
14
- const status = response.statusCode ?? 0;
15
- const location = response.headers.location;
16
- if (status >= 300 && status < 400 && location) {
17
- response.resume();
18
- if (redirectsLeft <= 0) {
19
- reject(new Error(`Too many redirects when downloading from ${url}`));
20
- return;
21
- }
22
- if (isInsecureRedirect(url, location)) {
23
- reject(new Error(`Refusing insecure https→http redirect from ${url} to ${location}`));
24
- return;
25
- }
26
- const nextUrl = new URL(location, url).toString();
27
- downloadFile(nextUrl, destPath, redirectsLeft - 1).then(resolve, reject);
28
- return;
29
- }
30
- if (status !== 200) {
31
- response.resume();
32
- reject(new Error(`HTTP ${status} when downloading from ${url}`));
33
- return;
34
- }
35
- const file = createWriteStream(destPath);
36
- response.pipe(file);
37
- file.on("finish", () => file.close(() => resolve()));
38
- file.on("error", (err) => {
39
- file.close();
40
- reject(err);
41
- });
42
- }).on("error", reject);
43
- });
44
- };