@shipstatic/drop 2.13.0-beta.4 → 2.13.0-beta.5
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/README.md +1 -1
- package/dist/index.cjs +35 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +35 -16
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -275,7 +275,7 @@ vi.mock('@shipstatic/drop', () => ({ useDrop: mockUseDrop({ phase: 'ready' }) })
|
|
|
275
275
|
|
|
276
276
|
- **`webkitRelativePath` is the handoff.** Drop writes each file's deploy path there, and the ShipStatic SDK reads it. Don't modify it in between.
|
|
277
277
|
- **`stripCommonPrefix` mutates File objects.** It returns new `ProcessedFile`s but rewrites `webkitRelativePath` on the underlying `File` — deliberately, because that's what the SDK reads.
|
|
278
|
-
- **
|
|
278
|
+
- **A folder read only in part is refused.** If any file or folder in a drop cannot be read, the drop ends in the `error` phase under "Couldn't prepare the files", naming what could not be read. Nothing is deployed without it.
|
|
279
279
|
- **No MD5 here.** Ship computes each file's MD5 for its manifest.
|
|
280
280
|
- **`type` is the browser's report.** The platform derives `Content-Type` server-side from the path, so drop bundles no MIME database.
|
|
281
281
|
|
package/dist/index.cjs
CHANGED
|
@@ -293,6 +293,11 @@ async function projectSource(files) {
|
|
|
293
293
|
const matcher = ignore__default.default({ allowRelativePaths: true });
|
|
294
294
|
for (const { file, parts } of rules) {
|
|
295
295
|
const base = parts.slice(0, -1).join("/");
|
|
296
|
+
if (/[\r\n]/.test(base)) {
|
|
297
|
+
throw new Error(
|
|
298
|
+
"A folder in this project has a line break in its name, so its .gitignore can't be read. Rename the folder, then try again."
|
|
299
|
+
);
|
|
300
|
+
}
|
|
296
301
|
const text = (await file.text()).replace(/^\uFEFF/, "");
|
|
297
302
|
for (const line of text.split(/\r?\n/)) {
|
|
298
303
|
const pattern = rebase(line, base);
|
|
@@ -1091,24 +1096,38 @@ async function processFiles(input, { limits, onStatus }) {
|
|
|
1091
1096
|
}
|
|
1092
1097
|
|
|
1093
1098
|
// src/entries.ts
|
|
1094
|
-
|
|
1099
|
+
function unreadable(path) {
|
|
1100
|
+
return `We couldn't read ${path}. Make sure it's on this computer, then try again.`;
|
|
1101
|
+
}
|
|
1102
|
+
async function readOrRefuse(path, read) {
|
|
1095
1103
|
try {
|
|
1096
|
-
|
|
1097
|
-
|
|
1104
|
+
return await read();
|
|
1105
|
+
} catch {
|
|
1106
|
+
throw new Error(unreadable(path));
|
|
1107
|
+
}
|
|
1108
|
+
}
|
|
1109
|
+
async function traverseFileTree(entry, files, currentPath = "") {
|
|
1110
|
+
if (entry.isFile) {
|
|
1111
|
+
const path = currentPath ? `${currentPath}/${entry.name}` : entry.name;
|
|
1112
|
+
const file = await readOrRefuse(
|
|
1113
|
+
path,
|
|
1114
|
+
() => new Promise((resolve, reject) => {
|
|
1098
1115
|
entry.file(resolve, reject);
|
|
1099
|
-
})
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1116
|
+
})
|
|
1117
|
+
);
|
|
1118
|
+
setRelativePath(file, path);
|
|
1119
|
+
files.push(file);
|
|
1120
|
+
return;
|
|
1121
|
+
}
|
|
1122
|
+
if (!entry.isDirectory) return;
|
|
1123
|
+
const children = await readOrRefuse(
|
|
1124
|
+
currentPath || entry.name,
|
|
1125
|
+
() => readDirectory(entry)
|
|
1126
|
+
);
|
|
1127
|
+
for (const child of children) {
|
|
1128
|
+
if (child.isDirectory && child.name === "node_modules") continue;
|
|
1129
|
+
const childPath = child.isDirectory ? currentPath ? `${currentPath}/${child.name}` : child.name : currentPath;
|
|
1130
|
+
await traverseFileTree(child, files, childPath);
|
|
1112
1131
|
}
|
|
1113
1132
|
}
|
|
1114
1133
|
async function readDirectory(directory) {
|