diff --git a/package-lock.json b/package-lock.json index ac942eea..cb72e8c1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,6 +19,7 @@ "md5": "^2.3.0", "minimatch": "^7.4.6", "nested-property": "^4.0.0", + "node-fetch": "^3.3.2", "path-posix": "^1.0.0", "url-join": "^5.0.0", "url-parse": "^1.5.10" @@ -30,7 +31,7 @@ "@types/chai": "^4.3.12", "@types/he": "^1.2.3", "@types/mocha": "^10.0.6", - "@types/node": "^20.11.28", + "@types/node": "^20.12.7", "@types/sinon": "^17.0.3", "@types/url-parse": "^1.4.11", "babel-loader": "^9.1.3", @@ -55,7 +56,6 @@ "mkdirp": "^1.0.4", "mocha": "^10.3.0", "nock": "^13.5.4", - "node-fetch": "^3.3.0", "nodemon": "^3.1.0", "npm-run-all": "^4.1.5", "prettier": "^3.2.5", @@ -64,7 +64,7 @@ "rimraf": "^5.0.5", "sinon": "^17.0.1", "ts-node": "^10.9.2", - "typescript": "^5.4.2", + "typescript": "^5.4.5", "wait-on": "^6.0.1", "webdav-server": "^2.6.2", "webpack": "^5.90.3", @@ -2284,9 +2284,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.11.28", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.28.tgz", - "integrity": "sha512-M/GPWVS2wLkSkNHVeLkrF2fD5Lx5UC4PxA0uZcKc6QqbIQUJyW1jVjueJYi1z8n0I5PxYrtpnPnWglE+y9A0KA==", + "version": "20.12.7", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.7.tgz", + "integrity": "sha512-wq0cICSkRLVaf3UGLMGItu/PtdY7oaXaI/RVU+xliKVOtRna3PRY57ZDfztpDL0n11vfymMUnXv8QwYCO7L1wg==", "dev": true, "dependencies": { "undici-types": "~5.26.4" @@ -3798,7 +3798,6 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-4.0.0.tgz", "integrity": "sha512-Vr3mLBA8qWmcuschSLAOogKgQ/Jwxulv3RNE4FXnYWRGujzrRWQI4m12fQqRkwX06C0KanhLr4hK+GydchZsaA==", - "devOptional": true, "engines": { "node": ">= 12" } @@ -4361,7 +4360,6 @@ "version": "3.2.0", "resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.2.0.tgz", "integrity": "sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==", - "devOptional": true, "funding": [ { "type": "github", @@ -4605,7 +4603,6 @@ "version": "4.0.10", "resolved": "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz", "integrity": "sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==", - "devOptional": true, "dependencies": { "fetch-blob": "^3.1.2" }, @@ -6752,7 +6749,6 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz", "integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==", - "devOptional": true, "funding": [ { "type": "github", @@ -6768,10 +6764,9 @@ } }, "node_modules/node-fetch": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.3.0.tgz", - "integrity": "sha512-BKwRP/O0UvoMKp7GNdwPlObhYGB5DQqwhEDQlNKuoqwVYSxkSZCSbHjnFFmUEtwSKRPU4kNK8PbDYYitwaE3QA==", - "devOptional": true, + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.3.2.tgz", + "integrity": "sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==", "dependencies": { "data-uri-to-buffer": "^4.0.0", "fetch-blob": "^3.1.4", @@ -8655,9 +8650,9 @@ } }, "node_modules/typescript": { - "version": "5.4.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.2.tgz", - "integrity": "sha512-+2/g0Fds1ERlP6JsakQQDXjZdZMM+rqpamFZJEKh4kwTIn3iDkgKtby0CeNd5ATNZ4Ry1ax15TMx0W2V+miizQ==", + "version": "5.4.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.5.tgz", + "integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==", "dev": true, "bin": { "tsc": "bin/tsc", @@ -8920,7 +8915,6 @@ "version": "3.2.1", "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.2.1.tgz", "integrity": "sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q==", - "devOptional": true, "engines": { "node": ">= 8" } @@ -11075,9 +11069,9 @@ "dev": true }, "@types/node": { - "version": "20.11.28", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.28.tgz", - "integrity": "sha512-M/GPWVS2wLkSkNHVeLkrF2fD5Lx5UC4PxA0uZcKc6QqbIQUJyW1jVjueJYi1z8n0I5PxYrtpnPnWglE+y9A0KA==", + "version": "20.12.7", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.7.tgz", + "integrity": "sha512-wq0cICSkRLVaf3UGLMGItu/PtdY7oaXaI/RVU+xliKVOtRna3PRY57ZDfztpDL0n11vfymMUnXv8QwYCO7L1wg==", "dev": true, "requires": { "undici-types": "~5.26.4" @@ -12228,8 +12222,7 @@ "data-uri-to-buffer": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-4.0.0.tgz", - "integrity": "sha512-Vr3mLBA8qWmcuschSLAOogKgQ/Jwxulv3RNE4FXnYWRGujzrRWQI4m12fQqRkwX06C0KanhLr4hK+GydchZsaA==", - "devOptional": true + "integrity": "sha512-Vr3mLBA8qWmcuschSLAOogKgQ/Jwxulv3RNE4FXnYWRGujzrRWQI4m12fQqRkwX06C0KanhLr4hK+GydchZsaA==" }, "date-fns": { "version": "2.30.0", @@ -12640,7 +12633,6 @@ "version": "3.2.0", "resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.2.0.tgz", "integrity": "sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==", - "devOptional": true, "requires": { "node-domexception": "^1.0.0", "web-streams-polyfill": "^3.0.3" @@ -12798,7 +12790,6 @@ "version": "4.0.10", "resolved": "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz", "integrity": "sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==", - "devOptional": true, "requires": { "fetch-blob": "^3.1.2" } @@ -14366,14 +14357,12 @@ "node-domexception": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz", - "integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==", - "devOptional": true + "integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==" }, "node-fetch": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.3.0.tgz", - "integrity": "sha512-BKwRP/O0UvoMKp7GNdwPlObhYGB5DQqwhEDQlNKuoqwVYSxkSZCSbHjnFFmUEtwSKRPU4kNK8PbDYYitwaE3QA==", - "devOptional": true, + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.3.2.tgz", + "integrity": "sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==", "requires": { "data-uri-to-buffer": "^4.0.0", "fetch-blob": "^3.1.4", @@ -15752,9 +15741,9 @@ } }, "typescript": { - "version": "5.4.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.2.tgz", - "integrity": "sha512-+2/g0Fds1ERlP6JsakQQDXjZdZMM+rqpamFZJEKh4kwTIn3iDkgKtby0CeNd5ATNZ4Ry1ax15TMx0W2V+miizQ==", + "version": "5.4.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.5.tgz", + "integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==", "dev": true }, "ua-parser-js": { @@ -15938,8 +15927,7 @@ "web-streams-polyfill": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.2.1.tgz", - "integrity": "sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q==", - "devOptional": true + "integrity": "sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q==" }, "webdav-server": { "version": "2.6.2", diff --git a/package.json b/package.json index d658f408..8034bce7 100644 --- a/package.json +++ b/package.json @@ -76,6 +76,7 @@ "md5": "^2.3.0", "minimatch": "^7.4.6", "nested-property": "^4.0.0", + "node-fetch": "^3.3.2", "path-posix": "^1.0.0", "url-join": "^5.0.0", "url-parse": "^1.5.10" @@ -87,7 +88,7 @@ "@types/chai": "^4.3.12", "@types/he": "^1.2.3", "@types/mocha": "^10.0.6", - "@types/node": "^20.11.28", + "@types/node": "^20.12.7", "@types/sinon": "^17.0.3", "@types/url-parse": "^1.4.11", "babel-loader": "^9.1.3", @@ -112,7 +113,6 @@ "mkdirp": "^1.0.4", "mocha": "^10.3.0", "nock": "^13.5.4", - "node-fetch": "^3.3.0", "nodemon": "^3.1.0", "npm-run-all": "^4.1.5", "prettier": "^3.2.5", @@ -121,7 +121,7 @@ "rimraf": "^5.0.5", "sinon": "^17.0.1", "ts-node": "^10.9.2", - "typescript": "^5.4.2", + "typescript": "^5.4.5", "wait-on": "^6.0.1", "webdav-server": "^2.6.2", "webpack": "^5.90.3", diff --git a/source/operations/copyFile.ts b/source/operations/copyFile.ts index 22f2664d..a116325c 100644 --- a/source/operations/copyFile.ts +++ b/source/operations/copyFile.ts @@ -2,7 +2,7 @@ import { joinURL } from "../tools/url.js"; import { encodePath } from "../tools/path.js"; import { request, prepareRequestOptions } from "../request.js"; import { handleResponseCode } from "../response.js"; -import { CopyFileOptions, WebDAVClientContext, WebDAVMethodOptions } from "../types.js"; +import { CopyFileOptions, WebDAVClientContext } from "../types.js"; export async function copyFile( context: WebDAVClientContext, diff --git a/source/operations/moveFile.ts b/source/operations/moveFile.ts index ae459303..9946fd08 100644 --- a/source/operations/moveFile.ts +++ b/source/operations/moveFile.ts @@ -2,7 +2,7 @@ import { joinURL } from "../tools/url.js"; import { encodePath } from "../tools/path.js"; import { request, prepareRequestOptions } from "../request.js"; import { handleResponseCode } from "../response.js"; -import { MoveFileOptions, WebDAVClientContext, WebDAVMethodOptions } from "../types.js"; +import { MoveFileOptions, WebDAVClientContext } from "../types.js"; export async function moveFile( context: WebDAVClientContext, diff --git a/source/operations/partialUpdateFileContents.ts b/source/operations/partialUpdateFileContents.ts index 2df29c22..eaf2ff74 100644 --- a/source/operations/partialUpdateFileContents.ts +++ b/source/operations/partialUpdateFileContents.ts @@ -1,4 +1,4 @@ -import { Readable } from "node:stream"; +import { Readable } from "stream"; import { Layerr } from "layerr"; import { joinURL } from "../tools/url.js"; import { encodePath } from "../tools/path.js"; @@ -10,8 +10,7 @@ import { ErrorCode, Headers, WebDAVMethodOptions, - WebDAVClientContext, - WebDAVClientError + WebDAVClientContext } from "../types.js"; export async function partialUpdateFileContents( diff --git a/source/tools/dav.ts b/source/tools/dav.ts index 7b3357c3..55fefcd6 100644 --- a/source/tools/dav.ts +++ b/source/tools/dav.ts @@ -28,10 +28,8 @@ function getParser(): XMLParser { hex: true, leadingZeros: false } - // // We don't use the processors here as decoding is done manually - // // later on - decoding early would break some path checks. - // attributeValueProcessor: val => decodeHTMLEntities(decodeURIComponent(val)), - // tagValueProcessor: val => decodeHTMLEntities(decodeURIComponent(val)) + // We don't use the processors here as decoding is done manually + // later on - decoding early would break some path checks. }); } diff --git a/util/node-fetch.stub.ts b/util/node-fetch.stub.ts index 2d1ec238..30c210c0 100644 --- a/util/node-fetch.stub.ts +++ b/util/node-fetch.stub.ts @@ -1 +1,2 @@ +export { Headers, Request, Response } from "node-fetch"; export default () => {}; diff --git a/webpack.config.cjs b/webpack.config.cjs index c6564e1a..16cf0d4c 100644 --- a/webpack.config.cjs +++ b/webpack.config.cjs @@ -20,17 +20,15 @@ function getBasicConfig() { loader: "babel-loader", options: { presets: [ - ["@babel/preset-env", { - targets: [ - "> 0.25%, not dead", - "maintained node versions" - ] - }], + [ + "@babel/preset-env", + { + targets: ["> 0.25%, not dead", "maintained node versions"] + } + ], "@babel/preset-typescript" ], - plugins: [ - "babel-plugin-transform-async-to-promises" - ] + plugins: ["babel-plugin-transform-async-to-promises"] }, resolve: { fullySpecified: false @@ -52,7 +50,8 @@ function getBasicConfig() { resolve: { alias: { - "http": path.resolve(__dirname, "./util/http.stub.ts"), + // http: path.resolve(__dirname, "./util/http.stub.ts"), + // https: path.resolve(__dirname, "./util/http.stub.ts") "node-fetch": path.resolve(__dirname, "./util/node-fetch.stub.ts") }, extensions: [".js"], @@ -89,7 +88,7 @@ module.exports = [ resolve: { alias: { - "he": path.resolve(__dirname, "./util/he.stub.ts") + he: path.resolve(__dirname, "./util/he.stub.ts") }, plugins: [ // Handle .ts => .js resolution @@ -102,9 +101,12 @@ module.exports = [ merge(getBasicConfig(), { entry: path.resolve(__dirname, "./source/index.ts"), + externals: ["he"], + output: { filename: "index.js", - path: path.resolve(__dirname, "./dist/react-native") + path: path.resolve(__dirname, "./dist/react-native"), + chunkFormat: "commonjs" }, plugins: [ @@ -120,6 +122,6 @@ module.exports = [ ] }, - target: "web" - }), + target: "node" + }) ];