@slicemachine/adapter-next 0.0.9 → 0.0.10
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/hooks/command-init.cjs +191 -0
- package/dist/hooks/command-init.cjs.map +1 -0
- package/dist/hooks/command-init.d.ts +3 -0
- package/dist/hooks/command-init.js +173 -0
- package/dist/hooks/command-init.js.map +1 -0
- package/dist/hooks/sliceSimulator-setup-read.cjs +2 -0
- package/dist/hooks/sliceSimulator-setup-read.cjs.map +1 -1
- package/dist/hooks/sliceSimulator-setup-read.js +2 -0
- package/dist/hooks/sliceSimulator-setup-read.js.map +1 -1
- package/dist/lib/checkPathExists.cjs +30 -0
- package/dist/lib/checkPathExists.cjs.map +1 -0
- package/dist/lib/checkPathExists.d.ts +2 -0
- package/dist/lib/checkPathExists.js +13 -0
- package/dist/lib/checkPathExists.js.map +1 -0
- package/dist/lib/rejectIfNecessary.cjs.map +1 -1
- package/dist/lib/rejectIfNecessary.js.map +1 -1
- package/dist/lib/upsertSliceLibraryIndexFile.cjs +31 -10
- package/dist/lib/upsertSliceLibraryIndexFile.cjs.map +1 -1
- package/dist/lib/upsertSliceLibraryIndexFile.js +31 -10
- package/dist/lib/upsertSliceLibraryIndexFile.js.map +1 -1
- package/dist/node_modules/data-uri-to-buffer/dist/index.cjs.map +1 -1
- package/dist/node_modules/data-uri-to-buffer/dist/index.js.map +1 -1
- package/dist/node_modules/fetch-blob/file.cjs +6 -0
- package/dist/node_modules/fetch-blob/file.cjs.map +1 -1
- package/dist/node_modules/fetch-blob/file.js +6 -0
- package/dist/node_modules/fetch-blob/file.js.map +1 -1
- package/dist/node_modules/fetch-blob/index.cjs +48 -2
- package/dist/node_modules/fetch-blob/index.cjs.map +1 -1
- package/dist/node_modules/fetch-blob/index.js +48 -2
- package/dist/node_modules/fetch-blob/index.js.map +1 -1
- package/dist/node_modules/fetch-blob/streams.cjs.map +1 -1
- package/dist/node_modules/fetch-blob/streams.js.map +1 -1
- package/dist/node_modules/formdata-polyfill/esm.min.cjs.map +1 -1
- package/dist/node_modules/formdata-polyfill/esm.min.js.map +1 -1
- package/dist/node_modules/node-domexception/index.cjs.map +1 -1
- package/dist/node_modules/node-domexception/index.js.map +1 -1
- package/dist/node_modules/node-fetch/src/body.cjs +25 -0
- package/dist/node_modules/node-fetch/src/body.cjs.map +1 -1
- package/dist/node_modules/node-fetch/src/body.js +25 -0
- package/dist/node_modules/node-fetch/src/body.js.map +1 -1
- package/dist/node_modules/node-fetch/src/errors/base.cjs.map +1 -1
- package/dist/node_modules/node-fetch/src/errors/base.js.map +1 -1
- package/dist/node_modules/node-fetch/src/errors/fetch-error.cjs +5 -0
- package/dist/node_modules/node-fetch/src/errors/fetch-error.cjs.map +1 -1
- package/dist/node_modules/node-fetch/src/errors/fetch-error.js +5 -0
- package/dist/node_modules/node-fetch/src/errors/fetch-error.js.map +1 -1
- package/dist/node_modules/node-fetch/src/headers.cjs +17 -0
- package/dist/node_modules/node-fetch/src/headers.cjs.map +1 -1
- package/dist/node_modules/node-fetch/src/headers.js +17 -0
- package/dist/node_modules/node-fetch/src/headers.js.map +1 -1
- package/dist/node_modules/node-fetch/src/index.cjs.map +1 -1
- package/dist/node_modules/node-fetch/src/index.js.map +1 -1
- package/dist/node_modules/node-fetch/src/request.cjs +13 -0
- package/dist/node_modules/node-fetch/src/request.cjs.map +1 -1
- package/dist/node_modules/node-fetch/src/request.js +13 -0
- package/dist/node_modules/node-fetch/src/request.js.map +1 -1
- package/dist/node_modules/node-fetch/src/response.cjs +13 -0
- package/dist/node_modules/node-fetch/src/response.cjs.map +1 -1
- package/dist/node_modules/node-fetch/src/response.js +13 -0
- package/dist/node_modules/node-fetch/src/response.js.map +1 -1
- package/dist/node_modules/node-fetch/src/utils/get-search.cjs.map +1 -1
- package/dist/node_modules/node-fetch/src/utils/get-search.js.map +1 -1
- package/dist/node_modules/node-fetch/src/utils/is.cjs.map +1 -1
- package/dist/node_modules/node-fetch/src/utils/is.js.map +1 -1
- package/dist/node_modules/node-fetch/src/utils/multipart-parser.cjs +6 -0
- package/dist/node_modules/node-fetch/src/utils/multipart-parser.cjs.map +1 -1
- package/dist/node_modules/node-fetch/src/utils/multipart-parser.js +6 -0
- package/dist/node_modules/node-fetch/src/utils/multipart-parser.js.map +1 -1
- package/dist/node_modules/web-streams-polyfill/dist/ponyfill.es2018.cjs +223 -0
- package/dist/node_modules/web-streams-polyfill/dist/ponyfill.es2018.cjs.map +1 -1
- package/dist/node_modules/web-streams-polyfill/dist/ponyfill.es2018.js +223 -0
- package/dist/node_modules/web-streams-polyfill/dist/ponyfill.es2018.js.map +1 -1
- package/dist/plugin.cjs +4 -1
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.js +4 -1
- package/dist/plugin.js.map +1 -1
- package/dist/types.d.ts +1 -0
- package/package.json +15 -15
- package/src/hooks/command-init.ts +221 -0
- package/src/lib/checkPathExists.ts +12 -0
- package/src/lib/upsertSliceLibraryIndexFile.ts +37 -9
- package/src/plugin.ts +4 -0
- package/src/types.ts +1 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upsertSliceLibraryIndexFile.cjs","sources":["../../../src/lib/upsertSliceLibraryIndexFile.ts"],"sourcesContent":["import { SliceMachineContext } from \"@slicemachine/plugin-kit\";\nimport { stripIndent } from \"common-tags\";\nimport * as fs from \"node:fs/promises\";\nimport { NON_EDITABLE_FILE_BANNER } from \"../constants\";\n\nimport { PluginOptions } from \"../types\";\n\nimport { pascalCase } from \"./pascalCase\";\n\ntype UpsertSliceLibraryIndexFileArgs = {\n\tlibraryID: string;\n} & SliceMachineContext<PluginOptions>;\n\nexport const upsertSliceLibraryIndexFile = async (\n\targs: UpsertSliceLibraryIndexFileArgs,\n): Promise<void> => {\n\tconst filePath = args.helpers.joinPathFromRoot(\n\t\targs.libraryID,\n\t\targs.options.typescript ? \"index.ts\" : \"index.js\",\n\t);\n\n\tconst slices = await args.actions.readAllSliceModelsForLibrary({\n\t\tlibraryID: args.libraryID,\n\t});\n\n\tlet contents = stripIndent`\n\t\t${NON_EDITABLE_FILE_BANNER}\n\n\t\timport dynamic from 'next/dynamic'\n\n\t\texport const components = {\n\t\t\t${slices\n\t\t\t\t.map((slice) => {\n\t\t\t\t\tconst id = slice.model.id;\n\t\t\t\t\tconst dirName = pascalCase(slice.model.name);\n\n\t\t\t\t\treturn `${id}: dynamic(() => import('./${dirName}'))`;\n\t\t\t\t})\n\t\t\t\t.join(\",\\n\")}\n\t\t}\n\t`;\n\n\tif (args.options.format) {\n\t\tcontents = await args.helpers.format(contents, filePath);\n\t}\n\n\tawait fs.writeFile(filePath, contents);\n};\n"],"names":["stripIndent","NON_EDITABLE_FILE_BANNER","pascalCase","fs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAaa,MAAA,8BAA8B,OAC1C,SACkB;AACZ,QAAA,WAAW,KAAK,QAAQ,iBAC7B,KAAK,WACL,KAAK,QAAQ,aAAa,aAAa,UAAU;AAGlD,QAAM,SAAS,MAAM,KAAK,QAAQ,6BAA6B;AAAA,IAC9D,WAAW,KAAK;AAAA,EAAA,CAChB;
|
|
1
|
+
{"version":3,"file":"upsertSliceLibraryIndexFile.cjs","sources":["../../../src/lib/upsertSliceLibraryIndexFile.ts"],"sourcesContent":["import { SliceMachineContext } from \"@slicemachine/plugin-kit\";\nimport { stripIndent } from \"common-tags\";\nimport * as fs from \"node:fs/promises\";\nimport { NON_EDITABLE_FILE_BANNER } from \"../constants\";\n\nimport { PluginOptions } from \"../types\";\n\nimport { pascalCase } from \"./pascalCase\";\n\ntype UpsertSliceLibraryIndexFileArgs = {\n\tlibraryID: string;\n} & SliceMachineContext<PluginOptions>;\n\nexport const upsertSliceLibraryIndexFile = async (\n\targs: UpsertSliceLibraryIndexFileArgs,\n): Promise<void> => {\n\tconst filePath = args.helpers.joinPathFromRoot(\n\t\targs.libraryID,\n\t\targs.options.typescript ? \"index.ts\" : \"index.js\",\n\t);\n\n\tconst slices = await args.actions.readAllSliceModelsForLibrary({\n\t\tlibraryID: args.libraryID,\n\t});\n\n\tlet contents: string;\n\n\tif (args.options.lazyLoadSlices) {\n\t\tcontents = stripIndent`\n\t\t\t${NON_EDITABLE_FILE_BANNER}\n\n\t\t\timport dynamic from 'next/dynamic'\n\n\t\t\texport const components = {\n\t\t\t\t${slices\n\t\t\t\t\t.map((slice) => {\n\t\t\t\t\t\tconst id = slice.model.id;\n\t\t\t\t\t\tconst dirName = pascalCase(slice.model.name);\n\n\t\t\t\t\t\treturn `${id}: dynamic(() => import('./${dirName}'))`;\n\t\t\t\t\t})\n\t\t\t\t\t.join(\",\\n\")}\n\t\t\t}\n\t\t`;\n\t} else {\n\t\tcontents = stripIndent`\n\t\t\t${NON_EDITABLE_FILE_BANNER}\n\n\t\t\t${slices\n\t\t\t\t.map((slice) => {\n\t\t\t\t\tconst componentName = pascalCase(slice.model.name);\n\t\t\t\t\tconst dirName = pascalCase(slice.model.name);\n\n\t\t\t\t\treturn `import ${componentName} from \"./${dirName}\";`;\n\t\t\t\t})\n\t\t\t\t.join(\"\\n\")}\n\n\t\t\texport const components = {\n\t\t\t\t${slices\n\t\t\t\t\t.map((slice) => {\n\t\t\t\t\t\tconst id = slice.model.id;\n\t\t\t\t\t\tconst componentName = pascalCase(slice.model.name);\n\n\t\t\t\t\t\treturn `${id}: ${componentName},`;\n\t\t\t\t\t})\n\t\t\t\t\t.join(\"\\n\")}\n\t\t\t}\n\t\t`;\n\t}\n\n\tif (args.options.format) {\n\t\tcontents = await args.helpers.format(contents, filePath);\n\t}\n\n\tawait fs.writeFile(filePath, contents);\n};\n"],"names":["stripIndent","NON_EDITABLE_FILE_BANNER","pascalCase","fs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAaa,MAAA,8BAA8B,OAC1C,SACkB;AACZ,QAAA,WAAW,KAAK,QAAQ,iBAC7B,KAAK,WACL,KAAK,QAAQ,aAAa,aAAa,UAAU;AAGlD,QAAM,SAAS,MAAM,KAAK,QAAQ,6BAA6B;AAAA,IAC9D,WAAW,KAAK;AAAA,EAAA,CAChB;AAEG,MAAA;AAEA,MAAA,KAAK,QAAQ,gBAAgB;AACrB,eAAAA,WAAAA;AAAAA,KACRC;;;;;MAKC,OACA,IAAI,CAAC,UAAS;AACR,YAAA,KAAK,MAAM,MAAM;AACvB,YAAM,UAAUC,WAAA,WAAW,MAAM,MAAM,IAAI;AAE3C,aAAO,GAAG,+BAA+B;AAAA,IAAA,CACzC,EACA,KAAK,KAAK;AAAA;AAAA;AAAA,EAAA,OAGR;AACK,eAAAF,WAAAA;AAAAA,KACRC;;KAEA,OACA,IAAI,CAAC,UAAS;AACd,YAAM,gBAAgBC,WAAA,WAAW,MAAM,MAAM,IAAI;AACjD,YAAM,UAAUA,WAAA,WAAW,MAAM,MAAM,IAAI;AAE3C,aAAO,UAAU,yBAAyB;AAAA,IAAA,CAC1C,EACA,KAAK,IAAI;AAAA;AAAA;AAAA,MAGR,OACA,IAAI,CAAC,UAAS;AACR,YAAA,KAAK,MAAM,MAAM;AACvB,YAAM,gBAAgBA,WAAA,WAAW,MAAM,MAAM,IAAI;AAEjD,aAAO,GAAG,OAAO;AAAA,IAAA,CACjB,EACA,KAAK,IAAI;AAAA;AAAA;AAAA,EAGb;AAEG,MAAA,KAAK,QAAQ,QAAQ;AACxB,eAAW,MAAM,KAAK,QAAQ,OAAO,UAAU,QAAQ;AAAA,EACvD;AAEK,QAAAC,cAAG,UAAU,UAAU,QAAQ;AACtC;;"}
|
|
@@ -7,19 +7,40 @@ const upsertSliceLibraryIndexFile = async (args) => {
|
|
|
7
7
|
const slices = await args.actions.readAllSliceModelsForLibrary({
|
|
8
8
|
libraryID: args.libraryID
|
|
9
9
|
});
|
|
10
|
-
let contents
|
|
11
|
-
|
|
10
|
+
let contents;
|
|
11
|
+
if (args.options.lazyLoadSlices) {
|
|
12
|
+
contents = stripIndent`
|
|
13
|
+
${NON_EDITABLE_FILE_BANNER}
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
import dynamic from 'next/dynamic'
|
|
16
|
+
|
|
17
|
+
export const components = {
|
|
18
|
+
${slices.map((slice) => {
|
|
19
|
+
const id = slice.model.id;
|
|
20
|
+
const dirName = pascalCase(slice.model.name);
|
|
21
|
+
return `${id}: dynamic(() => import('./${dirName}'))`;
|
|
22
|
+
}).join(",\n")}
|
|
23
|
+
}
|
|
24
|
+
`;
|
|
25
|
+
} else {
|
|
26
|
+
contents = stripIndent`
|
|
27
|
+
${NON_EDITABLE_FILE_BANNER}
|
|
14
28
|
|
|
15
|
-
export const components = {
|
|
16
29
|
${slices.map((slice) => {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
30
|
+
const componentName = pascalCase(slice.model.name);
|
|
31
|
+
const dirName = pascalCase(slice.model.name);
|
|
32
|
+
return `import ${componentName} from "./${dirName}";`;
|
|
33
|
+
}).join("\n")}
|
|
34
|
+
|
|
35
|
+
export const components = {
|
|
36
|
+
${slices.map((slice) => {
|
|
37
|
+
const id = slice.model.id;
|
|
38
|
+
const componentName = pascalCase(slice.model.name);
|
|
39
|
+
return `${id}: ${componentName},`;
|
|
40
|
+
}).join("\n")}
|
|
41
|
+
}
|
|
42
|
+
`;
|
|
43
|
+
}
|
|
23
44
|
if (args.options.format) {
|
|
24
45
|
contents = await args.helpers.format(contents, filePath);
|
|
25
46
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upsertSliceLibraryIndexFile.js","sources":["../../../src/lib/upsertSliceLibraryIndexFile.ts"],"sourcesContent":["import { SliceMachineContext } from \"@slicemachine/plugin-kit\";\nimport { stripIndent } from \"common-tags\";\nimport * as fs from \"node:fs/promises\";\nimport { NON_EDITABLE_FILE_BANNER } from \"../constants\";\n\nimport { PluginOptions } from \"../types\";\n\nimport { pascalCase } from \"./pascalCase\";\n\ntype UpsertSliceLibraryIndexFileArgs = {\n\tlibraryID: string;\n} & SliceMachineContext<PluginOptions>;\n\nexport const upsertSliceLibraryIndexFile = async (\n\targs: UpsertSliceLibraryIndexFileArgs,\n): Promise<void> => {\n\tconst filePath = args.helpers.joinPathFromRoot(\n\t\targs.libraryID,\n\t\targs.options.typescript ? \"index.ts\" : \"index.js\",\n\t);\n\n\tconst slices = await args.actions.readAllSliceModelsForLibrary({\n\t\tlibraryID: args.libraryID,\n\t});\n\n\tlet contents = stripIndent`\n\t\t${NON_EDITABLE_FILE_BANNER}\n\n\t\timport dynamic from 'next/dynamic'\n\n\t\texport const components = {\n\t\t\t${slices\n\t\t\t\t.map((slice) => {\n\t\t\t\t\tconst id = slice.model.id;\n\t\t\t\t\tconst dirName = pascalCase(slice.model.name);\n\n\t\t\t\t\treturn `${id}: dynamic(() => import('./${dirName}'))`;\n\t\t\t\t})\n\t\t\t\t.join(\",\\n\")}\n\t\t}\n\t`;\n\n\tif (args.options.format) {\n\t\tcontents = await args.helpers.format(contents, filePath);\n\t}\n\n\tawait fs.writeFile(filePath, contents);\n};\n"],"names":[],"mappings":";;;;AAaa,MAAA,8BAA8B,OAC1C,SACkB;AACZ,QAAA,WAAW,KAAK,QAAQ,iBAC7B,KAAK,WACL,KAAK,QAAQ,aAAa,aAAa,UAAU;AAGlD,QAAM,SAAS,MAAM,KAAK,QAAQ,6BAA6B;AAAA,IAC9D,WAAW,KAAK;AAAA,EAAA,CAChB;
|
|
1
|
+
{"version":3,"file":"upsertSliceLibraryIndexFile.js","sources":["../../../src/lib/upsertSliceLibraryIndexFile.ts"],"sourcesContent":["import { SliceMachineContext } from \"@slicemachine/plugin-kit\";\nimport { stripIndent } from \"common-tags\";\nimport * as fs from \"node:fs/promises\";\nimport { NON_EDITABLE_FILE_BANNER } from \"../constants\";\n\nimport { PluginOptions } from \"../types\";\n\nimport { pascalCase } from \"./pascalCase\";\n\ntype UpsertSliceLibraryIndexFileArgs = {\n\tlibraryID: string;\n} & SliceMachineContext<PluginOptions>;\n\nexport const upsertSliceLibraryIndexFile = async (\n\targs: UpsertSliceLibraryIndexFileArgs,\n): Promise<void> => {\n\tconst filePath = args.helpers.joinPathFromRoot(\n\t\targs.libraryID,\n\t\targs.options.typescript ? \"index.ts\" : \"index.js\",\n\t);\n\n\tconst slices = await args.actions.readAllSliceModelsForLibrary({\n\t\tlibraryID: args.libraryID,\n\t});\n\n\tlet contents: string;\n\n\tif (args.options.lazyLoadSlices) {\n\t\tcontents = stripIndent`\n\t\t\t${NON_EDITABLE_FILE_BANNER}\n\n\t\t\timport dynamic from 'next/dynamic'\n\n\t\t\texport const components = {\n\t\t\t\t${slices\n\t\t\t\t\t.map((slice) => {\n\t\t\t\t\t\tconst id = slice.model.id;\n\t\t\t\t\t\tconst dirName = pascalCase(slice.model.name);\n\n\t\t\t\t\t\treturn `${id}: dynamic(() => import('./${dirName}'))`;\n\t\t\t\t\t})\n\t\t\t\t\t.join(\",\\n\")}\n\t\t\t}\n\t\t`;\n\t} else {\n\t\tcontents = stripIndent`\n\t\t\t${NON_EDITABLE_FILE_BANNER}\n\n\t\t\t${slices\n\t\t\t\t.map((slice) => {\n\t\t\t\t\tconst componentName = pascalCase(slice.model.name);\n\t\t\t\t\tconst dirName = pascalCase(slice.model.name);\n\n\t\t\t\t\treturn `import ${componentName} from \"./${dirName}\";`;\n\t\t\t\t})\n\t\t\t\t.join(\"\\n\")}\n\n\t\t\texport const components = {\n\t\t\t\t${slices\n\t\t\t\t\t.map((slice) => {\n\t\t\t\t\t\tconst id = slice.model.id;\n\t\t\t\t\t\tconst componentName = pascalCase(slice.model.name);\n\n\t\t\t\t\t\treturn `${id}: ${componentName},`;\n\t\t\t\t\t})\n\t\t\t\t\t.join(\"\\n\")}\n\t\t\t}\n\t\t`;\n\t}\n\n\tif (args.options.format) {\n\t\tcontents = await args.helpers.format(contents, filePath);\n\t}\n\n\tawait fs.writeFile(filePath, contents);\n};\n"],"names":[],"mappings":";;;;AAaa,MAAA,8BAA8B,OAC1C,SACkB;AACZ,QAAA,WAAW,KAAK,QAAQ,iBAC7B,KAAK,WACL,KAAK,QAAQ,aAAa,aAAa,UAAU;AAGlD,QAAM,SAAS,MAAM,KAAK,QAAQ,6BAA6B;AAAA,IAC9D,WAAW,KAAK;AAAA,EAAA,CAChB;AAEG,MAAA;AAEA,MAAA,KAAK,QAAQ,gBAAgB;AACrB,eAAA;AAAA,KACR;AAAA;AAAA;AAAA;AAAA;AAAA,MAKC,OACA,IAAI,CAAC,UAAS;AACR,YAAA,KAAK,MAAM,MAAM;AACvB,YAAM,UAAU,WAAW,MAAM,MAAM,IAAI;AAE3C,aAAO,GAAG,+BAA+B;AAAA,IAAA,CACzC,EACA,KAAK,KAAK;AAAA;AAAA;AAAA,EAAA,OAGR;AACK,eAAA;AAAA,KACR;AAAA;AAAA,KAEA,OACA,IAAI,CAAC,UAAS;AACd,YAAM,gBAAgB,WAAW,MAAM,MAAM,IAAI;AACjD,YAAM,UAAU,WAAW,MAAM,MAAM,IAAI;AAE3C,aAAO,UAAU,yBAAyB;AAAA,IAAA,CAC1C,EACA,KAAK,IAAI;AAAA;AAAA;AAAA,MAGR,OACA,IAAI,CAAC,UAAS;AACR,YAAA,KAAK,MAAM,MAAM;AACvB,YAAM,gBAAgB,WAAW,MAAM,MAAM,IAAI;AAEjD,aAAO,GAAG,OAAO;AAAA,IAAA,CACjB,EACA,KAAK,IAAI;AAAA;AAAA;AAAA,EAGb;AAEG,MAAA,KAAK,QAAQ,QAAQ;AACxB,eAAW,MAAM,KAAK,QAAQ,OAAO,UAAU,QAAQ;AAAA,EACvD;AAEK,QAAA,GAAG,UAAU,UAAU,QAAQ;AACtC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../../node_modules/data-uri-to-buffer/dist/index.js"],"sourcesContent":["/**\n * Returns a `Buffer` instance from the given data URI `uri`.\n *\n * @param {String} uri Data URI to turn into a Buffer instance\n * @returns {Buffer} Buffer instance from Data URI\n * @api public\n */\nexport function dataUriToBuffer(uri) {\n if (!/^data:/i.test(uri)) {\n throw new TypeError('`uri` does not appear to be a Data URI (must begin with \"data:\")');\n }\n // strip newlines\n uri = uri.replace(/\\r?\\n/g, '');\n // split the URI up into the \"metadata\" and the \"data\" portions\n const firstComma = uri.indexOf(',');\n if (firstComma === -1 || firstComma <= 4) {\n throw new TypeError('malformed data: URI');\n }\n // remove the \"data:\" scheme and parse the metadata\n const meta = uri.substring(5, firstComma).split(';');\n let charset = '';\n let base64 = false;\n const type = meta[0] || 'text/plain';\n let typeFull = type;\n for (let i = 1; i < meta.length; i++) {\n if (meta[i] === 'base64') {\n base64 = true;\n }\n else {\n typeFull += `;${meta[i]}`;\n if (meta[i].indexOf('charset=') === 0) {\n charset = meta[i].substring(8);\n }\n }\n }\n // defaults to US-ASCII only if type is not provided\n if (!meta[0] && !charset.length) {\n typeFull += ';charset=US-ASCII';\n charset = 'US-ASCII';\n }\n // get the encoded data portion and decode URI-encoded chars\n const encoding = base64 ? 'base64' : 'ascii';\n const data = unescape(uri.substring(firstComma + 1));\n const buffer = Buffer.from(data, encoding);\n // set `.type` and `.typeFull` properties to MIME type\n buffer.type = type;\n buffer.typeFull = typeFull;\n // set the `.charset` property\n buffer.charset = charset;\n return buffer;\n}\nexport default dataUriToBuffer;\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":";;AAOO,SAAS,gBAAgB,KAAK;AACjC,MAAI,CAAC,UAAU,KAAK,GAAG,GAAG;AACtB,UAAM,IAAI,UAAU,kEAAkE;AAAA,EACzF;AAED,QAAM,IAAI,QAAQ,UAAU,EAAE;AAE9B,QAAM,aAAa,IAAI,QAAQ,GAAG;AAClC,MAAI,eAAe,MAAM,cAAc,GAAG;AACtC,UAAM,IAAI,UAAU,qBAAqB;AAAA,EAC5C;AAED,QAAM,OAAO,IAAI,UAAU,GAAG,UAAU,EAAE,MAAM,GAAG;AACnD,MAAI,UAAU;AACd,MAAI,SAAS;AACb,QAAM,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../../node_modules/data-uri-to-buffer/dist/index.js"],"sourcesContent":["/**\n * Returns a `Buffer` instance from the given data URI `uri`.\n *\n * @param {String} uri Data URI to turn into a Buffer instance\n * @returns {Buffer} Buffer instance from Data URI\n * @api public\n */\nexport function dataUriToBuffer(uri) {\n if (!/^data:/i.test(uri)) {\n throw new TypeError('`uri` does not appear to be a Data URI (must begin with \"data:\")');\n }\n // strip newlines\n uri = uri.replace(/\\r?\\n/g, '');\n // split the URI up into the \"metadata\" and the \"data\" portions\n const firstComma = uri.indexOf(',');\n if (firstComma === -1 || firstComma <= 4) {\n throw new TypeError('malformed data: URI');\n }\n // remove the \"data:\" scheme and parse the metadata\n const meta = uri.substring(5, firstComma).split(';');\n let charset = '';\n let base64 = false;\n const type = meta[0] || 'text/plain';\n let typeFull = type;\n for (let i = 1; i < meta.length; i++) {\n if (meta[i] === 'base64') {\n base64 = true;\n }\n else {\n typeFull += `;${meta[i]}`;\n if (meta[i].indexOf('charset=') === 0) {\n charset = meta[i].substring(8);\n }\n }\n }\n // defaults to US-ASCII only if type is not provided\n if (!meta[0] && !charset.length) {\n typeFull += ';charset=US-ASCII';\n charset = 'US-ASCII';\n }\n // get the encoded data portion and decode URI-encoded chars\n const encoding = base64 ? 'base64' : 'ascii';\n const data = unescape(uri.substring(firstComma + 1));\n const buffer = Buffer.from(data, encoding);\n // set `.type` and `.typeFull` properties to MIME type\n buffer.type = type;\n buffer.typeFull = typeFull;\n // set the `.charset` property\n buffer.charset = charset;\n return buffer;\n}\nexport default dataUriToBuffer;\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":";;AAOO,SAAS,gBAAgB,KAAK;AACjC,MAAI,CAAC,UAAU,KAAK,GAAG,GAAG;AACtB,UAAM,IAAI,UAAU,kEAAkE;AAAA,EACzF;AAED,QAAM,IAAI,QAAQ,UAAU,EAAE;AAE9B,QAAM,aAAa,IAAI,QAAQ,GAAG;AAClC,MAAI,eAAe,MAAM,cAAc,GAAG;AACtC,UAAM,IAAI,UAAU,qBAAqB;AAAA,EAC5C;AAED,QAAM,OAAO,IAAI,UAAU,GAAG,UAAU,EAAE,MAAM,GAAG;AACnD,MAAI,UAAU;AACd,MAAI,SAAS;AACb,QAAM,OAAO,KAAK,CAAC,KAAK;AACxB,MAAI,WAAW;AACf,WAAS,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;AAClC,QAAI,KAAK,CAAC,MAAM,UAAU;AACtB,eAAS;AAAA,IACZ,OACI;AACD,kBAAY,IAAI,KAAK,CAAC;AACtB,UAAI,KAAK,CAAC,EAAE,QAAQ,UAAU,MAAM,GAAG;AACnC,kBAAU,KAAK,CAAC,EAAE,UAAU,CAAC;AAAA,MAChC;AAAA,IACJ;AAAA,EACJ;AAED,MAAI,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,QAAQ;AAC7B,gBAAY;AACZ,cAAU;AAAA,EACb;AAED,QAAM,WAAW,SAAS,WAAW;AACrC,QAAM,OAAO,SAAS,IAAI,UAAU,aAAa,CAAC,CAAC;AACnD,QAAM,SAAS,OAAO,KAAK,MAAM,QAAQ;AAEzC,SAAO,OAAO;AACd,SAAO,WAAW;AAElB,SAAO,UAAU;AACjB,SAAO;AACX;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../node_modules/data-uri-to-buffer/dist/index.js"],"sourcesContent":["/**\n * Returns a `Buffer` instance from the given data URI `uri`.\n *\n * @param {String} uri Data URI to turn into a Buffer instance\n * @returns {Buffer} Buffer instance from Data URI\n * @api public\n */\nexport function dataUriToBuffer(uri) {\n if (!/^data:/i.test(uri)) {\n throw new TypeError('`uri` does not appear to be a Data URI (must begin with \"data:\")');\n }\n // strip newlines\n uri = uri.replace(/\\r?\\n/g, '');\n // split the URI up into the \"metadata\" and the \"data\" portions\n const firstComma = uri.indexOf(',');\n if (firstComma === -1 || firstComma <= 4) {\n throw new TypeError('malformed data: URI');\n }\n // remove the \"data:\" scheme and parse the metadata\n const meta = uri.substring(5, firstComma).split(';');\n let charset = '';\n let base64 = false;\n const type = meta[0] || 'text/plain';\n let typeFull = type;\n for (let i = 1; i < meta.length; i++) {\n if (meta[i] === 'base64') {\n base64 = true;\n }\n else {\n typeFull += `;${meta[i]}`;\n if (meta[i].indexOf('charset=') === 0) {\n charset = meta[i].substring(8);\n }\n }\n }\n // defaults to US-ASCII only if type is not provided\n if (!meta[0] && !charset.length) {\n typeFull += ';charset=US-ASCII';\n charset = 'US-ASCII';\n }\n // get the encoded data portion and decode URI-encoded chars\n const encoding = base64 ? 'base64' : 'ascii';\n const data = unescape(uri.substring(firstComma + 1));\n const buffer = Buffer.from(data, encoding);\n // set `.type` and `.typeFull` properties to MIME type\n buffer.type = type;\n buffer.typeFull = typeFull;\n // set the `.charset` property\n buffer.charset = charset;\n return buffer;\n}\nexport default dataUriToBuffer;\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":"AAOO,SAAS,gBAAgB,KAAK;AACjC,MAAI,CAAC,UAAU,KAAK,GAAG,GAAG;AACtB,UAAM,IAAI,UAAU,kEAAkE;AAAA,EACzF;AAED,QAAM,IAAI,QAAQ,UAAU,EAAE;AAE9B,QAAM,aAAa,IAAI,QAAQ,GAAG;AAClC,MAAI,eAAe,MAAM,cAAc,GAAG;AACtC,UAAM,IAAI,UAAU,qBAAqB;AAAA,EAC5C;AAED,QAAM,OAAO,IAAI,UAAU,GAAG,UAAU,EAAE,MAAM,GAAG;AACnD,MAAI,UAAU;AACd,MAAI,SAAS;AACb,QAAM,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../node_modules/data-uri-to-buffer/dist/index.js"],"sourcesContent":["/**\n * Returns a `Buffer` instance from the given data URI `uri`.\n *\n * @param {String} uri Data URI to turn into a Buffer instance\n * @returns {Buffer} Buffer instance from Data URI\n * @api public\n */\nexport function dataUriToBuffer(uri) {\n if (!/^data:/i.test(uri)) {\n throw new TypeError('`uri` does not appear to be a Data URI (must begin with \"data:\")');\n }\n // strip newlines\n uri = uri.replace(/\\r?\\n/g, '');\n // split the URI up into the \"metadata\" and the \"data\" portions\n const firstComma = uri.indexOf(',');\n if (firstComma === -1 || firstComma <= 4) {\n throw new TypeError('malformed data: URI');\n }\n // remove the \"data:\" scheme and parse the metadata\n const meta = uri.substring(5, firstComma).split(';');\n let charset = '';\n let base64 = false;\n const type = meta[0] || 'text/plain';\n let typeFull = type;\n for (let i = 1; i < meta.length; i++) {\n if (meta[i] === 'base64') {\n base64 = true;\n }\n else {\n typeFull += `;${meta[i]}`;\n if (meta[i].indexOf('charset=') === 0) {\n charset = meta[i].substring(8);\n }\n }\n }\n // defaults to US-ASCII only if type is not provided\n if (!meta[0] && !charset.length) {\n typeFull += ';charset=US-ASCII';\n charset = 'US-ASCII';\n }\n // get the encoded data portion and decode URI-encoded chars\n const encoding = base64 ? 'base64' : 'ascii';\n const data = unescape(uri.substring(firstComma + 1));\n const buffer = Buffer.from(data, encoding);\n // set `.type` and `.typeFull` properties to MIME type\n buffer.type = type;\n buffer.typeFull = typeFull;\n // set the `.charset` property\n buffer.charset = charset;\n return buffer;\n}\nexport default dataUriToBuffer;\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":"AAOO,SAAS,gBAAgB,KAAK;AACjC,MAAI,CAAC,UAAU,KAAK,GAAG,GAAG;AACtB,UAAM,IAAI,UAAU,kEAAkE;AAAA,EACzF;AAED,QAAM,IAAI,QAAQ,UAAU,EAAE;AAE9B,QAAM,aAAa,IAAI,QAAQ,GAAG;AAClC,MAAI,eAAe,MAAM,cAAc,GAAG;AACtC,UAAM,IAAI,UAAU,qBAAqB;AAAA,EAC5C;AAED,QAAM,OAAO,IAAI,UAAU,GAAG,UAAU,EAAE,MAAM,GAAG;AACnD,MAAI,UAAU;AACd,MAAI,SAAS;AACb,QAAM,OAAO,KAAK,CAAC,KAAK;AACxB,MAAI,WAAW;AACf,WAAS,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;AAClC,QAAI,KAAK,CAAC,MAAM,UAAU;AACtB,eAAS;AAAA,IACZ,OACI;AACD,kBAAY,IAAI,KAAK,CAAC;AACtB,UAAI,KAAK,CAAC,EAAE,QAAQ,UAAU,MAAM,GAAG;AACnC,kBAAU,KAAK,CAAC,EAAE,UAAU,CAAC;AAAA,MAChC;AAAA,IACJ;AAAA,EACJ;AAED,MAAI,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,QAAQ;AAC7B,gBAAY;AACZ,cAAU;AAAA,EACb;AAED,QAAM,WAAW,SAAS,WAAW;AACrC,QAAM,OAAO,SAAS,IAAI,UAAU,aAAa,CAAC,CAAC;AACnD,QAAM,SAAS,OAAO,KAAK,MAAM,QAAQ;AAEzC,SAAO,OAAO;AACd,SAAO,WAAW;AAElB,SAAO,UAAU;AACjB,SAAO;AACX;"}
|
|
@@ -21,6 +21,12 @@ var _lastModified, _name, _a;
|
|
|
21
21
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
22
22
|
const index = require("./index.cjs");
|
|
23
23
|
const _File = (_a = class extends index.default {
|
|
24
|
+
/**
|
|
25
|
+
* @param {*[]} fileBits
|
|
26
|
+
* @param {string} fileName
|
|
27
|
+
* @param {{lastModified?: number, type?: string}} options
|
|
28
|
+
*/
|
|
29
|
+
// @ts-ignore
|
|
24
30
|
constructor(fileBits, fileName, options = {}) {
|
|
25
31
|
if (arguments.length < 2) {
|
|
26
32
|
throw new TypeError(`Failed to construct 'File': 2 arguments required, but only ${arguments.length} present.`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file.cjs","sources":["../../../node_modules/fetch-blob/file.js"],"sourcesContent":["import Blob from './index.js'\n\nconst _File = class File extends Blob {\n #lastModified = 0\n #name = ''\n\n /**\n * @param {*[]} fileBits\n * @param {string} fileName\n * @param {{lastModified?: number, type?: string}} options\n */// @ts-ignore\n constructor (fileBits, fileName, options = {}) {\n if (arguments.length < 2) {\n throw new TypeError(`Failed to construct 'File': 2 arguments required, but only ${arguments.length} present.`)\n }\n super(fileBits, options)\n\n if (options === null) options = {}\n\n // Simulate WebIDL type casting for NaN value in lastModified option.\n const lastModified = options.lastModified === undefined ? Date.now() : Number(options.lastModified)\n if (!Number.isNaN(lastModified)) {\n this.#lastModified = lastModified\n }\n\n this.#name = String(fileName)\n }\n\n get name () {\n return this.#name\n }\n\n get lastModified () {\n return this.#lastModified\n }\n\n get [Symbol.toStringTag] () {\n return 'File'\n }\n\n static [Symbol.hasInstance] (object) {\n return !!object && object instanceof Blob &&\n /^(File)$/.test(object[Symbol.toStringTag])\n }\n}\n\n/** @type {typeof globalThis.File} */// @ts-ignore\nexport const File = _File\nexport default File\n"],"names":["Blob"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAEA,MAAM,SAAQ,mBAAmBA,cAAK;AAAA,EASpC,YAAa,UAAU,UAAU,UAAU,CAAA,GAAI;AAC7C,QAAI,UAAU,SAAS,GAAG;AACxB,YAAM,IAAI,UAAU,8DAA8D,UAAU,iBAAiB;AAAA,IAC9G;AACD,UAAM,UAAU,OAAO;AAZzB,sCAAgB;AAChB,8BAAQ;AAaN,QAAI,YAAY;AAAM,gBAAU,CAAE;AAGlC,UAAM,eAAe,QAAQ,iBAAiB,SAAY,KAAK,QAAQ,OAAO,QAAQ,YAAY;AAClG,QAAI,CAAC,OAAO,MAAM,YAAY,GAAG;AAC/B,yBAAK,eAAgB;AAAA,IACtB;AAED,uBAAK,OAAQ,OAAO,QAAQ;AAAA,EAC7B;AAAA,EAED,IAAI,OAAQ;AACV,WAAO,mBAAK;AAAA,EACb;AAAA,EAED,IAAI,eAAgB;AAClB,WAAO,mBAAK;AAAA,EACb;AAAA,EAED,KAAK,OAAO,
|
|
1
|
+
{"version":3,"file":"file.cjs","sources":["../../../node_modules/fetch-blob/file.js"],"sourcesContent":["import Blob from './index.js'\n\nconst _File = class File extends Blob {\n #lastModified = 0\n #name = ''\n\n /**\n * @param {*[]} fileBits\n * @param {string} fileName\n * @param {{lastModified?: number, type?: string}} options\n */// @ts-ignore\n constructor (fileBits, fileName, options = {}) {\n if (arguments.length < 2) {\n throw new TypeError(`Failed to construct 'File': 2 arguments required, but only ${arguments.length} present.`)\n }\n super(fileBits, options)\n\n if (options === null) options = {}\n\n // Simulate WebIDL type casting for NaN value in lastModified option.\n const lastModified = options.lastModified === undefined ? Date.now() : Number(options.lastModified)\n if (!Number.isNaN(lastModified)) {\n this.#lastModified = lastModified\n }\n\n this.#name = String(fileName)\n }\n\n get name () {\n return this.#name\n }\n\n get lastModified () {\n return this.#lastModified\n }\n\n get [Symbol.toStringTag] () {\n return 'File'\n }\n\n static [Symbol.hasInstance] (object) {\n return !!object && object instanceof Blob &&\n /^(File)$/.test(object[Symbol.toStringTag])\n }\n}\n\n/** @type {typeof globalThis.File} */// @ts-ignore\nexport const File = _File\nexport default File\n"],"names":["Blob"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAEA,MAAM,SAAQ,mBAAmBA,cAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASpC,YAAa,UAAU,UAAU,UAAU,CAAA,GAAI;AAC7C,QAAI,UAAU,SAAS,GAAG;AACxB,YAAM,IAAI,UAAU,8DAA8D,UAAU,iBAAiB;AAAA,IAC9G;AACD,UAAM,UAAU,OAAO;AAZzB,sCAAgB;AAChB,8BAAQ;AAaN,QAAI,YAAY;AAAM,gBAAU,CAAE;AAGlC,UAAM,eAAe,QAAQ,iBAAiB,SAAY,KAAK,QAAQ,OAAO,QAAQ,YAAY;AAClG,QAAI,CAAC,OAAO,MAAM,YAAY,GAAG;AAC/B,yBAAK,eAAgB;AAAA,IACtB;AAED,uBAAK,OAAQ,OAAO,QAAQ;AAAA,EAC7B;AAAA,EAED,IAAI,OAAQ;AACV,WAAO,mBAAK;AAAA,EACb;AAAA,EAED,IAAI,eAAgB;AAClB,WAAO,mBAAK;AAAA,EACb;AAAA,EAED,KAAK,OAAO,WAAW,IAAK;AAC1B,WAAO;AAAA,EACR;AAAA,EAED,QAAQ,OAAO,WAAW,EAAG,QAAQ;AACnC,WAAO,CAAC,CAAC,UAAU,kBAAkBA,MAAI,WACvC,WAAW,KAAK,OAAO,OAAO,WAAW,CAAC;AAAA,EAC7C;AACH,GAzCE,+BACA,uBAFY;AA6CF,MAAC,OAAO;;;"}
|
|
@@ -19,6 +19,12 @@ var __privateSet = (obj, member, value, setter) => {
|
|
|
19
19
|
var _lastModified, _name, _a;
|
|
20
20
|
import Blob from "./index.js";
|
|
21
21
|
const _File = (_a = class extends Blob {
|
|
22
|
+
/**
|
|
23
|
+
* @param {*[]} fileBits
|
|
24
|
+
* @param {string} fileName
|
|
25
|
+
* @param {{lastModified?: number, type?: string}} options
|
|
26
|
+
*/
|
|
27
|
+
// @ts-ignore
|
|
22
28
|
constructor(fileBits, fileName, options = {}) {
|
|
23
29
|
if (arguments.length < 2) {
|
|
24
30
|
throw new TypeError(`Failed to construct 'File': 2 arguments required, but only ${arguments.length} present.`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file.js","sources":["../../../node_modules/fetch-blob/file.js"],"sourcesContent":["import Blob from './index.js'\n\nconst _File = class File extends Blob {\n #lastModified = 0\n #name = ''\n\n /**\n * @param {*[]} fileBits\n * @param {string} fileName\n * @param {{lastModified?: number, type?: string}} options\n */// @ts-ignore\n constructor (fileBits, fileName, options = {}) {\n if (arguments.length < 2) {\n throw new TypeError(`Failed to construct 'File': 2 arguments required, but only ${arguments.length} present.`)\n }\n super(fileBits, options)\n\n if (options === null) options = {}\n\n // Simulate WebIDL type casting for NaN value in lastModified option.\n const lastModified = options.lastModified === undefined ? Date.now() : Number(options.lastModified)\n if (!Number.isNaN(lastModified)) {\n this.#lastModified = lastModified\n }\n\n this.#name = String(fileName)\n }\n\n get name () {\n return this.#name\n }\n\n get lastModified () {\n return this.#lastModified\n }\n\n get [Symbol.toStringTag] () {\n return 'File'\n }\n\n static [Symbol.hasInstance] (object) {\n return !!object && object instanceof Blob &&\n /^(File)$/.test(object[Symbol.toStringTag])\n }\n}\n\n/** @type {typeof globalThis.File} */// @ts-ignore\nexport const File = _File\nexport default File\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAEA,MAAM,SAAQ,mBAAmB,KAAK;AAAA,EASpC,YAAa,UAAU,UAAU,UAAU,CAAA,GAAI;AAC7C,QAAI,UAAU,SAAS,GAAG;AACxB,YAAM,IAAI,UAAU,8DAA8D,UAAU,iBAAiB;AAAA,IAC9G;AACD,UAAM,UAAU,OAAO;AAZzB,sCAAgB;AAChB,8BAAQ;AAaN,QAAI,YAAY;AAAM,gBAAU,CAAE;AAGlC,UAAM,eAAe,QAAQ,iBAAiB,SAAY,KAAK,QAAQ,OAAO,QAAQ,YAAY;AAClG,QAAI,CAAC,OAAO,MAAM,YAAY,GAAG;AAC/B,yBAAK,eAAgB;AAAA,IACtB;AAED,uBAAK,OAAQ,OAAO,QAAQ;AAAA,EAC7B;AAAA,EAED,IAAI,OAAQ;AACV,WAAO,mBAAK;AAAA,EACb;AAAA,EAED,IAAI,eAAgB;AAClB,WAAO,mBAAK;AAAA,EACb;AAAA,EAED,KAAK,OAAO,
|
|
1
|
+
{"version":3,"file":"file.js","sources":["../../../node_modules/fetch-blob/file.js"],"sourcesContent":["import Blob from './index.js'\n\nconst _File = class File extends Blob {\n #lastModified = 0\n #name = ''\n\n /**\n * @param {*[]} fileBits\n * @param {string} fileName\n * @param {{lastModified?: number, type?: string}} options\n */// @ts-ignore\n constructor (fileBits, fileName, options = {}) {\n if (arguments.length < 2) {\n throw new TypeError(`Failed to construct 'File': 2 arguments required, but only ${arguments.length} present.`)\n }\n super(fileBits, options)\n\n if (options === null) options = {}\n\n // Simulate WebIDL type casting for NaN value in lastModified option.\n const lastModified = options.lastModified === undefined ? Date.now() : Number(options.lastModified)\n if (!Number.isNaN(lastModified)) {\n this.#lastModified = lastModified\n }\n\n this.#name = String(fileName)\n }\n\n get name () {\n return this.#name\n }\n\n get lastModified () {\n return this.#lastModified\n }\n\n get [Symbol.toStringTag] () {\n return 'File'\n }\n\n static [Symbol.hasInstance] (object) {\n return !!object && object instanceof Blob &&\n /^(File)$/.test(object[Symbol.toStringTag])\n }\n}\n\n/** @type {typeof globalThis.File} */// @ts-ignore\nexport const File = _File\nexport default File\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAEA,MAAM,SAAQ,mBAAmB,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASpC,YAAa,UAAU,UAAU,UAAU,CAAA,GAAI;AAC7C,QAAI,UAAU,SAAS,GAAG;AACxB,YAAM,IAAI,UAAU,8DAA8D,UAAU,iBAAiB;AAAA,IAC9G;AACD,UAAM,UAAU,OAAO;AAZzB,sCAAgB;AAChB,8BAAQ;AAaN,QAAI,YAAY;AAAM,gBAAU,CAAE;AAGlC,UAAM,eAAe,QAAQ,iBAAiB,SAAY,KAAK,QAAQ,OAAO,QAAQ,YAAY;AAClG,QAAI,CAAC,OAAO,MAAM,YAAY,GAAG;AAC/B,yBAAK,eAAgB;AAAA,IACtB;AAED,uBAAK,OAAQ,OAAO,QAAQ;AAAA,EAC7B;AAAA,EAED,IAAI,OAAQ;AACV,WAAO,mBAAK;AAAA,EACb;AAAA,EAED,IAAI,eAAgB;AAClB,WAAO,mBAAK;AAAA,EACb;AAAA,EAED,KAAK,OAAO,WAAW,IAAK;AAC1B,WAAO;AAAA,EACR;AAAA,EAED,QAAQ,OAAO,WAAW,EAAG,QAAQ;AACnC,WAAO,CAAC,CAAC,UAAU,kBAAkB,QACnC,WAAW,KAAK,OAAO,OAAO,WAAW,CAAC;AAAA,EAC7C;AACH,GAzCE,+BACA,uBAFY;AA6CF,MAAC,OAAO;"}
|
|
@@ -25,7 +25,10 @@ const POOL_SIZE = 65536;
|
|
|
25
25
|
async function* toIterator(parts, clone = true) {
|
|
26
26
|
for (const part of parts) {
|
|
27
27
|
if ("stream" in part) {
|
|
28
|
-
yield*
|
|
28
|
+
yield* (
|
|
29
|
+
/** @type {AsyncIterableIterator<Uint8Array>} */
|
|
30
|
+
part.stream()
|
|
31
|
+
);
|
|
29
32
|
} else if (ArrayBuffer.isView(part)) {
|
|
30
33
|
if (clone) {
|
|
31
34
|
let position = part.byteOffset;
|
|
@@ -40,7 +43,10 @@ async function* toIterator(parts, clone = true) {
|
|
|
40
43
|
yield part;
|
|
41
44
|
}
|
|
42
45
|
} else {
|
|
43
|
-
let position = 0, b =
|
|
46
|
+
let position = 0, b = (
|
|
47
|
+
/** @type {Blob} */
|
|
48
|
+
part
|
|
49
|
+
);
|
|
44
50
|
while (position !== b.size) {
|
|
45
51
|
const chunk = b.slice(position, Math.min(b.size, position + POOL_SIZE));
|
|
46
52
|
const buffer = await chunk.arrayBuffer();
|
|
@@ -51,7 +57,16 @@ async function* toIterator(parts, clone = true) {
|
|
|
51
57
|
}
|
|
52
58
|
}
|
|
53
59
|
const _Blob = (_a = class {
|
|
60
|
+
/**
|
|
61
|
+
* The Blob() constructor returns a new Blob object. The content
|
|
62
|
+
* of the blob consists of the concatenation of the values given
|
|
63
|
+
* in the parameter array.
|
|
64
|
+
*
|
|
65
|
+
* @param {*} blobParts
|
|
66
|
+
* @param {{ type?: string, endings?: string }} [options]
|
|
67
|
+
*/
|
|
54
68
|
constructor(blobParts = [], options = {}) {
|
|
69
|
+
/** @type {Array.<(Blob|Uint8Array)>} */
|
|
55
70
|
__privateAdd(this, _parts, []);
|
|
56
71
|
__privateAdd(this, _type, "");
|
|
57
72
|
__privateAdd(this, _size, 0);
|
|
@@ -86,12 +101,26 @@ const _Blob = (_a = class {
|
|
|
86
101
|
const type = options.type === void 0 ? "" : String(options.type);
|
|
87
102
|
__privateSet(this, _type, /^[\x20-\x7E]*$/.test(type) ? type : "");
|
|
88
103
|
}
|
|
104
|
+
/**
|
|
105
|
+
* The Blob interface's size property returns the
|
|
106
|
+
* size of the Blob in bytes.
|
|
107
|
+
*/
|
|
89
108
|
get size() {
|
|
90
109
|
return __privateGet(this, _size);
|
|
91
110
|
}
|
|
111
|
+
/**
|
|
112
|
+
* The type property of a Blob object returns the MIME type of the file.
|
|
113
|
+
*/
|
|
92
114
|
get type() {
|
|
93
115
|
return __privateGet(this, _type);
|
|
94
116
|
}
|
|
117
|
+
/**
|
|
118
|
+
* The text() method in the Blob interface returns a Promise
|
|
119
|
+
* that resolves with a string containing the contents of
|
|
120
|
+
* the blob, interpreted as UTF-8.
|
|
121
|
+
*
|
|
122
|
+
* @return {Promise<string>}
|
|
123
|
+
*/
|
|
95
124
|
async text() {
|
|
96
125
|
const decoder = new TextDecoder();
|
|
97
126
|
let str = "";
|
|
@@ -101,6 +130,13 @@ const _Blob = (_a = class {
|
|
|
101
130
|
str += decoder.decode();
|
|
102
131
|
return str;
|
|
103
132
|
}
|
|
133
|
+
/**
|
|
134
|
+
* The arrayBuffer() method in the Blob interface returns a
|
|
135
|
+
* Promise that resolves with the contents of the blob as
|
|
136
|
+
* binary data contained in an ArrayBuffer.
|
|
137
|
+
*
|
|
138
|
+
* @return {Promise<ArrayBuffer>}
|
|
139
|
+
*/
|
|
104
140
|
async arrayBuffer() {
|
|
105
141
|
const data = new Uint8Array(this.size);
|
|
106
142
|
let offset = 0;
|
|
@@ -113,6 +149,7 @@ const _Blob = (_a = class {
|
|
|
113
149
|
stream() {
|
|
114
150
|
const it = toIterator(__privateGet(this, _parts), true);
|
|
115
151
|
return new globalThis.ReadableStream({
|
|
152
|
+
// @ts-ignore
|
|
116
153
|
type: "bytes",
|
|
117
154
|
async pull(ctrl) {
|
|
118
155
|
const chunk = await it.next();
|
|
@@ -123,6 +160,15 @@ const _Blob = (_a = class {
|
|
|
123
160
|
}
|
|
124
161
|
});
|
|
125
162
|
}
|
|
163
|
+
/**
|
|
164
|
+
* The Blob interface's slice() method creates and returns a
|
|
165
|
+
* new Blob object which contains data from a subset of the
|
|
166
|
+
* blob on which it's called.
|
|
167
|
+
*
|
|
168
|
+
* @param {number} [start]
|
|
169
|
+
* @param {number} [end]
|
|
170
|
+
* @param {string} [type]
|
|
171
|
+
*/
|
|
126
172
|
slice(start = 0, end = this.size, type = "") {
|
|
127
173
|
const { size } = this;
|
|
128
174
|
let relativeStart = start < 0 ? Math.max(size + start, 0) : Math.min(start, size);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../node_modules/fetch-blob/index.js"],"sourcesContent":["/*! fetch-blob. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */\n\n// TODO (jimmywarting): in the feature use conditional loading with top level await (requires 14.x)\n// Node has recently added whatwg stream into core\n\nimport './streams.cjs'\n\n// 64 KiB (same size chrome slice theirs blob into Uint8array's)\nconst POOL_SIZE = 65536\n\n/** @param {(Blob | Uint8Array)[]} parts */\nasync function * toIterator (parts, clone = true) {\n for (const part of parts) {\n if ('stream' in part) {\n yield * (/** @type {AsyncIterableIterator<Uint8Array>} */ (part.stream()))\n } else if (ArrayBuffer.isView(part)) {\n if (clone) {\n let position = part.byteOffset\n const end = part.byteOffset + part.byteLength\n while (position !== end) {\n const size = Math.min(end - position, POOL_SIZE)\n const chunk = part.buffer.slice(position, position + size)\n position += chunk.byteLength\n yield new Uint8Array(chunk)\n }\n } else {\n yield part\n }\n /* c8 ignore next 10 */\n } else {\n // For blobs that have arrayBuffer but no stream method (nodes buffer.Blob)\n let position = 0, b = (/** @type {Blob} */ (part))\n while (position !== b.size) {\n const chunk = b.slice(position, Math.min(b.size, position + POOL_SIZE))\n const buffer = await chunk.arrayBuffer()\n position += buffer.byteLength\n yield new Uint8Array(buffer)\n }\n }\n }\n}\n\nconst _Blob = class Blob {\n /** @type {Array.<(Blob|Uint8Array)>} */\n #parts = []\n #type = ''\n #size = 0\n #endings = 'transparent'\n\n /**\n * The Blob() constructor returns a new Blob object. The content\n * of the blob consists of the concatenation of the values given\n * in the parameter array.\n *\n * @param {*} blobParts\n * @param {{ type?: string, endings?: string }} [options]\n */\n constructor (blobParts = [], options = {}) {\n if (typeof blobParts !== 'object' || blobParts === null) {\n throw new TypeError('Failed to construct \\'Blob\\': The provided value cannot be converted to a sequence.')\n }\n\n if (typeof blobParts[Symbol.iterator] !== 'function') {\n throw new TypeError('Failed to construct \\'Blob\\': The object must have a callable @@iterator property.')\n }\n\n if (typeof options !== 'object' && typeof options !== 'function') {\n throw new TypeError('Failed to construct \\'Blob\\': parameter 2 cannot convert to dictionary.')\n }\n\n if (options === null) options = {}\n\n const encoder = new TextEncoder()\n for (const element of blobParts) {\n let part\n if (ArrayBuffer.isView(element)) {\n part = new Uint8Array(element.buffer.slice(element.byteOffset, element.byteOffset + element.byteLength))\n } else if (element instanceof ArrayBuffer) {\n part = new Uint8Array(element.slice(0))\n } else if (element instanceof Blob) {\n part = element\n } else {\n part = encoder.encode(`${element}`)\n }\n\n this.#size += ArrayBuffer.isView(part) ? part.byteLength : part.size\n this.#parts.push(part)\n }\n\n this.#endings = `${options.endings === undefined ? 'transparent' : options.endings}`\n const type = options.type === undefined ? '' : String(options.type)\n this.#type = /^[\\x20-\\x7E]*$/.test(type) ? type : ''\n }\n\n /**\n * The Blob interface's size property returns the\n * size of the Blob in bytes.\n */\n get size () {\n return this.#size\n }\n\n /**\n * The type property of a Blob object returns the MIME type of the file.\n */\n get type () {\n return this.#type\n }\n\n /**\n * The text() method in the Blob interface returns a Promise\n * that resolves with a string containing the contents of\n * the blob, interpreted as UTF-8.\n *\n * @return {Promise<string>}\n */\n async text () {\n // More optimized than using this.arrayBuffer()\n // that requires twice as much ram\n const decoder = new TextDecoder()\n let str = ''\n for await (const part of toIterator(this.#parts, false)) {\n str += decoder.decode(part, { stream: true })\n }\n // Remaining\n str += decoder.decode()\n return str\n }\n\n /**\n * The arrayBuffer() method in the Blob interface returns a\n * Promise that resolves with the contents of the blob as\n * binary data contained in an ArrayBuffer.\n *\n * @return {Promise<ArrayBuffer>}\n */\n async arrayBuffer () {\n // Easier way... Just a unnecessary overhead\n // const view = new Uint8Array(this.size);\n // await this.stream().getReader({mode: 'byob'}).read(view);\n // return view.buffer;\n\n const data = new Uint8Array(this.size)\n let offset = 0\n for await (const chunk of toIterator(this.#parts, false)) {\n data.set(chunk, offset)\n offset += chunk.length\n }\n\n return data.buffer\n }\n\n stream () {\n const it = toIterator(this.#parts, true)\n\n return new globalThis.ReadableStream({\n // @ts-ignore\n type: 'bytes',\n async pull (ctrl) {\n const chunk = await it.next()\n chunk.done ? ctrl.close() : ctrl.enqueue(chunk.value)\n },\n\n async cancel () {\n await it.return()\n }\n })\n }\n\n /**\n * The Blob interface's slice() method creates and returns a\n * new Blob object which contains data from a subset of the\n * blob on which it's called.\n *\n * @param {number} [start]\n * @param {number} [end]\n * @param {string} [type]\n */\n slice (start = 0, end = this.size, type = '') {\n const { size } = this\n\n let relativeStart = start < 0 ? Math.max(size + start, 0) : Math.min(start, size)\n let relativeEnd = end < 0 ? Math.max(size + end, 0) : Math.min(end, size)\n\n const span = Math.max(relativeEnd - relativeStart, 0)\n const parts = this.#parts\n const blobParts = []\n let added = 0\n\n for (const part of parts) {\n // don't add the overflow to new blobParts\n if (added >= span) {\n break\n }\n\n const size = ArrayBuffer.isView(part) ? part.byteLength : part.size\n if (relativeStart && size <= relativeStart) {\n // Skip the beginning and change the relative\n // start & end position as we skip the unwanted parts\n relativeStart -= size\n relativeEnd -= size\n } else {\n let chunk\n if (ArrayBuffer.isView(part)) {\n chunk = part.subarray(relativeStart, Math.min(size, relativeEnd))\n added += chunk.byteLength\n } else {\n chunk = part.slice(relativeStart, Math.min(size, relativeEnd))\n added += chunk.size\n }\n relativeEnd -= size\n blobParts.push(chunk)\n relativeStart = 0 // All next sequential parts should start at 0\n }\n }\n\n const blob = new Blob([], { type: String(type).toLowerCase() })\n blob.#size = span\n blob.#parts = blobParts\n\n return blob\n }\n\n get [Symbol.toStringTag] () {\n return 'Blob'\n }\n\n static [Symbol.hasInstance] (object) {\n return (\n object &&\n typeof object === 'object' &&\n typeof object.constructor === 'function' &&\n (\n typeof object.stream === 'function' ||\n typeof object.arrayBuffer === 'function'\n ) &&\n /^(Blob|File)$/.test(object[Symbol.toStringTag])\n )\n }\n}\n\nObject.defineProperties(_Blob.prototype, {\n size: { enumerable: true },\n type: { enumerable: true },\n slice: { enumerable: true }\n})\n\n/** @type {typeof globalThis.Blob} */\nexport const Blob = _Blob\nexport default Blob\n"],"names":["size"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;AAQA,MAAM,YAAY;AAGlB,gBAAiB,WAAY,OAAO,QAAQ,MAAM;AAChD,aAAW,QAAQ,OAAO;AACxB,QAAI,YAAY,MAAM;AACpB,aAA2D,KAAK;IACjE,WAAU,YAAY,OAAO,IAAI,GAAG;AACnC,UAAI,OAAO;AACT,YAAI,WAAW,KAAK;AACpB,cAAM,MAAM,KAAK,aAAa,KAAK;AACnC,eAAO,aAAa,KAAK;AACvB,gBAAM,OAAO,KAAK,IAAI,MAAM,UAAU,SAAS;AAC/C,gBAAM,QAAQ,KAAK,OAAO,MAAM,UAAU,WAAW,IAAI;AACzD,sBAAY,MAAM;AAClB,gBAAM,IAAI,WAAW,KAAK;AAAA,QAC3B;AAAA,MACT,OAAa;AACL,cAAM;AAAA,MACP;AAAA,IAEP,OAAW;AAEL,UAAI,WAAW,GAAG,IAA0B;AAC5C,aAAO,aAAa,EAAE,MAAM;AAC1B,cAAM,QAAQ,EAAE,MAAM,UAAU,KAAK,IAAI,EAAE,MAAM,WAAW,SAAS,CAAC;AACtE,cAAM,SAAS,MAAM,MAAM,YAAa;AACxC,oBAAY,OAAO;AACnB,cAAM,IAAI,WAAW,MAAM;AAAA,MAC5B;AAAA,IACF;AAAA,EACF;AACH;AAEA,MAAM,SAAQ,WAAW;AAAA,EAevB,YAAa,YAAY,IAAI,UAAU,CAAA,GAAI;AAb3C,+BAAS,CAAE;AACX,8BAAQ;AACR,8BAAQ;AACR,iCAAW;AAWT,QAAI,OAAO,cAAc,YAAY,cAAc,MAAM;AACvD,YAAM,IAAI,UAAU,mFAAqF;AAAA,IAC1G;AAED,QAAI,OAAO,UAAU,OAAO,cAAc,YAAY;AACpD,YAAM,IAA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OAAM,WAAW,CAAC;AAChE,mBAAS,MAAM;AAAA,QACzB,OAAe;AACL,kBAAQ,KAAK,MAAM,eAAe,KAAK,IAAIA,OAAM,WAAW,CAAC;AAC7D,mBAAS,MAAM;AAAA,QAChB;AACD,uBAAeA;AACf,kBAAU,KAAK,KAAK;AACpB,wBAAgB;AAAA,MACjB;AAAA,IACF;AAED,UAAM,OAAO,IAAI,GAAK,IAAI,EAAE,MAAM,OAAO,IAAI,EAAE,YAAW,GAAI;AAC9D,uBAAK,OAAQ;AACb,uBAAK,QAAS;AAEd,WAAO;AAAA,EACR;AAAA,EAED,KAAK,OAAO,eAAgB;AAC1B,WAAO;AAAA,EACR;AAAA,EAED,QAAQ,OAAO,aAAc,QAAQ;AACnC,WACE,UACA,OAAO,WAAW,YAClB,OAAO,OAAO,gBAAgB,eAE5B,OAAO,OAAO,WAAW,cACzB,OAAO,OAAO,gBAAgB,eAEhC,gBAAgB,KAAK,OAAO,OAAO,YAAY;AAAA,EAElD;AACH,GAnME,wBACA,uBACA,uBACA,0BALY;AAuMd,OAAO,iBAAiB,MAAM,WAAW;AAAA,EACvC,MAAM,EAAE,YAAY,KAAM;AAAA,EAC1B,MAAM,EAAE,YAAY,KAAM;AAAA,EAC1B,OAAO,EAAE,YAAY,KAAM;AAC7B,CAAC;AAGW,MAAC,OAAO;AACpB,MAAe,SAAA;;;"}
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../node_modules/fetch-blob/index.js"],"sourcesContent":["/*! fetch-blob. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */\n\n// TODO (jimmywarting): in the feature use conditional loading with top level await (requires 14.x)\n// Node has recently added whatwg stream into core\n\nimport './streams.cjs'\n\n// 64 KiB (same size chrome slice theirs blob into Uint8array's)\nconst POOL_SIZE = 65536\n\n/** @param {(Blob | Uint8Array)[]} parts */\nasync function * toIterator (parts, clone = true) {\n for (const part of parts) {\n if ('stream' in part) {\n yield * (/** @type {AsyncIterableIterator<Uint8Array>} */ (part.stream()))\n } else if (ArrayBuffer.isView(part)) {\n if (clone) {\n let position = part.byteOffset\n const end = part.byteOffset + part.byteLength\n while (position !== end) {\n const size = Math.min(end - position, POOL_SIZE)\n const chunk = part.buffer.slice(position, position + size)\n position += chunk.byteLength\n yield new Uint8Array(chunk)\n }\n } else {\n yield part\n }\n /* c8 ignore next 10 */\n } else {\n // For blobs that have arrayBuffer but no stream method (nodes buffer.Blob)\n let position = 0, b = (/** @type {Blob} */ (part))\n while (position !== b.size) {\n const chunk = b.slice(position, Math.min(b.size, position + POOL_SIZE))\n const buffer = await chunk.arrayBuffer()\n position += buffer.byteLength\n yield new Uint8Array(buffer)\n }\n }\n }\n}\n\nconst _Blob = class Blob {\n /** @type {Array.<(Blob|Uint8Array)>} */\n #parts = []\n #type = ''\n #size = 0\n #endings = 'transparent'\n\n /**\n * The Blob() constructor returns a new Blob object. The content\n * of the blob consists of the concatenation of the values given\n * in the parameter array.\n *\n * @param {*} blobParts\n * @param {{ type?: string, endings?: string }} [options]\n */\n constructor (blobParts = [], options = {}) {\n if (typeof blobParts !== 'object' || blobParts === null) {\n throw new TypeError('Failed to construct \\'Blob\\': The provided value cannot be converted to a sequence.')\n }\n\n if (typeof blobParts[Symbol.iterator] !== 'function') {\n throw new TypeError('Failed to construct \\'Blob\\': The object must have a callable @@iterator property.')\n }\n\n if (typeof options !== 'object' && typeof options !== 'function') {\n throw new TypeError('Failed to construct \\'Blob\\': parameter 2 cannot convert to dictionary.')\n }\n\n if (options === null) options = {}\n\n const encoder = new TextEncoder()\n for (const element of blobParts) {\n let part\n if (ArrayBuffer.isView(element)) {\n part = new Uint8Array(element.buffer.slice(element.byteOffset, element.byteOffset + element.byteLength))\n } else if (element instanceof ArrayBuffer) {\n part = new Uint8Array(element.slice(0))\n } else if (element instanceof Blob) {\n part = element\n } else {\n part = encoder.encode(`${element}`)\n }\n\n this.#size += ArrayBuffer.isView(part) ? part.byteLength : part.size\n this.#parts.push(part)\n }\n\n this.#endings = `${options.endings === undefined ? 'transparent' : options.endings}`\n const type = options.type === undefined ? '' : String(options.type)\n this.#type = /^[\\x20-\\x7E]*$/.test(type) ? type : ''\n }\n\n /**\n * The Blob interface's size property returns the\n * size of the Blob in bytes.\n */\n get size () {\n return this.#size\n }\n\n /**\n * The type property of a Blob object returns the MIME type of the file.\n */\n get type () {\n return this.#type\n }\n\n /**\n * The text() method in the Blob interface returns a Promise\n * that resolves with a string containing the contents of\n * the blob, interpreted as UTF-8.\n *\n * @return {Promise<string>}\n */\n async text () {\n // More optimized than using this.arrayBuffer()\n // that requires twice as much ram\n const decoder = new TextDecoder()\n let str = ''\n for await (const part of toIterator(this.#parts, false)) {\n str += decoder.decode(part, { stream: true })\n }\n // Remaining\n str += decoder.decode()\n return str\n }\n\n /**\n * The arrayBuffer() method in the Blob interface returns a\n * Promise that resolves with the contents of the blob as\n * binary data contained in an ArrayBuffer.\n *\n * @return {Promise<ArrayBuffer>}\n */\n async arrayBuffer () {\n // Easier way... Just a unnecessary overhead\n // const view = new Uint8Array(this.size);\n // await this.stream().getReader({mode: 'byob'}).read(view);\n // return view.buffer;\n\n const data = new Uint8Array(this.size)\n let offset = 0\n for await (const chunk of toIterator(this.#parts, false)) {\n data.set(chunk, offset)\n offset += chunk.length\n }\n\n return data.buffer\n }\n\n stream () {\n const it = toIterator(this.#parts, true)\n\n return new globalThis.ReadableStream({\n // @ts-ignore\n type: 'bytes',\n async pull (ctrl) {\n const chunk = await it.next()\n chunk.done ? ctrl.close() : ctrl.enqueue(chunk.value)\n },\n\n async cancel () {\n await it.return()\n }\n })\n }\n\n /**\n * The Blob interface's slice() method creates and returns a\n * new Blob object which contains data from a subset of the\n * blob on which it's called.\n *\n * @param {number} [start]\n * @param {number} [end]\n * @param {string} [type]\n */\n slice (start = 0, end = this.size, type = '') {\n const { size } = this\n\n let relativeStart = start < 0 ? Math.max(size + start, 0) : Math.min(start, size)\n let relativeEnd = end < 0 ? Math.max(size + end, 0) : Math.min(end, size)\n\n const span = Math.max(relativeEnd - relativeStart, 0)\n const parts = this.#parts\n const blobParts = []\n let added = 0\n\n for (const part of parts) {\n // don't add the overflow to new blobParts\n if (added >= span) {\n break\n }\n\n const size = ArrayBuffer.isView(part) ? part.byteLength : part.size\n if (relativeStart && size <= relativeStart) {\n // Skip the beginning and change the relative\n // start & end position as we skip the unwanted parts\n relativeStart -= size\n relativeEnd -= size\n } else {\n let chunk\n if (ArrayBuffer.isView(part)) {\n chunk = part.subarray(relativeStart, Math.min(size, relativeEnd))\n added += chunk.byteLength\n } else {\n chunk = part.slice(relativeStart, Math.min(size, relativeEnd))\n added += chunk.size\n }\n relativeEnd -= size\n blobParts.push(chunk)\n relativeStart = 0 // All next sequential parts should start at 0\n }\n }\n\n const blob = new Blob([], { type: String(type).toLowerCase() })\n blob.#size = span\n blob.#parts = blobParts\n\n return blob\n }\n\n get [Symbol.toStringTag] () {\n return 'Blob'\n }\n\n static [Symbol.hasInstance] (object) {\n return (\n object &&\n typeof object === 'object' &&\n typeof object.constructor === 'function' &&\n (\n typeof object.stream === 'function' ||\n typeof object.arrayBuffer === 'function'\n ) &&\n /^(Blob|File)$/.test(object[Symbol.toStringTag])\n )\n }\n}\n\nObject.defineProperties(_Blob.prototype, {\n size: { enumerable: true },\n type: { enumerable: true },\n slice: { enumerable: true }\n})\n\n/** @type {typeof globalThis.Blob} */\nexport const Blob = _Blob\nexport default Blob\n"],"names":["size"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;AAQA,MAAM,YAAY;AAGlB,gBAAiB,WAAY,OAAO,QAAQ,MAAM;AAChD,aAAW,QAAQ,OAAO;AACxB,QAAI,YAAY,MAAM;AACpB;AAAA;AAAA,QAA2D,KAAK;;IACjE,WAAU,YAAY,OAAO,IAAI,GAAG;AACnC,UAAI,OAAO;AACT,YAAI,WAAW,KAAK;AACpB,cAAM,MAAM,KAAK,aAAa,KAAK;AACnC,eAAO,aAAa,KAAK;AACvB,gBAAM,OAAO,KAAK,IAAI,MAAM,UAAU,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AAO,IAAI,GAAK,IAAI,EAAE,MAAM,OAAO,IAAI,EAAE,YAAW,GAAI;AAC9D,uBAAK,OAAQ;AACb,uBAAK,QAAS;AAEd,WAAO;AAAA,EACR;AAAA,EAED,KAAK,OAAO,WAAW,IAAK;AAC1B,WAAO;AAAA,EACR;AAAA,EAED,QAAQ,OAAO,WAAW,EAAG,QAAQ;AACnC,WACE,UACA,OAAO,WAAW,YAClB,OAAO,OAAO,gBAAgB,eAE5B,OAAO,OAAO,WAAW,cACzB,OAAO,OAAO,gBAAgB,eAEhC,gBAAgB,KAAK,OAAO,OAAO,WAAW,CAAC;AAAA,EAElD;AACH,GAnME,wBACA,uBACA,uBACA,0BALY;AAuMd,OAAO,iBAAiB,MAAM,WAAW;AAAA,EACvC,MAAM,EAAE,YAAY,KAAM;AAAA,EAC1B,MAAM,EAAE,YAAY,KAAM;AAAA,EAC1B,OAAO,EAAE,YAAY,KAAM;AAC7B,CAAC;AAGW,MAAC,OAAO;AACpB,MAAe,SAAA;;;"}
|
|
@@ -23,7 +23,10 @@ const POOL_SIZE = 65536;
|
|
|
23
23
|
async function* toIterator(parts, clone = true) {
|
|
24
24
|
for (const part of parts) {
|
|
25
25
|
if ("stream" in part) {
|
|
26
|
-
yield*
|
|
26
|
+
yield* (
|
|
27
|
+
/** @type {AsyncIterableIterator<Uint8Array>} */
|
|
28
|
+
part.stream()
|
|
29
|
+
);
|
|
27
30
|
} else if (ArrayBuffer.isView(part)) {
|
|
28
31
|
if (clone) {
|
|
29
32
|
let position = part.byteOffset;
|
|
@@ -38,7 +41,10 @@ async function* toIterator(parts, clone = true) {
|
|
|
38
41
|
yield part;
|
|
39
42
|
}
|
|
40
43
|
} else {
|
|
41
|
-
let position = 0, b =
|
|
44
|
+
let position = 0, b = (
|
|
45
|
+
/** @type {Blob} */
|
|
46
|
+
part
|
|
47
|
+
);
|
|
42
48
|
while (position !== b.size) {
|
|
43
49
|
const chunk = b.slice(position, Math.min(b.size, position + POOL_SIZE));
|
|
44
50
|
const buffer = await chunk.arrayBuffer();
|
|
@@ -49,7 +55,16 @@ async function* toIterator(parts, clone = true) {
|
|
|
49
55
|
}
|
|
50
56
|
}
|
|
51
57
|
const _Blob = (_a = class {
|
|
58
|
+
/**
|
|
59
|
+
* The Blob() constructor returns a new Blob object. The content
|
|
60
|
+
* of the blob consists of the concatenation of the values given
|
|
61
|
+
* in the parameter array.
|
|
62
|
+
*
|
|
63
|
+
* @param {*} blobParts
|
|
64
|
+
* @param {{ type?: string, endings?: string }} [options]
|
|
65
|
+
*/
|
|
52
66
|
constructor(blobParts = [], options = {}) {
|
|
67
|
+
/** @type {Array.<(Blob|Uint8Array)>} */
|
|
53
68
|
__privateAdd(this, _parts, []);
|
|
54
69
|
__privateAdd(this, _type, "");
|
|
55
70
|
__privateAdd(this, _size, 0);
|
|
@@ -84,12 +99,26 @@ const _Blob = (_a = class {
|
|
|
84
99
|
const type = options.type === void 0 ? "" : String(options.type);
|
|
85
100
|
__privateSet(this, _type, /^[\x20-\x7E]*$/.test(type) ? type : "");
|
|
86
101
|
}
|
|
102
|
+
/**
|
|
103
|
+
* The Blob interface's size property returns the
|
|
104
|
+
* size of the Blob in bytes.
|
|
105
|
+
*/
|
|
87
106
|
get size() {
|
|
88
107
|
return __privateGet(this, _size);
|
|
89
108
|
}
|
|
109
|
+
/**
|
|
110
|
+
* The type property of a Blob object returns the MIME type of the file.
|
|
111
|
+
*/
|
|
90
112
|
get type() {
|
|
91
113
|
return __privateGet(this, _type);
|
|
92
114
|
}
|
|
115
|
+
/**
|
|
116
|
+
* The text() method in the Blob interface returns a Promise
|
|
117
|
+
* that resolves with a string containing the contents of
|
|
118
|
+
* the blob, interpreted as UTF-8.
|
|
119
|
+
*
|
|
120
|
+
* @return {Promise<string>}
|
|
121
|
+
*/
|
|
93
122
|
async text() {
|
|
94
123
|
const decoder = new TextDecoder();
|
|
95
124
|
let str = "";
|
|
@@ -99,6 +128,13 @@ const _Blob = (_a = class {
|
|
|
99
128
|
str += decoder.decode();
|
|
100
129
|
return str;
|
|
101
130
|
}
|
|
131
|
+
/**
|
|
132
|
+
* The arrayBuffer() method in the Blob interface returns a
|
|
133
|
+
* Promise that resolves with the contents of the blob as
|
|
134
|
+
* binary data contained in an ArrayBuffer.
|
|
135
|
+
*
|
|
136
|
+
* @return {Promise<ArrayBuffer>}
|
|
137
|
+
*/
|
|
102
138
|
async arrayBuffer() {
|
|
103
139
|
const data = new Uint8Array(this.size);
|
|
104
140
|
let offset = 0;
|
|
@@ -111,6 +147,7 @@ const _Blob = (_a = class {
|
|
|
111
147
|
stream() {
|
|
112
148
|
const it = toIterator(__privateGet(this, _parts), true);
|
|
113
149
|
return new globalThis.ReadableStream({
|
|
150
|
+
// @ts-ignore
|
|
114
151
|
type: "bytes",
|
|
115
152
|
async pull(ctrl) {
|
|
116
153
|
const chunk = await it.next();
|
|
@@ -121,6 +158,15 @@ const _Blob = (_a = class {
|
|
|
121
158
|
}
|
|
122
159
|
});
|
|
123
160
|
}
|
|
161
|
+
/**
|
|
162
|
+
* The Blob interface's slice() method creates and returns a
|
|
163
|
+
* new Blob object which contains data from a subset of the
|
|
164
|
+
* blob on which it's called.
|
|
165
|
+
*
|
|
166
|
+
* @param {number} [start]
|
|
167
|
+
* @param {number} [end]
|
|
168
|
+
* @param {string} [type]
|
|
169
|
+
*/
|
|
124
170
|
slice(start = 0, end = this.size, type = "") {
|
|
125
171
|
const { size } = this;
|
|
126
172
|
let relativeStart = start < 0 ? Math.max(size + start, 0) : Math.min(start, size);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../node_modules/fetch-blob/index.js"],"sourcesContent":["/*! fetch-blob. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */\n\n// TODO (jimmywarting): in the feature use conditional loading with top level await (requires 14.x)\n// Node has recently added whatwg stream into core\n\nimport './streams.cjs'\n\n// 64 KiB (same size chrome slice theirs blob into Uint8array's)\nconst POOL_SIZE = 65536\n\n/** @param {(Blob | Uint8Array)[]} parts */\nasync function * toIterator (parts, clone = true) {\n for (const part of parts) {\n if ('stream' in part) {\n yield * (/** @type {AsyncIterableIterator<Uint8Array>} */ (part.stream()))\n } else if (ArrayBuffer.isView(part)) {\n if (clone) {\n let position = part.byteOffset\n const end = part.byteOffset + part.byteLength\n while (position !== end) {\n const size = Math.min(end - position, POOL_SIZE)\n const chunk = part.buffer.slice(position, position + size)\n position += chunk.byteLength\n yield new Uint8Array(chunk)\n }\n } else {\n yield part\n }\n /* c8 ignore next 10 */\n } else {\n // For blobs that have arrayBuffer but no stream method (nodes buffer.Blob)\n let position = 0, b = (/** @type {Blob} */ (part))\n while (position !== b.size) {\n const chunk = b.slice(position, Math.min(b.size, position + POOL_SIZE))\n const buffer = await chunk.arrayBuffer()\n position += buffer.byteLength\n yield new Uint8Array(buffer)\n }\n }\n }\n}\n\nconst _Blob = class Blob {\n /** @type {Array.<(Blob|Uint8Array)>} */\n #parts = []\n #type = ''\n #size = 0\n #endings = 'transparent'\n\n /**\n * The Blob() constructor returns a new Blob object. The content\n * of the blob consists of the concatenation of the values given\n * in the parameter array.\n *\n * @param {*} blobParts\n * @param {{ type?: string, endings?: string }} [options]\n */\n constructor (blobParts = [], options = {}) {\n if (typeof blobParts !== 'object' || blobParts === null) {\n throw new TypeError('Failed to construct \\'Blob\\': The provided value cannot be converted to a sequence.')\n }\n\n if (typeof blobParts[Symbol.iterator] !== 'function') {\n throw new TypeError('Failed to construct \\'Blob\\': The object must have a callable @@iterator property.')\n }\n\n if (typeof options !== 'object' && typeof options !== 'function') {\n throw new TypeError('Failed to construct \\'Blob\\': parameter 2 cannot convert to dictionary.')\n }\n\n if (options === null) options = {}\n\n const encoder = new TextEncoder()\n for (const element of blobParts) {\n let part\n if (ArrayBuffer.isView(element)) {\n part = new Uint8Array(element.buffer.slice(element.byteOffset, element.byteOffset + element.byteLength))\n } else if (element instanceof ArrayBuffer) {\n part = new Uint8Array(element.slice(0))\n } else if (element instanceof Blob) {\n part = element\n } else {\n part = encoder.encode(`${element}`)\n }\n\n this.#size += ArrayBuffer.isView(part) ? part.byteLength : part.size\n this.#parts.push(part)\n }\n\n this.#endings = `${options.endings === undefined ? 'transparent' : options.endings}`\n const type = options.type === undefined ? '' : String(options.type)\n this.#type = /^[\\x20-\\x7E]*$/.test(type) ? type : ''\n }\n\n /**\n * The Blob interface's size property returns the\n * size of the Blob in bytes.\n */\n get size () {\n return this.#size\n }\n\n /**\n * The type property of a Blob object returns the MIME type of the file.\n */\n get type () {\n return this.#type\n }\n\n /**\n * The text() method in the Blob interface returns a Promise\n * that resolves with a string containing the contents of\n * the blob, interpreted as UTF-8.\n *\n * @return {Promise<string>}\n */\n async text () {\n // More optimized than using this.arrayBuffer()\n // that requires twice as much ram\n const decoder = new TextDecoder()\n let str = ''\n for await (const part of toIterator(this.#parts, false)) {\n str += decoder.decode(part, { stream: true })\n }\n // Remaining\n str += decoder.decode()\n return str\n }\n\n /**\n * The arrayBuffer() method in the Blob interface returns a\n * Promise that resolves with the contents of the blob as\n * binary data contained in an ArrayBuffer.\n *\n * @return {Promise<ArrayBuffer>}\n */\n async arrayBuffer () {\n // Easier way... Just a unnecessary overhead\n // const view = new Uint8Array(this.size);\n // await this.stream().getReader({mode: 'byob'}).read(view);\n // return view.buffer;\n\n const data = new Uint8Array(this.size)\n let offset = 0\n for await (const chunk of toIterator(this.#parts, false)) {\n data.set(chunk, offset)\n offset += chunk.length\n }\n\n return data.buffer\n }\n\n stream () {\n const it = toIterator(this.#parts, true)\n\n return new globalThis.ReadableStream({\n // @ts-ignore\n type: 'bytes',\n async pull (ctrl) {\n const chunk = await it.next()\n chunk.done ? ctrl.close() : ctrl.enqueue(chunk.value)\n },\n\n async cancel () {\n await it.return()\n }\n })\n }\n\n /**\n * The Blob interface's slice() method creates and returns a\n * new Blob object which contains data from a subset of the\n * blob on which it's called.\n *\n * @param {number} [start]\n * @param {number} [end]\n * @param {string} [type]\n */\n slice (start = 0, end = this.size, type = '') {\n const { size } = this\n\n let relativeStart = start < 0 ? Math.max(size + start, 0) : Math.min(start, size)\n let relativeEnd = end < 0 ? Math.max(size + end, 0) : Math.min(end, size)\n\n const span = Math.max(relativeEnd - relativeStart, 0)\n const parts = this.#parts\n const blobParts = []\n let added = 0\n\n for (const part of parts) {\n // don't add the overflow to new blobParts\n if (added >= span) {\n break\n }\n\n const size = ArrayBuffer.isView(part) ? part.byteLength : part.size\n if (relativeStart && size <= relativeStart) {\n // Skip the beginning and change the relative\n // start & end position as we skip the unwanted parts\n relativeStart -= size\n relativeEnd -= size\n } else {\n let chunk\n if (ArrayBuffer.isView(part)) {\n chunk = part.subarray(relativeStart, Math.min(size, relativeEnd))\n added += chunk.byteLength\n } else {\n chunk = part.slice(relativeStart, Math.min(size, relativeEnd))\n added += chunk.size\n }\n relativeEnd -= size\n blobParts.push(chunk)\n relativeStart = 0 // All next sequential parts should start at 0\n }\n }\n\n const blob = new Blob([], { type: String(type).toLowerCase() })\n blob.#size = span\n blob.#parts = blobParts\n\n return blob\n }\n\n get [Symbol.toStringTag] () {\n return 'Blob'\n }\n\n static [Symbol.hasInstance] (object) {\n return (\n object &&\n typeof object === 'object' &&\n typeof object.constructor === 'function' &&\n (\n typeof object.stream === 'function' ||\n typeof object.arrayBuffer === 'function'\n ) &&\n /^(Blob|File)$/.test(object[Symbol.toStringTag])\n )\n }\n}\n\nObject.defineProperties(_Blob.prototype, {\n size: { enumerable: true },\n type: { enumerable: true },\n slice: { enumerable: true }\n})\n\n/** @type {typeof globalThis.Blob} */\nexport const Blob = _Blob\nexport default Blob\n"],"names":["size"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAQA,MAAM,YAAY;AAGlB,gBAAiB,WAAY,OAAO,QAAQ,MAAM;AAChD,aAAW,QAAQ,OAAO;AACxB,QAAI,YAAY,MAAM;AACpB,aAA2D,KAAK;IACjE,WAAU,YAAY,OAAO,IAAI,GAAG;AACnC,UAAI,OAAO;AACT,YAAI,WAAW,KAAK;AACpB,cAA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AAA,EACR;AAAA,EAED,QAAQ,OAAO,aAAc,QAAQ;AACnC,WACE,UACA,OAAO,WAAW,YAClB,OAAO,OAAO,gBAAgB,eAE5B,OAAO,OAAO,WAAW,cACzB,OAAO,OAAO,gBAAgB,eAEhC,gBAAgB,KAAK,OAAO,OAAO,YAAY;AAAA,EAElD;AACH,GAnME,wBACA,uBACA,uBACA,0BALY;AAuMd,OAAO,iBAAiB,MAAM,WAAW;AAAA,EACvC,MAAM,EAAE,YAAY,KAAM;AAAA,EAC1B,MAAM,EAAE,YAAY,KAAM;AAAA,EAC1B,OAAO,EAAE,YAAY,KAAM;AAC7B,CAAC;AAGW,MAAC,OAAO;AACpB,MAAe,SAAA;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../node_modules/fetch-blob/index.js"],"sourcesContent":["/*! fetch-blob. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */\n\n// TODO (jimmywarting): in the feature use conditional loading with top level await (requires 14.x)\n// Node has recently added whatwg stream into core\n\nimport './streams.cjs'\n\n// 64 KiB (same size chrome slice theirs blob into Uint8array's)\nconst POOL_SIZE = 65536\n\n/** @param {(Blob | Uint8Array)[]} parts */\nasync function * toIterator (parts, clone = true) {\n for (const part of parts) {\n if ('stream' in part) {\n yield * (/** @type {AsyncIterableIterator<Uint8Array>} */ (part.stream()))\n } else if (ArrayBuffer.isView(part)) {\n if (clone) {\n let position = part.byteOffset\n const end = part.byteOffset + part.byteLength\n while (position !== end) {\n const size = Math.min(end - position, POOL_SIZE)\n const chunk = part.buffer.slice(position, position + size)\n position += chunk.byteLength\n yield new Uint8Array(chunk)\n }\n } else {\n yield part\n }\n /* c8 ignore next 10 */\n } else {\n // For blobs that have arrayBuffer but no stream method (nodes buffer.Blob)\n let position = 0, b = (/** @type {Blob} */ (part))\n while (position !== b.size) {\n const chunk = b.slice(position, Math.min(b.size, position + POOL_SIZE))\n const buffer = await chunk.arrayBuffer()\n position += buffer.byteLength\n yield new Uint8Array(buffer)\n }\n }\n }\n}\n\nconst _Blob = class Blob {\n /** @type {Array.<(Blob|Uint8Array)>} */\n #parts = []\n #type = ''\n #size = 0\n #endings = 'transparent'\n\n /**\n * The Blob() constructor returns a new Blob object. The content\n * of the blob consists of the concatenation of the values given\n * in the parameter array.\n *\n * @param {*} blobParts\n * @param {{ type?: string, endings?: string }} [options]\n */\n constructor (blobParts = [], options = {}) {\n if (typeof blobParts !== 'object' || blobParts === null) {\n throw new TypeError('Failed to construct \\'Blob\\': The provided value cannot be converted to a sequence.')\n }\n\n if (typeof blobParts[Symbol.iterator] !== 'function') {\n throw new TypeError('Failed to construct \\'Blob\\': The object must have a callable @@iterator property.')\n }\n\n if (typeof options !== 'object' && typeof options !== 'function') {\n throw new TypeError('Failed to construct \\'Blob\\': parameter 2 cannot convert to dictionary.')\n }\n\n if (options === null) options = {}\n\n const encoder = new TextEncoder()\n for (const element of blobParts) {\n let part\n if (ArrayBuffer.isView(element)) {\n part = new Uint8Array(element.buffer.slice(element.byteOffset, element.byteOffset + element.byteLength))\n } else if (element instanceof ArrayBuffer) {\n part = new Uint8Array(element.slice(0))\n } else if (element instanceof Blob) {\n part = element\n } else {\n part = encoder.encode(`${element}`)\n }\n\n this.#size += ArrayBuffer.isView(part) ? part.byteLength : part.size\n this.#parts.push(part)\n }\n\n this.#endings = `${options.endings === undefined ? 'transparent' : options.endings}`\n const type = options.type === undefined ? '' : String(options.type)\n this.#type = /^[\\x20-\\x7E]*$/.test(type) ? type : ''\n }\n\n /**\n * The Blob interface's size property returns the\n * size of the Blob in bytes.\n */\n get size () {\n return this.#size\n }\n\n /**\n * The type property of a Blob object returns the MIME type of the file.\n */\n get type () {\n return this.#type\n }\n\n /**\n * The text() method in the Blob interface returns a Promise\n * that resolves with a string containing the contents of\n * the blob, interpreted as UTF-8.\n *\n * @return {Promise<string>}\n */\n async text () {\n // More optimized than using this.arrayBuffer()\n // that requires twice as much ram\n const decoder = new TextDecoder()\n let str = ''\n for await (const part of toIterator(this.#parts, false)) {\n str += decoder.decode(part, { stream: true })\n }\n // Remaining\n str += decoder.decode()\n return str\n }\n\n /**\n * The arrayBuffer() method in the Blob interface returns a\n * Promise that resolves with the contents of the blob as\n * binary data contained in an ArrayBuffer.\n *\n * @return {Promise<ArrayBuffer>}\n */\n async arrayBuffer () {\n // Easier way... Just a unnecessary overhead\n // const view = new Uint8Array(this.size);\n // await this.stream().getReader({mode: 'byob'}).read(view);\n // return view.buffer;\n\n const data = new Uint8Array(this.size)\n let offset = 0\n for await (const chunk of toIterator(this.#parts, false)) {\n data.set(chunk, offset)\n offset += chunk.length\n }\n\n return data.buffer\n }\n\n stream () {\n const it = toIterator(this.#parts, true)\n\n return new globalThis.ReadableStream({\n // @ts-ignore\n type: 'bytes',\n async pull (ctrl) {\n const chunk = await it.next()\n chunk.done ? ctrl.close() : ctrl.enqueue(chunk.value)\n },\n\n async cancel () {\n await it.return()\n }\n })\n }\n\n /**\n * The Blob interface's slice() method creates and returns a\n * new Blob object which contains data from a subset of the\n * blob on which it's called.\n *\n * @param {number} [start]\n * @param {number} [end]\n * @param {string} [type]\n */\n slice (start = 0, end = this.size, type = '') {\n const { size } = this\n\n let relativeStart = start < 0 ? Math.max(size + start, 0) : Math.min(start, size)\n let relativeEnd = end < 0 ? Math.max(size + end, 0) : Math.min(end, size)\n\n const span = Math.max(relativeEnd - relativeStart, 0)\n const parts = this.#parts\n const blobParts = []\n let added = 0\n\n for (const part of parts) {\n // don't add the overflow to new blobParts\n if (added >= span) {\n break\n }\n\n const size = ArrayBuffer.isView(part) ? part.byteLength : part.size\n if (relativeStart && size <= relativeStart) {\n // Skip the beginning and change the relative\n // start & end position as we skip the unwanted parts\n relativeStart -= size\n relativeEnd -= size\n } else {\n let chunk\n if (ArrayBuffer.isView(part)) {\n chunk = part.subarray(relativeStart, Math.min(size, relativeEnd))\n added += chunk.byteLength\n } else {\n chunk = part.slice(relativeStart, Math.min(size, relativeEnd))\n added += chunk.size\n }\n relativeEnd -= size\n blobParts.push(chunk)\n relativeStart = 0 // All next sequential parts should start at 0\n }\n }\n\n const blob = new Blob([], { type: String(type).toLowerCase() })\n blob.#size = span\n blob.#parts = blobParts\n\n return blob\n }\n\n get [Symbol.toStringTag] () {\n return 'Blob'\n }\n\n static [Symbol.hasInstance] (object) {\n return (\n object &&\n typeof object === 'object' &&\n typeof object.constructor === 'function' &&\n (\n typeof object.stream === 'function' ||\n typeof object.arrayBuffer === 'function'\n ) &&\n /^(Blob|File)$/.test(object[Symbol.toStringTag])\n )\n }\n}\n\nObject.defineProperties(_Blob.prototype, {\n size: { enumerable: true },\n type: { enumerable: true },\n slice: { enumerable: true }\n})\n\n/** @type {typeof globalThis.Blob} */\nexport const Blob = _Blob\nexport default Blob\n"],"names":["size"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAQA,MAAM,YAAY;AAGlB,gBAAiB,WAAY,OAAO,QAAQ,MAAM;AAChD,aAAW,QAAQ,OAAO;AACxB,QAAI,YAAY,MAAM;AACpB;AAAA;AAAA,QAA2D,KAAK;;IACjE,WAAU,YAAY,OAAO,IAAI,GAAG;AACnC,UAAI,OAAO;AACT,YAAI,WAAW,KAAK;AACpB,cAAM,MAAM,KAAK,aAAa,KAAK;AACnC,eAAO,aAAa,KAAK;AACvB,gBAAM,OAAO,KAAK,IAAI,MAAM,UAAU,SAAS;AAC/C,gBAAM,QAAQ,KAAK,OAAO,MAAM,UAAU,WAAW,IAAI;AACzD,sBAAY,MAAM;AAClB,gBAAM,IAAI,WAAW,KAAK;AAAA,QAC3B;AAAA,MACT,OAAa;AACL,cAAM;AAAA,MACP;AAAA,IAEP,OAAW;AAEL,UAAI,WAAW,GAAG;AAAA;AAAA,QAA0B;AAAA;AAC5C,aAAO,aAAa,EAAE,MAAM;AAC1B,cAAM,QAAQ,EAAE,MAAM,UAAU,KAAK,IAAI,EAAE,MAAM,WAAW,SAAS,CAAC;AACtE,cAAM,SAAS,MAAM,MAAM,YAAa;AACxC,oBAAY,OAAO;AACnB,cAAM,IAA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uBACA,0BALY;AAuMd,OAAO,iBAAiB,MAAM,WAAW;AAAA,EACvC,MAAM,EAAE,YAAY,KAAM;AAAA,EAC1B,MAAM,EAAE,YAAY,KAAM;AAAA,EAC1B,OAAO,EAAE,YAAY,KAAM;AAC7B,CAAC;AAGW,MAAC,OAAO;AACpB,MAAe,SAAA;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"streams.cjs","sources":["../../../node_modules/fetch-blob/streams.cjs"],"sourcesContent":["/* c8 ignore start */\n// 64 KiB (same size chrome slice theirs blob into Uint8array's)\nconst POOL_SIZE = 65536\n\nif (!globalThis.ReadableStream) {\n // `node:stream/web` got introduced in v16.5.0 as experimental\n // and it's preferred over the polyfilled version. So we also\n // suppress the warning that gets emitted by NodeJS for using it.\n try {\n const process = require('node:process')\n const { emitWarning } = process\n try {\n process.emitWarning = () => {}\n Object.assign(globalThis, require('node:stream/web'))\n process.emitWarning = emitWarning\n } catch (error) {\n process.emitWarning = emitWarning\n throw error\n }\n } catch (error) {\n // fallback to polyfill implementation\n Object.assign(globalThis, require('web-streams-polyfill/dist/ponyfill.es2018.js'))\n }\n}\n\ntry {\n // Don't use node: prefix for this, require+node: is not supported until node v14.14\n // Only `import()` can use prefix in 12.20 and later\n const { Blob } = require('buffer')\n if (Blob && !Blob.prototype.stream) {\n Blob.prototype.stream = function name (params) {\n let position = 0\n const blob = this\n\n return new ReadableStream({\n type: 'bytes',\n async pull (ctrl) {\n const chunk = blob.slice(position, Math.min(blob.size, position + POOL_SIZE))\n const buffer = await chunk.arrayBuffer()\n position += buffer.byteLength\n ctrl.enqueue(new Uint8Array(buffer))\n\n if (position === blob.size) {\n ctrl.close()\n }\n }\n })\n }\n }\n} catch (error) {}\n/* c8 ignore end */\n"],"names":["require$$2"],"mappings":";;AAEA,MAAM,YAAY;AAElB,IAAI,CAAC,WAAW,gBAAgB;AAI9B,MAAI;AACF,UAAM,UAAU,QAAQ;
|
|
1
|
+
{"version":3,"file":"streams.cjs","sources":["../../../node_modules/fetch-blob/streams.cjs"],"sourcesContent":["/* c8 ignore start */\n// 64 KiB (same size chrome slice theirs blob into Uint8array's)\nconst POOL_SIZE = 65536\n\nif (!globalThis.ReadableStream) {\n // `node:stream/web` got introduced in v16.5.0 as experimental\n // and it's preferred over the polyfilled version. So we also\n // suppress the warning that gets emitted by NodeJS for using it.\n try {\n const process = require('node:process')\n const { emitWarning } = process\n try {\n process.emitWarning = () => {}\n Object.assign(globalThis, require('node:stream/web'))\n process.emitWarning = emitWarning\n } catch (error) {\n process.emitWarning = emitWarning\n throw error\n }\n } catch (error) {\n // fallback to polyfill implementation\n Object.assign(globalThis, require('web-streams-polyfill/dist/ponyfill.es2018.js'))\n }\n}\n\ntry {\n // Don't use node: prefix for this, require+node: is not supported until node v14.14\n // Only `import()` can use prefix in 12.20 and later\n const { Blob } = require('buffer')\n if (Blob && !Blob.prototype.stream) {\n Blob.prototype.stream = function name (params) {\n let position = 0\n const blob = this\n\n return new ReadableStream({\n type: 'bytes',\n async pull (ctrl) {\n const chunk = blob.slice(position, Math.min(blob.size, position + POOL_SIZE))\n const buffer = await chunk.arrayBuffer()\n position += buffer.byteLength\n ctrl.enqueue(new Uint8Array(buffer))\n\n if (position === blob.size) {\n ctrl.close()\n }\n }\n })\n }\n }\n} catch (error) {}\n/* c8 ignore end */\n"],"names":["require$$2"],"mappings":";;AAEA,MAAM,YAAY;AAElB,IAAI,CAAC,WAAW,gBAAgB;AAI9B,MAAI;AACF,UAAM,UAAU,QAAQ,cAAc;AACtC,UAAM,EAAE,YAAW,IAAK;AACxB,QAAI;AACF,cAAQ,cAAc,MAAM;AAAA,MAAE;AAC9B,aAAO,OAAO,YAAY,QAAQ,iBAAiB,CAAC;AACpD,cAAQ,cAAc;AAAA,IACvB,SAAQ,OAAP;AACA,cAAQ,cAAc;AACtB,YAAM;AAAA,IACP;AAAA,EACF,SAAQ,OAAP;AAEA,WAAO,OAAO,YAAYA,gBAAAA,WAAuD;AAAA,EAClF;AACH;AAEA,IAAI;AAGF,QAAM,EAAE,KAAI,IAAK,QAAQ,QAAQ;AACjC,MAAI,QAAQ,CAAC,KAAK,UAAU,QAAQ;AAClC,SAAK,UAAU,SAAS,SAAS,KAAM,QAAQ;AAC7C,UAAI,WAAW;AACf,YAAM,OAAO;AAEb,aAAO,IAAI,eAAe;AAAA,QACxB,MAAM;AAAA,QACN,MAAM,KAAM,MAAM;AAChB,gBAAM,QAAQ,KAAK,MAAM,UAAU,KAAK,IAAI,KAAK,MAAM,WAAW,SAAS,CAAC;AAC5E,gBAAM,SAAS,MAAM,MAAM,YAAa;AACxC,sBAAY,OAAO;AACnB,eAAK,QAAQ,IAAI,WAAW,MAAM,CAAC;AAEnC,cAAI,aAAa,KAAK,MAAM;AAC1B,iBAAK,MAAO;AAAA,UACb;AAAA,QACF;AAAA,MACT,CAAO;AAAA,IACF;AAAA,EACF;AACH,SAAS,OAAP;AAAc;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"streams.js","sources":["../../../node_modules/fetch-blob/streams.cjs"],"sourcesContent":["/* c8 ignore start */\n// 64 KiB (same size chrome slice theirs blob into Uint8array's)\nconst POOL_SIZE = 65536\n\nif (!globalThis.ReadableStream) {\n // `node:stream/web` got introduced in v16.5.0 as experimental\n // and it's preferred over the polyfilled version. So we also\n // suppress the warning that gets emitted by NodeJS for using it.\n try {\n const process = require('node:process')\n const { emitWarning } = process\n try {\n process.emitWarning = () => {}\n Object.assign(globalThis, require('node:stream/web'))\n process.emitWarning = emitWarning\n } catch (error) {\n process.emitWarning = emitWarning\n throw error\n }\n } catch (error) {\n // fallback to polyfill implementation\n Object.assign(globalThis, require('web-streams-polyfill/dist/ponyfill.es2018.js'))\n }\n}\n\ntry {\n // Don't use node: prefix for this, require+node: is not supported until node v14.14\n // Only `import()` can use prefix in 12.20 and later\n const { Blob } = require('buffer')\n if (Blob && !Blob.prototype.stream) {\n Blob.prototype.stream = function name (params) {\n let position = 0\n const blob = this\n\n return new ReadableStream({\n type: 'bytes',\n async pull (ctrl) {\n const chunk = blob.slice(position, Math.min(blob.size, position + POOL_SIZE))\n const buffer = await chunk.arrayBuffer()\n position += buffer.byteLength\n ctrl.enqueue(new Uint8Array(buffer))\n\n if (position === blob.size) {\n ctrl.close()\n }\n }\n })\n }\n }\n} catch (error) {}\n/* c8 ignore end */\n"],"names":["require$$2"],"mappings":";AAEA,MAAM,YAAY;AAElB,IAAI,CAAC,WAAW,gBAAgB;AAI9B,MAAI;AACF,UAAM,UAAU,QAAQ;
|
|
1
|
+
{"version":3,"file":"streams.js","sources":["../../../node_modules/fetch-blob/streams.cjs"],"sourcesContent":["/* c8 ignore start */\n// 64 KiB (same size chrome slice theirs blob into Uint8array's)\nconst POOL_SIZE = 65536\n\nif (!globalThis.ReadableStream) {\n // `node:stream/web` got introduced in v16.5.0 as experimental\n // and it's preferred over the polyfilled version. So we also\n // suppress the warning that gets emitted by NodeJS for using it.\n try {\n const process = require('node:process')\n const { emitWarning } = process\n try {\n process.emitWarning = () => {}\n Object.assign(globalThis, require('node:stream/web'))\n process.emitWarning = emitWarning\n } catch (error) {\n process.emitWarning = emitWarning\n throw error\n }\n } catch (error) {\n // fallback to polyfill implementation\n Object.assign(globalThis, require('web-streams-polyfill/dist/ponyfill.es2018.js'))\n }\n}\n\ntry {\n // Don't use node: prefix for this, require+node: is not supported until node v14.14\n // Only `import()` can use prefix in 12.20 and later\n const { Blob } = require('buffer')\n if (Blob && !Blob.prototype.stream) {\n Blob.prototype.stream = function name (params) {\n let position = 0\n const blob = this\n\n return new ReadableStream({\n type: 'bytes',\n async pull (ctrl) {\n const chunk = blob.slice(position, Math.min(blob.size, position + POOL_SIZE))\n const buffer = await chunk.arrayBuffer()\n position += buffer.byteLength\n ctrl.enqueue(new Uint8Array(buffer))\n\n if (position === blob.size) {\n ctrl.close()\n }\n }\n })\n }\n }\n} catch (error) {}\n/* c8 ignore end */\n"],"names":["require$$2"],"mappings":";AAEA,MAAM,YAAY;AAElB,IAAI,CAAC,WAAW,gBAAgB;AAI9B,MAAI;AACF,UAAM,UAAU,QAAQ,cAAc;AACtC,UAAM,EAAE,YAAW,IAAK;AACxB,QAAI;AACF,cAAQ,cAAc,MAAM;AAAA,MAAE;AAC9B,aAAO,OAAO,YAAY,QAAQ,iBAAiB,CAAC;AACpD,cAAQ,cAAc;AAAA,IACvB,SAAQ,OAAP;AACA,cAAQ,cAAc;AACtB,YAAM;AAAA,IACP;AAAA,EACF,SAAQ,OAAP;AAEA,WAAO,OAAO,YAAYA,wBAAuD;AAAA,EAClF;AACH;AAEA,IAAI;AAGF,QAAM,EAAE,KAAI,IAAK,QAAQ,QAAQ;AACjC,MAAI,QAAQ,CAAC,KAAK,UAAU,QAAQ;AAClC,SAAK,UAAU,SAAS,SAAS,KAAM,QAAQ;AAC7C,UAAI,WAAW;AACf,YAAM,OAAO;AAEb,aAAO,IAAI,eAAe;AAAA,QACxB,MAAM;AAAA,QACN,MAAM,KAAM,MAAM;AAChB,gBAAM,QAAQ,KAAK,MAAM,UAAU,KAAK,IAAI,KAAK,MAAM,WAAW,SAAS,CAAC;AAC5E,gBAAM,SAAS,MAAM,MAAM,YAAa;AACxC,sBAAY,OAAO;AACnB,eAAK,QAAQ,IAAI,WAAW,MAAM,CAAC;AAEnC,cAAI,aAAa,KAAK,MAAM;AAC1B,iBAAK,MAAO;AAAA,UACb;AAAA,QACF;AAAA,MACT,CAAO;AAAA,IACF;AAAA,EACF;AACH,SAAS,OAAP;AAAc;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"esm.min.cjs","sources":["../../../node_modules/formdata-polyfill/esm.min.js"],"sourcesContent":["/*! formdata-polyfill. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */\n\nimport C from 'fetch-blob'\nimport F from 'fetch-blob/file.js'\n\nvar {toStringTag:t,iterator:i,hasInstance:h}=Symbol,\nr=Math.random,\nm='append,set,get,getAll,delete,keys,values,entries,forEach,constructor'.split(','),\nf=(a,b,c)=>(a+='',/^(Blob|File)$/.test(b && b[t])?[(c=c!==void 0?c+'':b[t]=='File'?b.name:'blob',a),b.name!==c||b[t]=='blob'?new F([b],c,b):b]:[a,b+'']),\ne=(c,f)=>(f?c:c.replace(/\\r?\\n|\\r/g,'\\r\\n')).replace(/\\n/g,'%0A').replace(/\\r/g,'%0D').replace(/\"/g,'%22'),\nx=(n, a, e)=>{if(a.length<e){throw new TypeError(`Failed to execute '${n}' on 'FormData': ${e} arguments required, but only ${a.length} present.`)}}\n\nexport const File = F\n\n/** @type {typeof globalThis.FormData} */\nexport const FormData = class FormData {\n#d=[];\nconstructor(...a){if(a.length)throw new TypeError(`Failed to construct 'FormData': parameter 1 is not of type 'HTMLFormElement'.`)}\nget [t]() {return 'FormData'}\n[i](){return this.entries()}\nstatic [h](o) {return o&&typeof o==='object'&&o[t]==='FormData'&&!m.some(m=>typeof o[m]!='function')}\nappend(...a){x('append',arguments,2);this.#d.push(f(...a))}\ndelete(a){x('delete',arguments,1);a+='';this.#d=this.#d.filter(([b])=>b!==a)}\nget(a){x('get',arguments,1);a+='';for(var b=this.#d,l=b.length,c=0;c<l;c++)if(b[c][0]===a)return b[c][1];return null}\ngetAll(a,b){x('getAll',arguments,1);b=[];a+='';this.#d.forEach(c=>c[0]===a&&b.push(c[1]));return b}\nhas(a){x('has',arguments,1);a+='';return this.#d.some(b=>b[0]===a)}\nforEach(a,b){x('forEach',arguments,1);for(var [c,d]of this)a.call(b,d,c,this)}\nset(...a){x('set',arguments,2);var b=[],c=!0;a=f(...a);this.#d.forEach(d=>{d[0]===a[0]?c&&(c=!b.push(a)):b.push(d)});c&&b.push(a);this.#d=b}\n*entries(){yield*this.#d}\n*keys(){for(var[a]of this)yield a}\n*values(){for(var[,a]of this)yield a}}\n\n/** @param {FormData} F */\nexport function formDataToBlob (F,B=C){\nvar b=`${r()}${r()}`.replace(/\\./g, '').slice(-28).padStart(32, '-'),c=[],p=`--${b}\\r\\nContent-Disposition: form-data; name=\"`\nF.forEach((v,n)=>typeof v=='string'\n?c.push(p+e(n)+`\"\\r\\n\\r\\n${v.replace(/\\r(?!\\n)|(?<!\\r)\\n/g, '\\r\\n')}\\r\\n`)\n:c.push(p+e(n)+`\"; filename=\"${e(v.name, 1)}\"\\r\\nContent-Type: ${v.type||\"application/octet-stream\"}\\r\\n\\r\\n`, v, '\\r\\n'))\nc.push(`--${b}--`)\nreturn new B(c,{type:\"multipart/form-data; boundary=\"+b})}\n"],"names":["F","f","e","m","C"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAKA,IAAI,EAAC,aAAY,GAAE,UAAS,GAAE,aAAY,EAAC,IAAE,QAC7C,IAAE,KAAK,QACP,IAAE,uEAAuE,MAAM,GAAG,GAClF,IAAE,CAAC,GAAE,GAAE,OAAK,KAAG,IAAG,gBAAgB,KAAK,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"esm.min.cjs","sources":["../../../node_modules/formdata-polyfill/esm.min.js"],"sourcesContent":["/*! formdata-polyfill. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */\n\nimport C from 'fetch-blob'\nimport F from 'fetch-blob/file.js'\n\nvar {toStringTag:t,iterator:i,hasInstance:h}=Symbol,\nr=Math.random,\nm='append,set,get,getAll,delete,keys,values,entries,forEach,constructor'.split(','),\nf=(a,b,c)=>(a+='',/^(Blob|File)$/.test(b && b[t])?[(c=c!==void 0?c+'':b[t]=='File'?b.name:'blob',a),b.name!==c||b[t]=='blob'?new F([b],c,b):b]:[a,b+'']),\ne=(c,f)=>(f?c:c.replace(/\\r?\\n|\\r/g,'\\r\\n')).replace(/\\n/g,'%0A').replace(/\\r/g,'%0D').replace(/\"/g,'%22'),\nx=(n, a, e)=>{if(a.length<e){throw new TypeError(`Failed to execute '${n}' on 'FormData': ${e} arguments required, but only ${a.length} present.`)}}\n\nexport const File = F\n\n/** @type {typeof globalThis.FormData} */\nexport const FormData = class FormData {\n#d=[];\nconstructor(...a){if(a.length)throw new TypeError(`Failed to construct 'FormData': parameter 1 is not of type 'HTMLFormElement'.`)}\nget [t]() {return 'FormData'}\n[i](){return this.entries()}\nstatic [h](o) {return o&&typeof o==='object'&&o[t]==='FormData'&&!m.some(m=>typeof o[m]!='function')}\nappend(...a){x('append',arguments,2);this.#d.push(f(...a))}\ndelete(a){x('delete',arguments,1);a+='';this.#d=this.#d.filter(([b])=>b!==a)}\nget(a){x('get',arguments,1);a+='';for(var b=this.#d,l=b.length,c=0;c<l;c++)if(b[c][0]===a)return b[c][1];return null}\ngetAll(a,b){x('getAll',arguments,1);b=[];a+='';this.#d.forEach(c=>c[0]===a&&b.push(c[1]));return b}\nhas(a){x('has',arguments,1);a+='';return this.#d.some(b=>b[0]===a)}\nforEach(a,b){x('forEach',arguments,1);for(var [c,d]of this)a.call(b,d,c,this)}\nset(...a){x('set',arguments,2);var b=[],c=!0;a=f(...a);this.#d.forEach(d=>{d[0]===a[0]?c&&(c=!b.push(a)):b.push(d)});c&&b.push(a);this.#d=b}\n*entries(){yield*this.#d}\n*keys(){for(var[a]of this)yield a}\n*values(){for(var[,a]of this)yield a}}\n\n/** @param {FormData} F */\nexport function formDataToBlob (F,B=C){\nvar b=`${r()}${r()}`.replace(/\\./g, '').slice(-28).padStart(32, '-'),c=[],p=`--${b}\\r\\nContent-Disposition: form-data; name=\"`\nF.forEach((v,n)=>typeof v=='string'\n?c.push(p+e(n)+`\"\\r\\n\\r\\n${v.replace(/\\r(?!\\n)|(?<!\\r)\\n/g, '\\r\\n')}\\r\\n`)\n:c.push(p+e(n)+`\"; filename=\"${e(v.name, 1)}\"\\r\\nContent-Type: ${v.type||\"application/octet-stream\"}\\r\\n\\r\\n`, v, '\\r\\n'))\nc.push(`--${b}--`)\nreturn new B(c,{type:\"multipart/form-data; boundary=\"+b})}\n"],"names":["F","f","e","m","C"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAKA,IAAI,EAAC,aAAY,GAAE,UAAS,GAAE,aAAY,EAAC,IAAE,QAC7C,I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EAAE;AAAA,EACxB,CAAC,OAAM;AAAC,aAAO,CAAC,CAAC,KAAI;AAAK,YAAM;AAAA,EAAC;AAAA,EACjC,CAAC,SAAQ;AAAC,aAAO,CAAE,EAAA,CAAC,KAAI;AAAK,YAAM;AAAA,EAAC;AAAC,GAdrC,oBADwB;AAkBjB,SAAS,eAAgB,GAAE,IAAEC,eAAE;AACtC,MAAI,IAAE,GAAG,EAAG,IAAG,EAAC,IAAK,QAAQ,OAAO,EAAE,EAAE,MAAM,GAAG,EAAE,SAAS,IAAI,GAAG,GAAE,IAAE,CAAE,GAAC,IAAE,KAAK;AAAA;AACjF,IAAE,QAAQ,CAAC,GAAE,MAAI,OAAO,KAAG,WAC1B,EAAE,KAAK,IAAE,EAAE,CAAC,IAAE;AAAA;AAAA,EAAY,EAAE,QAAQ,WAAA,0BAAA,GAAqB,GAAE,MAAM;AAAA,CAAO,IACxE,EAAE,KAAK,IAAE,EAAE,CAAC,IAAE,gBAAgB,EAAE,EAAE,MAAM,CAAC;AAAA,gBAAuB,EAAE,QAAM;AAAA;AAAA,GAAsC,GAAG,MAAM,CAAC;AACzH,IAAE,KAAK,KAAK,KAAK;AACjB,SAAO,IAAI,EAAE,GAAE,EAAC,MAAK,mCAAiC,EAAC,CAAC;AAAC;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"esm.min.js","sources":["../../../node_modules/formdata-polyfill/esm.min.js"],"sourcesContent":["/*! formdata-polyfill. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */\n\nimport C from 'fetch-blob'\nimport F from 'fetch-blob/file.js'\n\nvar {toStringTag:t,iterator:i,hasInstance:h}=Symbol,\nr=Math.random,\nm='append,set,get,getAll,delete,keys,values,entries,forEach,constructor'.split(','),\nf=(a,b,c)=>(a+='',/^(Blob|File)$/.test(b && b[t])?[(c=c!==void 0?c+'':b[t]=='File'?b.name:'blob',a),b.name!==c||b[t]=='blob'?new F([b],c,b):b]:[a,b+'']),\ne=(c,f)=>(f?c:c.replace(/\\r?\\n|\\r/g,'\\r\\n')).replace(/\\n/g,'%0A').replace(/\\r/g,'%0D').replace(/\"/g,'%22'),\nx=(n, a, e)=>{if(a.length<e){throw new TypeError(`Failed to execute '${n}' on 'FormData': ${e} arguments required, but only ${a.length} present.`)}}\n\nexport const File = F\n\n/** @type {typeof globalThis.FormData} */\nexport const FormData = class FormData {\n#d=[];\nconstructor(...a){if(a.length)throw new TypeError(`Failed to construct 'FormData': parameter 1 is not of type 'HTMLFormElement'.`)}\nget [t]() {return 'FormData'}\n[i](){return this.entries()}\nstatic [h](o) {return o&&typeof o==='object'&&o[t]==='FormData'&&!m.some(m=>typeof o[m]!='function')}\nappend(...a){x('append',arguments,2);this.#d.push(f(...a))}\ndelete(a){x('delete',arguments,1);a+='';this.#d=this.#d.filter(([b])=>b!==a)}\nget(a){x('get',arguments,1);a+='';for(var b=this.#d,l=b.length,c=0;c<l;c++)if(b[c][0]===a)return b[c][1];return null}\ngetAll(a,b){x('getAll',arguments,1);b=[];a+='';this.#d.forEach(c=>c[0]===a&&b.push(c[1]));return b}\nhas(a){x('has',arguments,1);a+='';return this.#d.some(b=>b[0]===a)}\nforEach(a,b){x('forEach',arguments,1);for(var [c,d]of this)a.call(b,d,c,this)}\nset(...a){x('set',arguments,2);var b=[],c=!0;a=f(...a);this.#d.forEach(d=>{d[0]===a[0]?c&&(c=!b.push(a)):b.push(d)});c&&b.push(a);this.#d=b}\n*entries(){yield*this.#d}\n*keys(){for(var[a]of this)yield a}\n*values(){for(var[,a]of this)yield a}}\n\n/** @param {FormData} F */\nexport function formDataToBlob (F,B=C){\nvar b=`${r()}${r()}`.replace(/\\./g, '').slice(-28).padStart(32, '-'),c=[],p=`--${b}\\r\\nContent-Disposition: form-data; name=\"`\nF.forEach((v,n)=>typeof v=='string'\n?c.push(p+e(n)+`\"\\r\\n\\r\\n${v.replace(/\\r(?!\\n)|(?<!\\r)\\n/g, '\\r\\n')}\\r\\n`)\n:c.push(p+e(n)+`\"; filename=\"${e(v.name, 1)}\"\\r\\nContent-Type: ${v.type||\"application/octet-stream\"}\\r\\n\\r\\n`, v, '\\r\\n'))\nc.push(`--${b}--`)\nreturn new B(c,{type:\"multipart/form-data; boundary=\"+b})}\n"],"names":["F","f","e","m","C"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAKA,IAAI,EAAC,aAAY,GAAE,UAAS,GAAE,aAAY,EAAC,IAAE,QAC7C,IAAE,KAAK,QACP,IAAE,uEAAuE,MAAM,GAAG,GAClF,IAAE,CAAC,GAAE,GAAE,OAAK,KAAG,IAAG,gBAAgB,KAAK,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"esm.min.js","sources":["../../../node_modules/formdata-polyfill/esm.min.js"],"sourcesContent":["/*! formdata-polyfill. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */\n\nimport C from 'fetch-blob'\nimport F from 'fetch-blob/file.js'\n\nvar {toStringTag:t,iterator:i,hasInstance:h}=Symbol,\nr=Math.random,\nm='append,set,get,getAll,delete,keys,values,entries,forEach,constructor'.split(','),\nf=(a,b,c)=>(a+='',/^(Blob|File)$/.test(b && b[t])?[(c=c!==void 0?c+'':b[t]=='File'?b.name:'blob',a),b.name!==c||b[t]=='blob'?new F([b],c,b):b]:[a,b+'']),\ne=(c,f)=>(f?c:c.replace(/\\r?\\n|\\r/g,'\\r\\n')).replace(/\\n/g,'%0A').replace(/\\r/g,'%0D').replace(/\"/g,'%22'),\nx=(n, a, e)=>{if(a.length<e){throw new TypeError(`Failed to execute '${n}' on 'FormData': ${e} arguments required, but only ${a.length} present.`)}}\n\nexport const File = F\n\n/** @type {typeof globalThis.FormData} */\nexport const FormData = class FormData {\n#d=[];\nconstructor(...a){if(a.length)throw new TypeError(`Failed to construct 'FormData': parameter 1 is not of type 'HTMLFormElement'.`)}\nget [t]() {return 'FormData'}\n[i](){return this.entries()}\nstatic [h](o) {return o&&typeof o==='object'&&o[t]==='FormData'&&!m.some(m=>typeof o[m]!='function')}\nappend(...a){x('append',arguments,2);this.#d.push(f(...a))}\ndelete(a){x('delete',arguments,1);a+='';this.#d=this.#d.filter(([b])=>b!==a)}\nget(a){x('get',arguments,1);a+='';for(var b=this.#d,l=b.length,c=0;c<l;c++)if(b[c][0]===a)return b[c][1];return null}\ngetAll(a,b){x('getAll',arguments,1);b=[];a+='';this.#d.forEach(c=>c[0]===a&&b.push(c[1]));return b}\nhas(a){x('has',arguments,1);a+='';return this.#d.some(b=>b[0]===a)}\nforEach(a,b){x('forEach',arguments,1);for(var [c,d]of this)a.call(b,d,c,this)}\nset(...a){x('set',arguments,2);var b=[],c=!0;a=f(...a);this.#d.forEach(d=>{d[0]===a[0]?c&&(c=!b.push(a)):b.push(d)});c&&b.push(a);this.#d=b}\n*entries(){yield*this.#d}\n*keys(){for(var[a]of this)yield a}\n*values(){for(var[,a]of this)yield a}}\n\n/** @param {FormData} F */\nexport function formDataToBlob (F,B=C){\nvar b=`${r()}${r()}`.replace(/\\./g, '').slice(-28).padStart(32, '-'),c=[],p=`--${b}\\r\\nContent-Disposition: form-data; name=\"`\nF.forEach((v,n)=>typeof v=='string'\n?c.push(p+e(n)+`\"\\r\\n\\r\\n${v.replace(/\\r(?!\\n)|(?<!\\r)\\n/g, '\\r\\n')}\\r\\n`)\n:c.push(p+e(n)+`\"; filename=\"${e(v.name, 1)}\"\\r\\nContent-Type: ${v.type||\"application/octet-stream\"}\\r\\n\\r\\n`, v, '\\r\\n'))\nc.push(`--${b}--`)\nreturn new B(c,{type:\"multipart/form-data; boundary=\"+b})}\n"],"names":["F","f","e","m","C"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAKA,IAAI,EAAC,aAAY,GAAE,UAAS,GAAE,aAAY,EAAC,IAAE,QAC7C,IAAE,KAAK,QACP,IAAE,uEAAuE,MAAM,GAAG,GAClF,IAAE,CAAC,GAAE,GAAE,OAAK,KAAG,IAAG,gBAAgB,KAAK,KAAK,EAAE,CAAC,CAAC,IAAE,EAAE,I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AK,YAAM;AAAA,EAAC;AAAC,GAdrC,oBADwB;AAkBjB,SAAS,eAAgB,GAAE,IAAEC,MAAE;AACtC,MAAI,IAAE,GAAG,EAAG,IAAG,EAAC,IAAK,QAAQ,OAAO,EAAE,EAAE,MAAM,GAAG,EAAE,SAAS,IAAI,GAAG,GAAE,IAAE,CAAE,GAAC,IAAE,KAAK;AAAA;AACjF,IAAE,QAAQ,CAAC,GAAE,MAAI,OAAO,KAAG,WAC1B,EAAE,KAAK,IAAE,EAAE,CAAC,IAAE;AAAA;AAAA,EAAY,EAAE,QAAQ,WAAA,0BAAA,GAAqB,GAAE,MAAM;AAAA,CAAO,IACxE,EAAE,KAAK,IAAE,EAAE,CAAC,IAAE,gBAAgB,EAAE,EAAE,MAAM,CAAC;AAAA,gBAAuB,EAAE,QAAM;AAAA;AAAA,GAAsC,GAAG,MAAM,CAAC;AACzH,IAAE,KAAK,KAAK,KAAK;AACjB,SAAO,IAAI,EAAE,GAAE,EAAC,MAAK,mCAAiC,EAAC,CAAC;AAAC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../node_modules/node-domexception/index.js"],"sourcesContent":["/*! node-domexception. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */\n\nif (!globalThis.DOMException) {\n try {\n const { MessageChannel } = require('worker_threads'),\n port = new MessageChannel().port1,\n ab = new ArrayBuffer()\n port.postMessage(ab, [ab, ab])\n } catch (err) {\n err.constructor.name === 'DOMException' && (\n globalThis.DOMException = err.constructor\n )\n }\n}\n\nmodule.exports = globalThis.DOMException\n"],"names":[],"mappings":";;AAEA,IAAI,CAAC,WAAW,cAAc;AAC5B,MAAI;AACF,UAAM,EAAE,eAAc,IAAK,QAAQ,
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../node_modules/node-domexception/index.js"],"sourcesContent":["/*! node-domexception. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */\n\nif (!globalThis.DOMException) {\n try {\n const { MessageChannel } = require('worker_threads'),\n port = new MessageChannel().port1,\n ab = new ArrayBuffer()\n port.postMessage(ab, [ab, ab])\n } catch (err) {\n err.constructor.name === 'DOMException' && (\n globalThis.DOMException = err.constructor\n )\n }\n}\n\nmodule.exports = globalThis.DOMException\n"],"names":[],"mappings":";;AAEA,IAAI,CAAC,WAAW,cAAc;AAC5B,MAAI;AACF,UAAM,EAAE,eAAc,IAAK,QAAQ,gBAAgB,GACnD,OAAO,IAAI,eAAc,EAAG,OAC5B,KAAK,IAAI,YAAa;AACtB,SAAK,YAAY,IAAI,CAAC,IAAI,EAAE,CAAC;AAAA,EAC9B,SAAQ,KAAP;AACA,QAAI,YAAY,SAAS,mBACvB,WAAW,eAAe,IAAI;AAAA,EAEjC;AACH;"}
|