smartbundle 0.12.2 → 0.12.3
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.
@@ -5,6 +5,9 @@ const fs = require("node:fs/promises");
|
|
5
5
|
const log = require("../log.js");
|
6
6
|
async function copyStaticFilesTask(sourceDir, outDir) {
|
7
7
|
const files = await copyStaticFiles({
|
8
|
+
// WARN only files inside sourceDir are supported because of node_modules
|
9
|
+
// Fix this behavior if needed in the future
|
10
|
+
// This place is not tested because I don't want to test node_modules or some same folders
|
8
11
|
relativeFiles: /* @__PURE__ */ new Set(["readme.md", "license", "license.txt"]),
|
9
12
|
sourceDir,
|
10
13
|
outDir
|
@@ -18,9 +21,8 @@ async function copyStaticFiles({
|
|
18
21
|
relativeFiles
|
19
22
|
}) {
|
20
23
|
const dirFiles = new Map(
|
21
|
-
|
22
|
-
|
23
|
-
)
|
24
|
+
// avoid {recursive: true} because of node_modules
|
25
|
+
(await fs.readdir(sourceDir)).map((f) => [f.toLowerCase(), f])
|
24
26
|
);
|
25
27
|
const res = /* @__PURE__ */ new Set();
|
26
28
|
for (const file of relativeFiles) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"copyStaticFilesTask.js","sources":["../../../../../src/tasks/copyStaticFilesTask.ts"],"sourcesContent":["import { join } from \"node:path\";\nimport { copyFile, readdir } from \"node:fs/promises\";\nimport { okLog } from \"../log.js\";\n\nexport async function copyStaticFilesTask(sourceDir: string, outDir: string) {\n const files = await copyStaticFiles({\n relativeFiles: new Set([\"readme.md\", \"license\", \"license.txt\"]),\n sourceDir,\n outDir,\n });\n\n okLog(\"Static files:\", [...files].join(\", \"));\n\n return files;\n}\n\ntype CopyStaticFilesOptions = {\n relativeFiles: Set<string>;\n sourceDir: string;\n outDir: string;\n};\n\nasync function copyStaticFiles({\n sourceDir,\n outDir,\n relativeFiles,\n}: CopyStaticFilesOptions) {\n const dirFiles = new Map(\n
|
1
|
+
{"version":3,"file":"copyStaticFilesTask.js","sources":["../../../../../src/tasks/copyStaticFilesTask.ts"],"sourcesContent":["import { join } from \"node:path\";\nimport { copyFile, readdir } from \"node:fs/promises\";\nimport { okLog } from \"../log.js\";\n\nexport async function copyStaticFilesTask(sourceDir: string, outDir: string) {\n const files = await copyStaticFiles({\n // WARN only files inside sourceDir are supported because of node_modules\n // Fix this behavior if needed in the future\n // This place is not tested because I don't want to test node_modules or some same folders\n relativeFiles: new Set([\"readme.md\", \"license\", \"license.txt\"]),\n sourceDir,\n outDir,\n });\n\n okLog(\"Static files:\", [...files].join(\", \"));\n\n return files;\n}\n\ntype CopyStaticFilesOptions = {\n relativeFiles: Set<string>;\n sourceDir: string;\n outDir: string;\n};\n\nasync function copyStaticFiles({\n sourceDir,\n outDir,\n relativeFiles,\n}: CopyStaticFilesOptions) {\n const dirFiles = new Map(\n // avoid {recursive: true} because of node_modules\n (await readdir(sourceDir)).map((f) => [f.toLowerCase(), f] as const),\n );\n\n const res = new Set<string>();\n for (const file of relativeFiles) {\n try {\n const matchingFile = dirFiles.get(file.toLowerCase());\n\n if (matchingFile) {\n const outFilePath = join(outDir, matchingFile);\n const filePath = join(sourceDir, matchingFile);\n await copyFile(filePath, outFilePath);\n res.add(matchingFile);\n }\n } catch {}\n }\n\n return res;\n}\n"],"names":["okLog","readdir","join","copyFile"],"mappings":";;;;;AAIsB,eAAA,oBAAoB,WAAmB,QAAgB;AACrE,QAAA,QAAQ,MAAM,gBAAgB;AAAA;AAAA;AAAA;AAAA,IAIlC,eAAmB,oBAAA,IAAI,CAAC,aAAa,WAAW,aAAa,CAAC;AAAA,IAC9D;AAAA,IACA;AAAA,EAAA,CACD;AAEDA,MAAA,MAAM,iBAAiB,CAAC,GAAG,KAAK,EAAE,KAAK,IAAI,CAAC;AAErC,SAAA;AACT;AAQA,eAAe,gBAAgB;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AACF,GAA2B;AACzB,QAAM,WAAW,IAAI;AAAA;AAAA,KAElB,MAAMC,GAAAA,QAAQ,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,EAAE,YAAe,GAAA,CAAC,CAAU;AAAA,EACrE;AAEM,QAAA,0BAAU,IAAY;AAC5B,aAAW,QAAQ,eAAe;AAC5B,QAAA;AACF,YAAM,eAAe,SAAS,IAAI,KAAK,aAAa;AAEpD,UAAI,cAAc;AACV,cAAA,cAAcC,KAAAA,KAAK,QAAQ,YAAY;AACvC,cAAA,WAAWA,KAAAA,KAAK,WAAW,YAAY;AACvC,cAAAC,GAAA,SAAS,UAAU,WAAW;AACpC,YAAI,IAAI,YAAY;AAAA,MAAA;AAAA,IACtB,QACM;AAAA,IAAA;AAAA,EAAC;AAGJ,SAAA;AACT;;"}
|
@@ -3,6 +3,9 @@ import { readdir, copyFile } from "node:fs/promises";
|
|
3
3
|
import { okLog } from "../log.mjs";
|
4
4
|
async function copyStaticFilesTask(sourceDir, outDir) {
|
5
5
|
const files = await copyStaticFiles({
|
6
|
+
// WARN only files inside sourceDir are supported because of node_modules
|
7
|
+
// Fix this behavior if needed in the future
|
8
|
+
// This place is not tested because I don't want to test node_modules or some same folders
|
6
9
|
relativeFiles: /* @__PURE__ */ new Set(["readme.md", "license", "license.txt"]),
|
7
10
|
sourceDir,
|
8
11
|
outDir
|
@@ -16,9 +19,8 @@ async function copyStaticFiles({
|
|
16
19
|
relativeFiles
|
17
20
|
}) {
|
18
21
|
const dirFiles = new Map(
|
19
|
-
|
20
|
-
|
21
|
-
)
|
22
|
+
// avoid {recursive: true} because of node_modules
|
23
|
+
(await readdir(sourceDir)).map((f) => [f.toLowerCase(), f])
|
22
24
|
);
|
23
25
|
const res = /* @__PURE__ */ new Set();
|
24
26
|
for (const file of relativeFiles) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"copyStaticFilesTask.mjs","sources":["../../../../../src/tasks/copyStaticFilesTask.ts"],"sourcesContent":["import { join } from \"node:path\";\nimport { copyFile, readdir } from \"node:fs/promises\";\nimport { okLog } from \"../log.js\";\n\nexport async function copyStaticFilesTask(sourceDir: string, outDir: string) {\n const files = await copyStaticFiles({\n relativeFiles: new Set([\"readme.md\", \"license\", \"license.txt\"]),\n sourceDir,\n outDir,\n });\n\n okLog(\"Static files:\", [...files].join(\", \"));\n\n return files;\n}\n\ntype CopyStaticFilesOptions = {\n relativeFiles: Set<string>;\n sourceDir: string;\n outDir: string;\n};\n\nasync function copyStaticFiles({\n sourceDir,\n outDir,\n relativeFiles,\n}: CopyStaticFilesOptions) {\n const dirFiles = new Map(\n
|
1
|
+
{"version":3,"file":"copyStaticFilesTask.mjs","sources":["../../../../../src/tasks/copyStaticFilesTask.ts"],"sourcesContent":["import { join } from \"node:path\";\nimport { copyFile, readdir } from \"node:fs/promises\";\nimport { okLog } from \"../log.js\";\n\nexport async function copyStaticFilesTask(sourceDir: string, outDir: string) {\n const files = await copyStaticFiles({\n // WARN only files inside sourceDir are supported because of node_modules\n // Fix this behavior if needed in the future\n // This place is not tested because I don't want to test node_modules or some same folders\n relativeFiles: new Set([\"readme.md\", \"license\", \"license.txt\"]),\n sourceDir,\n outDir,\n });\n\n okLog(\"Static files:\", [...files].join(\", \"));\n\n return files;\n}\n\ntype CopyStaticFilesOptions = {\n relativeFiles: Set<string>;\n sourceDir: string;\n outDir: string;\n};\n\nasync function copyStaticFiles({\n sourceDir,\n outDir,\n relativeFiles,\n}: CopyStaticFilesOptions) {\n const dirFiles = new Map(\n // avoid {recursive: true} because of node_modules\n (await readdir(sourceDir)).map((f) => [f.toLowerCase(), f] as const),\n );\n\n const res = new Set<string>();\n for (const file of relativeFiles) {\n try {\n const matchingFile = dirFiles.get(file.toLowerCase());\n\n if (matchingFile) {\n const outFilePath = join(outDir, matchingFile);\n const filePath = join(sourceDir, matchingFile);\n await copyFile(filePath, outFilePath);\n res.add(matchingFile);\n }\n } catch {}\n }\n\n return res;\n}\n"],"names":[],"mappings":";;;AAIsB,eAAA,oBAAoB,WAAmB,QAAgB;AACrE,QAAA,QAAQ,MAAM,gBAAgB;AAAA;AAAA;AAAA;AAAA,IAIlC,eAAmB,oBAAA,IAAI,CAAC,aAAa,WAAW,aAAa,CAAC;AAAA,IAC9D;AAAA,IACA;AAAA,EAAA,CACD;AAED,QAAM,iBAAiB,CAAC,GAAG,KAAK,EAAE,KAAK,IAAI,CAAC;AAErC,SAAA;AACT;AAQA,eAAe,gBAAgB;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AACF,GAA2B;AACzB,QAAM,WAAW,IAAI;AAAA;AAAA,KAElB,MAAM,QAAQ,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,EAAE,YAAe,GAAA,CAAC,CAAU;AAAA,EACrE;AAEM,QAAA,0BAAU,IAAY;AAC5B,aAAW,QAAQ,eAAe;AAC5B,QAAA;AACF,YAAM,eAAe,SAAS,IAAI,KAAK,aAAa;AAEpD,UAAI,cAAc;AACV,cAAA,cAAc,KAAK,QAAQ,YAAY;AACvC,cAAA,WAAW,KAAK,WAAW,YAAY;AACvC,cAAA,SAAS,UAAU,WAAW;AACpC,YAAI,IAAI,YAAY;AAAA,MAAA;AAAA,IACtB,QACM;AAAA,IAAA;AAAA,EAAC;AAGJ,SAAA;AACT;"}
|