ai-localize-aws-cloudfront 1.0.0 → 2.0.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 +13 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -3
- package/dist/index.mjs +2 -2
- package/package.json +3 -3
- package/src/cdn-migrator.ts +2 -2
- package/src/cloudfront-invalidator.ts +1 -1
- package/src/s3-uploader.ts +2 -2
package/CHANGELOG.md
ADDED
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -42,7 +42,7 @@ var path = __toESM(require("path"));
|
|
|
42
42
|
var crypto = __toESM(require("crypto"));
|
|
43
43
|
var import_client_s3 = require("@aws-sdk/client-s3");
|
|
44
44
|
var mime = __toESM(require("mime-types"));
|
|
45
|
-
var
|
|
45
|
+
var import_ai_localize_shared = require("ai-localize-shared");
|
|
46
46
|
var S3Uploader = class {
|
|
47
47
|
client;
|
|
48
48
|
config;
|
|
@@ -55,7 +55,7 @@ var S3Uploader = class {
|
|
|
55
55
|
}
|
|
56
56
|
async uploadDirectory(options) {
|
|
57
57
|
const startTime = Date.now();
|
|
58
|
-
const assetFiles = (0,
|
|
58
|
+
const assetFiles = (0, import_ai_localize_shared.collectFiles)(options.assetsDir, import_ai_localize_shared.ASSET_EXTENSIONS, ["node_modules"]);
|
|
59
59
|
const uploaded = [];
|
|
60
60
|
const skipped = [];
|
|
61
61
|
const failed = [];
|
|
@@ -170,7 +170,7 @@ var CdnMigrator = class {
|
|
|
170
170
|
onProgress?.("Replacing legacy CDN URLs...");
|
|
171
171
|
let replacedUrls = 0;
|
|
172
172
|
if (!dryRun && uploadedAssets.length > 0) {
|
|
173
|
-
const { batchReplaceCdnUrls } = await import("
|
|
173
|
+
const { batchReplaceCdnUrls } = await import("ai-localize-codemods");
|
|
174
174
|
const fileUrlMap = /* @__PURE__ */ new Map();
|
|
175
175
|
for (const url of options.legacyCdnUrls) {
|
|
176
176
|
const existing = fileUrlMap.get(url.filePath) || [];
|
package/dist/index.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import * as path from "path";
|
|
|
4
4
|
import * as crypto from "crypto";
|
|
5
5
|
import { S3Client, PutObjectCommand, HeadObjectCommand } from "@aws-sdk/client-s3";
|
|
6
6
|
import * as mime from "mime-types";
|
|
7
|
-
import { collectFiles, ASSET_EXTENSIONS } from "
|
|
7
|
+
import { collectFiles, ASSET_EXTENSIONS } from "ai-localize-shared";
|
|
8
8
|
var S3Uploader = class {
|
|
9
9
|
client;
|
|
10
10
|
config;
|
|
@@ -132,7 +132,7 @@ var CdnMigrator = class {
|
|
|
132
132
|
onProgress?.("Replacing legacy CDN URLs...");
|
|
133
133
|
let replacedUrls = 0;
|
|
134
134
|
if (!dryRun && uploadedAssets.length > 0) {
|
|
135
|
-
const { batchReplaceCdnUrls } = await import("
|
|
135
|
+
const { batchReplaceCdnUrls } = await import("ai-localize-codemods");
|
|
136
136
|
const fileUrlMap = /* @__PURE__ */ new Map();
|
|
137
137
|
for (const url of options.legacyCdnUrls) {
|
|
138
138
|
const existing = fileUrlMap.get(url.filePath) || [];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ai-localize-aws-cloudfront",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "S3 upload, CloudFront invalidation, CDN URL generation",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
"@aws-sdk/client-cloudfront": "^3.511.0",
|
|
18
18
|
"@aws-sdk/lib-storage": "^3.511.0",
|
|
19
19
|
"mime-types": "^2.1.35",
|
|
20
|
-
"ai-localize-shared": "
|
|
21
|
-
"ai-localize-codemods": "
|
|
20
|
+
"ai-localize-shared": "2.0.0",
|
|
21
|
+
"ai-localize-codemods": "2.0.0"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@types/mime-types": "^2.1.4",
|
package/src/cdn-migrator.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as path from "path";
|
|
2
|
-
import type { AwsConfig, CloudFrontAsset, LegacyCdnUrl } from "
|
|
2
|
+
import type { AwsConfig, CloudFrontAsset, LegacyCdnUrl } from "ai-localize-shared";
|
|
3
3
|
import { S3Uploader } from "./s3-uploader.js";
|
|
4
4
|
import { CloudFrontInvalidator } from "./cloudfront-invalidator.js";
|
|
5
5
|
|
|
@@ -52,7 +52,7 @@ export class CdnMigrator {
|
|
|
52
52
|
let replacedUrls = 0;
|
|
53
53
|
|
|
54
54
|
if (!dryRun && uploadedAssets.length > 0) {
|
|
55
|
-
const { batchReplaceCdnUrls } = await import("
|
|
55
|
+
const { batchReplaceCdnUrls } = await import("ai-localize-codemods");
|
|
56
56
|
const fileUrlMap = new Map<string, LegacyCdnUrl[]>();
|
|
57
57
|
for (const url of options.legacyCdnUrls) {
|
|
58
58
|
const existing = fileUrlMap.get(url.filePath) || [];
|
package/src/s3-uploader.ts
CHANGED
|
@@ -4,8 +4,8 @@ import * as crypto from "crypto";
|
|
|
4
4
|
import { S3Client, PutObjectCommand, HeadObjectCommand } from "@aws-sdk/client-s3";
|
|
5
5
|
import * as mime from "mime-types";
|
|
6
6
|
|
|
7
|
-
import type { AwsConfig, CloudFrontAsset } from "
|
|
8
|
-
import { collectFiles, ASSET_EXTENSIONS } from "
|
|
7
|
+
import type { AwsConfig, CloudFrontAsset } from "ai-localize-shared";
|
|
8
|
+
import { collectFiles, ASSET_EXTENSIONS } from "ai-localize-shared";
|
|
9
9
|
|
|
10
10
|
export interface UploadOptions {
|
|
11
11
|
assetsDir: string;
|