diff --git a/package.json b/package.json index 5444bf0..4053536 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "dependencies": { "@vap/core": "0.0.12", "@vap/shiki": "0.10.5", - "eslint-plugin-simple-header": "^1.0.1", + "eslint-plugin-simple-header": "^1.0.2", "fflate": "^0.7.4", "nanoid": "^4.0.2", "virtual-merge": "^1.0.1" @@ -50,7 +50,7 @@ "diff": "^5.1.0", "discord-types": "^1.3.26", "esbuild": "^0.15.18", - "eslint": "^8.28.0", + "eslint": "^8.46.0", "eslint-import-resolver-alias": "^1.1.2", "eslint-plugin-path-alias": "^1.0.0", "eslint-plugin-simple-import-sort": "^10.0.0", @@ -69,8 +69,7 @@ "pnpm": { "patchedDependencies": { "eslint-plugin-path-alias@1.0.0": "patches/eslint-plugin-path-alias@1.0.0.patch", - "eslint@8.28.0": "patches/eslint@8.28.0.patch", - "eslint-plugin-simple-header@1.0.1": "patches/eslint-plugin-simple-header@1.0.1.patch" + "eslint@8.46.0": "patches/eslint@8.46.0.patch" }, "peerDependencyRules": { "ignoreMissing": [ diff --git a/patches/eslint-plugin-simple-header@1.0.1.patch b/patches/eslint-plugin-simple-header@1.0.1.patch deleted file mode 100644 index bb82fb1..0000000 --- a/patches/eslint-plugin-simple-header@1.0.1.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/src/index.js b/src/index.js -index e8a8ee34fbafe310c75e752d59ba3a56109d67f1..6aecfe40f863823c8b115bca00537fcd78934137 100644 ---- a/src/index.js -+++ b/src/index.js -@@ -95,7 +95,7 @@ function create(ctx) { - ?? [Array.isArray(options.text) ? options.text.join("\n") : options.text]; - - /** @type {string} */ -- const src = ctx.sourceCode.getText(); -+ const src = ctx.getSourceCode().getText(); - const srcHeader = findHeader(src, syntax); - const headers = rawHeaders.map((raw) => makeComment(raw, syntax, decor)); - const trailingLines = "\n".repeat(src.slice(srcHeader.length).trim() ? 1 + newlines : 1); \ No newline at end of file diff --git a/patches/eslint@8.28.0.patch b/patches/eslint@8.46.0.patch similarity index 50% rename from patches/eslint@8.28.0.patch rename to patches/eslint@8.46.0.patch index 994481b..c91e45d 100644 --- a/patches/eslint@8.28.0.patch +++ b/patches/eslint@8.46.0.patch @@ -1,11 +1,11 @@ diff --git a/lib/rules/no-useless-escape.js b/lib/rules/no-useless-escape.js -index 2046a148a17fd1d5f3a4bbc9f45f7700259d11fa..f4898c6b57355a4fd72c43a9f32bf1a36a6ccf4a 100644 +index 0e0f6f09f2c35f3276173c08f832cde9f2cf56a0..7dc22851715f3574d935f513c1b5e35552985711 100644 --- a/lib/rules/no-useless-escape.js +++ b/lib/rules/no-useless-escape.js -@@ -97,12 +97,30 @@ module.exports = { +@@ -65,13 +65,31 @@ module.exports = { escapeBackslash: "Replace the `\\` with `\\\\` to include the actual backslash character." }, - + - schema: [] + schema: [{ + type: "object", @@ -22,24 +22,28 @@ index 2046a148a17fd1d5f3a4bbc9f45f7700259d11fa..f4898c6b57355a4fd72c43a9f32bf1a3 + additionalProperties: false + }] }, - + create(context) { + const options = context.options[0] || {}; -+ const { extra, extraCharClass } = options || '' - const sourceCode = context.getSourceCode(); - -+ const NON_CHARCLASS_ESCAPES = union(REGEX_NON_CHARCLASS_ESCAPES, new Set(extra)) -+ const CHARCLASS_ESCAPES = union(REGEX_GENERAL_ESCAPES, new Set(extraCharClass)) ++ const { extra, extraCharClass } = options; + const sourceCode = context.sourceCode; + const parser = new RegExpParser(); + ++ const NON_CHARCLASS_ESCAPES = union(REGEX_NON_CHARCLASS_ESCAPES, new Set(extra)); ++ const CHARCLASS_ESCAPES = union(REGEX_GENERAL_ESCAPES, new Set(extraCharClass)); + /** * Reports a node * @param {ASTNode} node The node to report -@@ -238,7 +256,7 @@ module.exports = { - .filter(charInfo => charInfo.escaped) - - // Filter out characters that are valid to escape, based on their position in the regular expression. -- .filter(charInfo => !(charInfo.inCharClass ? REGEX_GENERAL_ESCAPES : REGEX_NON_CHARCLASS_ESCAPES).has(charInfo.text)) -+ .filter(charInfo => !(charInfo.inCharClass ? CHARCLASS_ESCAPES : NON_CHARCLASS_ESCAPES).has(charInfo.text)) - - // Report all the remaining characters. - .forEach(charInfo => report(node, charInfo.index, charInfo.text)); \ No newline at end of file +@@ -200,9 +218,9 @@ module.exports = { + let allowedEscapes; + + if (characterClassStack.length) { +- allowedEscapes = unicodeSets ? REGEX_CLASSSET_CHARACTER_ESCAPES : REGEX_GENERAL_ESCAPES; ++ allowedEscapes = unicodeSets ? REGEX_CLASSSET_CHARACTER_ESCAPES : CHARCLASS_ESCAPES; + } else { +- allowedEscapes = REGEX_NON_CHARCLASS_ESCAPES; ++ allowedEscapes = NON_CHARCLASS_ESCAPES; + } + if (allowedEscapes.has(escapedChar)) { + return; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8523f7b..1a3c659 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,19 +1,12 @@ lockfileVersion: '6.0' -settings: - autoInstallPeers: true - excludeLinksFromLockfile: false - patchedDependencies: eslint-plugin-path-alias@1.0.0: hash: m6sma4g6bh67km3q6igf6uxaja path: patches/eslint-plugin-path-alias@1.0.0.patch - eslint-plugin-simple-header@1.0.1: - hash: ej6cxkrs2np2767qe2tatjdt54 - path: patches/eslint-plugin-simple-header@1.0.1.patch - eslint@8.28.0: - hash: 7wc6icvgtg3uswirb5tpsbjnbe - path: patches/eslint@8.28.0.patch + eslint@8.46.0: + hash: xm46kqcmdgzlmm4aifkfpxaho4 + path: patches/eslint@8.46.0.patch dependencies: '@vap/core': @@ -23,8 +16,8 @@ dependencies: specifier: 0.10.5 version: 0.10.5 eslint-plugin-simple-header: - specifier: ^1.0.1 - version: 1.0.1(patch_hash=ej6cxkrs2np2767qe2tatjdt54) + specifier: ^1.0.2 + version: 1.0.2 fflate: specifier: ^0.7.4 version: 0.7.4 @@ -56,10 +49,10 @@ devDependencies: version: 2.4.2 '@typescript-eslint/eslint-plugin': specifier: ^5.59.1 - version: 5.59.1(@typescript-eslint/parser@5.59.1)(eslint@8.28.0)(typescript@5.0.4) + version: 5.59.1(@typescript-eslint/parser@5.59.1)(eslint@8.46.0)(typescript@5.0.4) '@typescript-eslint/parser': specifier: ^5.59.1 - version: 5.59.1(eslint@8.28.0)(typescript@5.0.4) + version: 5.59.1(eslint@8.46.0)(typescript@5.0.4) diff: specifier: ^5.1.0 version: 5.1.0 @@ -70,20 +63,20 @@ devDependencies: specifier: ^0.15.18 version: 0.15.18 eslint: - specifier: ^8.28.0 - version: 8.28.0(patch_hash=7wc6icvgtg3uswirb5tpsbjnbe) + specifier: ^8.46.0 + version: 8.46.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4) eslint-import-resolver-alias: specifier: ^1.1.2 version: 1.1.2 eslint-plugin-path-alias: specifier: ^1.0.0 - version: 1.0.0(patch_hash=m6sma4g6bh67km3q6igf6uxaja)(eslint@8.28.0) + version: 1.0.0(patch_hash=m6sma4g6bh67km3q6igf6uxaja)(eslint@8.46.0) eslint-plugin-simple-import-sort: specifier: ^10.0.0 - version: 10.0.0(eslint@8.28.0) + version: 10.0.0(eslint@8.46.0) eslint-plugin-unused-imports: specifier: ^2.0.0 - version: 2.0.0(@typescript-eslint/eslint-plugin@5.59.1)(eslint@8.28.0) + version: 2.0.0(@typescript-eslint/eslint-plugin@5.59.1)(eslint@8.46.0) highlight.js: specifier: 10.6.0 version: 10.6.0 @@ -114,6 +107,11 @@ devDependencies: packages: + /@aashutoshrathi/word-wrap@1.2.6: + resolution: {integrity: sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA==} + engines: {node: '>=0.10.0'} + dev: true + /@babel/code-frame@7.21.4: resolution: {integrity: sha512-LYvhNKfwWSPpocw8GI7gpK2nq3HSDuEPC/uSYaALSJu9xjsalaaYFOq0Pwt5KmVqwEbZlDu81aLXwBOmD/Fv9g==} engines: {node: '>=6.9.0'} @@ -406,7 +404,7 @@ packages: dev: true optional: true - /@eslint-community/eslint-utils@4.4.0(eslint@8.28.0): + /@eslint-community/eslint-utils@4.4.0(eslint@8.46.0): resolution: {integrity: sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -415,8 +413,8 @@ packages: eslint: optional: true dependencies: - eslint: 8.28.0(patch_hash=7wc6icvgtg3uswirb5tpsbjnbe) - eslint-visitor-keys: 3.4.0 + eslint: 8.46.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4) + eslint-visitor-keys: 3.4.2 dev: true /@eslint-community/regexpp@4.5.1: @@ -424,15 +422,20 @@ packages: engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0} dev: true - /@eslint/eslintrc@1.3.3: - resolution: {integrity: sha512-uj3pT6Mg+3t39fvLrj8iuCIJ38zKO9FpGtJ4BBJebJhEwjoT+KLVNCcHT5QC9NGRIEi7fZ0ZR8YRb884auB4Lg==} + /@eslint-community/regexpp@4.6.2: + resolution: {integrity: sha512-pPTNuaAG3QMH+buKyBIGJs3g/S5y0caxw0ygM3YyE6yJFySwiGGSzA+mM3KJ8QQvzeLh3blwgSonkFjgQdxzMw==} + engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0} + dev: true + + /@eslint/eslintrc@2.1.1: + resolution: {integrity: sha512-9t7ZA7NGGK8ckelF0PQCfcxIUzs1Md5rrO6U/c+FIQNanea5UZC0wqKXH4vHBccmu4ZJgZ2idtPeW7+Q2npOEA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: ajv: 6.12.6 debug: 4.3.4 - espree: 9.4.1 - globals: 13.17.0 - ignore: 5.2.0 + espree: 9.6.1 + globals: 13.20.0 + ignore: 5.2.4 import-fresh: 3.3.0 js-yaml: 4.1.0 minimatch: 3.1.2 @@ -441,8 +444,13 @@ packages: - supports-color dev: true - /@humanwhocodes/config-array@0.11.7: - resolution: {integrity: sha512-kBbPWzN8oVMLb0hOUYXhmxggL/1cJE6ydvjDIGi9EnAGUyA7cLVKQg+d/Dsm+KZwx2czGHrCmMVLiyg8s5JPKw==} + /@eslint/js@8.46.0: + resolution: {integrity: sha512-a8TLtmPi8xzPkCbp/OGFUo5yhRkHM2Ko9kOWP4znJr0WAhWyThaw3PnwX4vOTWOAMsV2uRt32PPDcEz63esSaA==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + dev: true + + /@humanwhocodes/config-array@0.11.10: + resolution: {integrity: sha512-KVVjQmNUepDVGXNuoRRdmmEjruj0KfiGSbS8LVc12LMsWDQzRXJ0qdhN8L8uUigKpfEHRhlaQFY0ib1tnUbNeQ==} engines: {node: '>=10.10.0'} dependencies: '@humanwhocodes/object-schema': 1.2.1 @@ -576,7 +584,7 @@ packages: '@types/node': 18.16.3 dev: true - /@typescript-eslint/eslint-plugin@5.59.1(@typescript-eslint/parser@5.59.1)(eslint@8.28.0)(typescript@5.0.4): + /@typescript-eslint/eslint-plugin@5.59.1(@typescript-eslint/parser@5.59.1)(eslint@8.46.0)(typescript@5.0.4): resolution: {integrity: sha512-AVi0uazY5quFB9hlp2Xv+ogpfpk77xzsgsIEWyVS7uK/c7MZ5tw7ZPbapa0SbfkqE0fsAMkz5UwtgMLVk2BQAg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -590,12 +598,12 @@ packages: optional: true dependencies: '@eslint-community/regexpp': 4.5.1 - '@typescript-eslint/parser': 5.59.1(eslint@8.28.0)(typescript@5.0.4) + '@typescript-eslint/parser': 5.59.1(eslint@8.46.0)(typescript@5.0.4) '@typescript-eslint/scope-manager': 5.59.1 - '@typescript-eslint/type-utils': 5.59.1(eslint@8.28.0)(typescript@5.0.4) - '@typescript-eslint/utils': 5.59.1(eslint@8.28.0)(typescript@5.0.4) + '@typescript-eslint/type-utils': 5.59.1(eslint@8.46.0)(typescript@5.0.4) + '@typescript-eslint/utils': 5.59.1(eslint@8.46.0)(typescript@5.0.4) debug: 4.3.4 - eslint: 8.28.0(patch_hash=7wc6icvgtg3uswirb5tpsbjnbe) + eslint: 8.46.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4) grapheme-splitter: 1.0.4 ignore: 5.2.4 natural-compare-lite: 1.4.0 @@ -606,7 +614,7 @@ packages: - supports-color dev: true - /@typescript-eslint/parser@5.59.1(eslint@8.28.0)(typescript@5.0.4): + /@typescript-eslint/parser@5.59.1(eslint@8.46.0)(typescript@5.0.4): resolution: {integrity: sha512-nzjFAN8WEu6yPRDizIFyzAfgK7nybPodMNFGNH0M9tei2gYnYszRDqVA0xlnRjkl7Hkx2vYrEdb6fP2a21cG1g==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -622,7 +630,7 @@ packages: '@typescript-eslint/types': 5.59.1 '@typescript-eslint/typescript-estree': 5.59.1(typescript@5.0.4) debug: 4.3.4 - eslint: 8.28.0(patch_hash=7wc6icvgtg3uswirb5tpsbjnbe) + eslint: 8.46.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4) typescript: 5.0.4 transitivePeerDependencies: - supports-color @@ -636,7 +644,7 @@ packages: '@typescript-eslint/visitor-keys': 5.59.1 dev: true - /@typescript-eslint/type-utils@5.59.1(eslint@8.28.0)(typescript@5.0.4): + /@typescript-eslint/type-utils@5.59.1(eslint@8.46.0)(typescript@5.0.4): resolution: {integrity: sha512-ZMWQ+Oh82jWqWzvM3xU+9y5U7MEMVv6GLioM3R5NJk6uvP47kZ7YvlgSHJ7ERD6bOY7Q4uxWm25c76HKEwIjZw==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -649,9 +657,9 @@ packages: optional: true dependencies: '@typescript-eslint/typescript-estree': 5.59.1(typescript@5.0.4) - '@typescript-eslint/utils': 5.59.1(eslint@8.28.0)(typescript@5.0.4) + '@typescript-eslint/utils': 5.59.1(eslint@8.46.0)(typescript@5.0.4) debug: 4.3.4 - eslint: 8.28.0(patch_hash=7wc6icvgtg3uswirb5tpsbjnbe) + eslint: 8.46.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4) tsutils: 3.21.0(typescript@5.0.4) typescript: 5.0.4 transitivePeerDependencies: @@ -684,7 +692,7 @@ packages: - supports-color dev: true - /@typescript-eslint/utils@5.59.1(eslint@8.28.0)(typescript@5.0.4): + /@typescript-eslint/utils@5.59.1(eslint@8.46.0)(typescript@5.0.4): resolution: {integrity: sha512-MkTe7FE+K1/GxZkP5gRj3rCztg45bEhsd8HYjczBuYm+qFHP5vtZmjx3B0yUCDotceQ4sHgTyz60Ycl225njmA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -693,13 +701,13 @@ packages: eslint: optional: true dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@8.28.0) + '@eslint-community/eslint-utils': 4.4.0(eslint@8.46.0) '@types/json-schema': 7.0.11 '@types/semver': 7.3.13 '@typescript-eslint/scope-manager': 5.59.1 '@typescript-eslint/types': 5.59.1 '@typescript-eslint/typescript-estree': 5.59.1(typescript@5.0.4) - eslint: 8.28.0(patch_hash=7wc6icvgtg3uswirb5tpsbjnbe) + eslint: 8.46.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4) eslint-scope: 5.1.1 semver: 7.5.0 transitivePeerDependencies: @@ -729,16 +737,16 @@ packages: vscode-textmate: 5.2.0 dev: false - /acorn-jsx@5.3.2(acorn@8.8.0): + /acorn-jsx@5.3.2(acorn@8.10.0): resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==} peerDependencies: acorn: ^6.0.0 || ^7.0.0 || ^8.0.0 dependencies: - acorn: 8.8.0 + acorn: 8.10.0 dev: true - /acorn@8.8.0: - resolution: {integrity: sha512-QOxyigPVrpZ2GXT+PFyZTl6TtOFc5egxHIP9IlQ+RbupQuX4RkT/Bee4/kQuC02Xkzg84JcT7oLYtDIQxp+v7w==} + /acorn@8.10.0: + resolution: {integrity: sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==} engines: {node: '>=0.4.0'} hasBin: true dev: true @@ -1453,7 +1461,7 @@ packages: optional: true dev: true - /eslint-plugin-path-alias@1.0.0(patch_hash=m6sma4g6bh67km3q6igf6uxaja)(eslint@8.28.0): + /eslint-plugin-path-alias@1.0.0(patch_hash=m6sma4g6bh67km3q6igf6uxaja)(eslint@8.46.0): resolution: {integrity: sha512-FXus57yC+Zd3sMv46pbloXYwFeNVNHJqlACr9V68FG/IzGFBBokGJpmjDbEjpt8ZCeVSndUubeDWWl2A8sCNVQ==} peerDependencies: eslint: ^7 @@ -1461,19 +1469,18 @@ packages: eslint: optional: true dependencies: - eslint: 8.28.0(patch_hash=7wc6icvgtg3uswirb5tpsbjnbe) + eslint: 8.46.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4) nanomatch: 1.2.13 transitivePeerDependencies: - supports-color dev: true patched: true - /eslint-plugin-simple-header@1.0.1(patch_hash=ej6cxkrs2np2767qe2tatjdt54): - resolution: {integrity: sha512-vpTMgF7bOIflnczDmbfTKtYhjTsPLTTjv/whkh1rXtu4Jp2NtvJr57gJB8QOzNjXyh34/D/LA2NY7tZsebKoZg==} + /eslint-plugin-simple-header@1.0.2: + resolution: {integrity: sha512-K1EJ/ueBIjPRA8qR44Ymo+GDmPYYmfoODtainGxVr7PSbX6QiaY+pTuGCrOhO+AtVsYJs8GLSVdGUTXyAxAtOA==} dev: false - patched: true - /eslint-plugin-simple-import-sort@10.0.0(eslint@8.28.0): + /eslint-plugin-simple-import-sort@10.0.0(eslint@8.46.0): resolution: {integrity: sha512-AeTvO9UCMSNzIHRkg8S6c3RPy5YEwKWSQPx3DYghLedo2ZQxowPFLGDN1AZ2evfg6r6mjBSZSLxLFsWSu3acsw==} peerDependencies: eslint: '>=5.0.0' @@ -1481,10 +1488,10 @@ packages: eslint: optional: true dependencies: - eslint: 8.28.0(patch_hash=7wc6icvgtg3uswirb5tpsbjnbe) + eslint: 8.46.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4) dev: true - /eslint-plugin-unused-imports@2.0.0(@typescript-eslint/eslint-plugin@5.59.1)(eslint@8.28.0): + /eslint-plugin-unused-imports@2.0.0(@typescript-eslint/eslint-plugin@5.59.1)(eslint@8.46.0): resolution: {integrity: sha512-3APeS/tQlTrFa167ThtP0Zm0vctjr4M44HMpeg1P4bK6wItarumq0Ma82xorMKdFsWpphQBlRPzw/pxiVELX1A==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -1496,8 +1503,8 @@ packages: eslint: optional: true dependencies: - '@typescript-eslint/eslint-plugin': 5.59.1(@typescript-eslint/parser@5.59.1)(eslint@8.28.0)(typescript@5.0.4) - eslint: 8.28.0(patch_hash=7wc6icvgtg3uswirb5tpsbjnbe) + '@typescript-eslint/eslint-plugin': 5.59.1(@typescript-eslint/parser@5.59.1)(eslint@8.46.0)(typescript@5.0.4) + eslint: 8.46.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4) eslint-rule-composer: 0.3.0 dev: true @@ -1514,49 +1521,34 @@ packages: estraverse: 4.3.0 dev: true - /eslint-scope@7.1.1: - resolution: {integrity: sha512-QKQM/UXpIiHcLqJ5AOyIW7XZmzjkzQXYE54n1++wb0u9V/abW3l9uQnxX8Z5Xd18xyKIMTUAyQ0k1e8pz6LUrw==} + /eslint-scope@7.2.2: + resolution: {integrity: sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: esrecurse: 4.3.0 estraverse: 5.3.0 dev: true - /eslint-utils@3.0.0(eslint@8.28.0): - resolution: {integrity: sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==} - engines: {node: ^10.0.0 || ^12.0.0 || >= 14.0.0} - peerDependencies: - eslint: '>=5' - peerDependenciesMeta: - eslint: - optional: true - dependencies: - eslint: 8.28.0(patch_hash=7wc6icvgtg3uswirb5tpsbjnbe) - eslint-visitor-keys: 2.1.0 - dev: true - - /eslint-visitor-keys@2.1.0: - resolution: {integrity: sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==} - engines: {node: '>=10'} - dev: true - - /eslint-visitor-keys@3.3.0: - resolution: {integrity: sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA==} + /eslint-visitor-keys@3.4.0: + resolution: {integrity: sha512-HPpKPUBQcAsZOsHAFwTtIKcYlCje62XB7SEAcxjtmW6TD1WVpkS6i6/hOVtTZIl4zGj/mBqpFVGvaDneik+VoQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true - /eslint-visitor-keys@3.4.0: - resolution: {integrity: sha512-HPpKPUBQcAsZOsHAFwTtIKcYlCje62XB7SEAcxjtmW6TD1WVpkS6i6/hOVtTZIl4zGj/mBqpFVGvaDneik+VoQ==} + /eslint-visitor-keys@3.4.2: + resolution: {integrity: sha512-8drBzUEyZ2llkpCA67iYrgEssKDUu68V8ChqqOfFupIaG/LCVPUT+CoGJpT77zJprs4T/W7p07LP7zAIMuweVw==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true - /eslint@8.28.0(patch_hash=7wc6icvgtg3uswirb5tpsbjnbe): - resolution: {integrity: sha512-S27Di+EVyMxcHiwDrFzk8dJYAaD+/5SoWKxL1ri/71CRHsnJnRDPNt2Kzj24+MT9FDupf4aqqyqPrvI8MvQ4VQ==} + /eslint@8.46.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4): + resolution: {integrity: sha512-cIO74PvbW0qU8e0mIvk5IV3ToWdCq5FYG6gWPHHkx6gNdjlbAYvtfHmlCMXxjcoVaIdwy/IAt3+mDkZkfvb2Dg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} hasBin: true dependencies: - '@eslint/eslintrc': 1.3.3 - '@humanwhocodes/config-array': 0.11.7 + '@eslint-community/eslint-utils': 4.4.0(eslint@8.46.0) + '@eslint-community/regexpp': 4.6.2 + '@eslint/eslintrc': 2.1.1 + '@eslint/js': 8.46.0 + '@humanwhocodes/config-array': 0.11.10 '@humanwhocodes/module-importer': 1.0.1 '@nodelib/fs.walk': 1.2.8 ajv: 6.12.6 @@ -1565,60 +1557,46 @@ packages: debug: 4.3.4 doctrine: 3.0.0 escape-string-regexp: 4.0.0 - eslint-scope: 7.1.1 - eslint-utils: 3.0.0(eslint@8.28.0) - eslint-visitor-keys: 3.3.0 - espree: 9.4.0 - esquery: 1.4.0 + eslint-scope: 7.2.2 + eslint-visitor-keys: 3.4.2 + espree: 9.6.1 + esquery: 1.5.0 esutils: 2.0.3 fast-deep-equal: 3.1.3 file-entry-cache: 6.0.1 find-up: 5.0.0 glob-parent: 6.0.2 - globals: 13.17.0 - grapheme-splitter: 1.0.4 - ignore: 5.2.0 - import-fresh: 3.3.0 + globals: 13.20.0 + graphemer: 1.4.0 + ignore: 5.2.4 imurmurhash: 0.1.4 is-glob: 4.0.3 is-path-inside: 3.0.3 - js-sdsl: 4.1.5 js-yaml: 4.1.0 json-stable-stringify-without-jsonify: 1.0.1 levn: 0.4.1 lodash.merge: 4.6.2 minimatch: 3.1.2 natural-compare: 1.4.0 - optionator: 0.9.1 - regexpp: 3.2.0 + optionator: 0.9.3 strip-ansi: 6.0.1 - strip-json-comments: 3.1.1 text-table: 0.2.0 transitivePeerDependencies: - supports-color dev: true patched: true - /espree@9.4.0: - resolution: {integrity: sha512-DQmnRpLj7f6TgN/NYb0MTzJXL+vJF9h3pHy4JhCIs3zwcgez8xmGg3sXHcEO97BrmO2OSvCwMdfdlyl+E9KjOw==} + /espree@9.6.1: + resolution: {integrity: sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: - acorn: 8.8.0 - acorn-jsx: 5.3.2(acorn@8.8.0) - eslint-visitor-keys: 3.3.0 + acorn: 8.10.0 + acorn-jsx: 5.3.2(acorn@8.10.0) + eslint-visitor-keys: 3.4.2 dev: true - /espree@9.4.1: - resolution: {integrity: sha512-XwctdmTO6SIvCzd9810yyNzIrOrqNYV9Koizx4C/mRhf9uq0o4yHoCEU/670pOxOL/MSraektvSAji79kX90Vg==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - dependencies: - acorn: 8.8.0 - acorn-jsx: 5.3.2(acorn@8.8.0) - eslint-visitor-keys: 3.3.0 - dev: true - - /esquery@1.4.0: - resolution: {integrity: sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==} + /esquery@1.5.0: + resolution: {integrity: sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==} engines: {node: '>=0.10'} dependencies: estraverse: 5.3.0 @@ -1859,8 +1837,8 @@ packages: which: 1.3.1 dev: true - /globals@13.17.0: - resolution: {integrity: sha512-1C+6nQRb1GwGMKm2dH/E7enFAMxGTmGI7/dEdhy/DNelv85w9B72t3uc5frtMNXIbzrarJJ/lTCjcaZwbLJmyw==} + /globals@13.20.0: + resolution: {integrity: sha512-Qg5QtVkCy/kv3FUSlu4ukeZDVf9ee0iXLAUYX13gbR17bnejFTzr4iS9bY7kwCf1NztRNm1t91fjOiyx4CSwPQ==} engines: {node: '>=8'} dependencies: type-fest: 0.20.2 @@ -1886,6 +1864,10 @@ packages: resolution: {integrity: sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==} dev: true + /graphemer@1.4.0: + resolution: {integrity: sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==} + dev: true + /hard-rejection@2.1.0: resolution: {integrity: sha512-VIZB+ibDhx7ObhAe7OVtoEbuP4h/MuOTHJ+J8h/eBXotJYl0fBgR72xDFCKgIh22OJZIOVNxBMWuhAr10r8HdA==} engines: {node: '>=6'} @@ -1973,11 +1955,6 @@ packages: resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==} dev: true - /ignore@5.2.0: - resolution: {integrity: sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==} - engines: {node: '>= 4'} - dev: true - /ignore@5.2.4: resolution: {integrity: sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==} engines: {node: '>= 4'} @@ -2169,10 +2146,6 @@ packages: engines: {node: '>=0.10.0'} dev: true - /js-sdsl@4.1.5: - resolution: {integrity: sha512-08bOAKweV2NUC1wqTtf3qZlnpOX/R2DU9ikpjOHs0H+ibQv3zpncVQg6um4uYtRtrwIX8M4Nh3ytK4HGlYAq7Q==} - dev: true - /js-tokens@4.0.0: resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} dev: true @@ -2486,16 +2459,16 @@ packages: wrappy: 1.0.2 dev: true - /optionator@0.9.1: - resolution: {integrity: sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==} + /optionator@0.9.3: + resolution: {integrity: sha512-JjCoypp+jKn1ttEFExxhetCKeJt9zhAgAve5FXHixTvFDW/5aEktX9bufBKLRRMdU7bNtpLfcGu94B3cdEJgjg==} engines: {node: '>= 0.8.0'} dependencies: + '@aashutoshrathi/word-wrap': 1.2.6 deep-is: 0.1.4 fast-levenshtein: 2.0.6 levn: 0.4.1 prelude-ls: 1.2.1 type-check: 0.4.0 - word-wrap: 1.2.3 dev: true /p-limit@2.3.0: @@ -2735,11 +2708,6 @@ packages: safe-regex: 1.1.0 dev: true - /regexpp@3.2.0: - resolution: {integrity: sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==} - engines: {node: '>=8'} - dev: true - /require-directory@2.1.1: resolution: {integrity: sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==} engines: {node: '>=0.10.0'} @@ -3324,11 +3292,6 @@ packages: isexe: 2.0.0 dev: true - /word-wrap@1.2.3: - resolution: {integrity: sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==} - engines: {node: '>=0.10.0'} - dev: true - /wrap-ansi@7.0.0: resolution: {integrity: sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==} engines: {node: '>=10'} @@ -3406,3 +3369,7 @@ packages: resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} engines: {node: '>=10'} dev: true + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false diff --git a/scripts/build/build.mjs b/scripts/build/build.mjs index e37feb5..59056b1 100755 --- a/scripts/build/build.mjs +++ b/scripts/build/build.mjs @@ -40,8 +40,6 @@ const nodeCommonOpts = { format: "cjs", platform: "node", target: ["esnext"], - minify: true, - bundle: true, external: ["electron", ...commonOpts.external], define: defines, }; @@ -50,16 +48,7 @@ const sourceMapFooter = s => watch ? "" : `//# sourceMappingURL=vencord://${s}.j const sourcemap = watch ? "inline" : "external"; await Promise.all([ - // common preload - esbuild.build({ - ...nodeCommonOpts, - entryPoints: ["src/preload.ts"], - outfile: "dist/preload.js", - footer: { js: "//# sourceURL=VencordPreload\n" + sourceMapFooter("preload") }, - sourcemap, - }), - - // Discord Desktop main & renderer + // Discord Desktop main & renderer & preload esbuild.build({ ...nodeCommonOpts, entryPoints: ["src/main/index.ts"], @@ -92,8 +81,20 @@ await Promise.all([ IS_VENCORD_DESKTOP: false } }), + esbuild.build({ + ...nodeCommonOpts, + entryPoints: ["src/preload.ts"], + outfile: "dist/preload.js", + footer: { js: "//# sourceURL=VencordPreload\n" + sourceMapFooter("preload") }, + sourcemap, + define: { + ...defines, + IS_DISCORD_DESKTOP: true, + IS_VENCORD_DESKTOP: false + } + }), - // Vencord Desktop main & renderer + // Vencord Desktop main & renderer & preload esbuild.build({ ...nodeCommonOpts, entryPoints: ["src/main/index.ts"], @@ -126,6 +127,18 @@ await Promise.all([ IS_VENCORD_DESKTOP: true } }), + esbuild.build({ + ...nodeCommonOpts, + entryPoints: ["src/preload.ts"], + outfile: "dist/vencordDesktopPreload.js", + footer: { js: "//# sourceURL=VencordPreload\n" + sourceMapFooter("vencordDesktopPreload") }, + sourcemap, + define: { + ...defines, + IS_DISCORD_DESKTOP: false, + IS_VENCORD_DESKTOP: true + } + }), ]).catch(err => { console.error("Build failed"); console.error(err.message); diff --git a/src/main/index.ts b/src/main/index.ts index a8b9429..2e1a10e 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -44,6 +44,7 @@ if (IS_VENCORD_DESKTOP || !IS_VANILLA) { case "renderer.js.map": case "vencordDesktopRenderer.js.map": case "preload.js.map": + case "vencordDesktopPreload.js.map": case "patcher.js.map": case "vencordDesktopMain.js.map": cb(join(__dirname, url)); diff --git a/src/main/ipcMain.ts b/src/main/ipcMain.ts index c86268d..625f24f 100644 --- a/src/main/ipcMain.ts +++ b/src/main/ipcMain.ts @@ -138,7 +138,7 @@ ipcMain.handle(IpcEvents.OPEN_MONACO_EDITOR, async () => { autoHideMenuBar: true, darkTheme: true, webPreferences: { - preload: join(__dirname, "preload.js"), + preload: join(__dirname, IS_DISCORD_DESKTOP ? "preload.js" : "vencordDesktopPreload.js"), contextIsolation: true, nodeIntegration: false, sandbox: false diff --git a/src/main/patcher.ts b/src/main/patcher.ts index 066cb3d..2259b20 100644 --- a/src/main/patcher.ts +++ b/src/main/patcher.ts @@ -71,7 +71,7 @@ if (!IS_VANILLA) { constructor(options: BrowserWindowConstructorOptions) { if (options?.webPreferences?.preload && options.title) { const original = options.webPreferences.preload; - options.webPreferences.preload = join(__dirname, "preload.js"); + options.webPreferences.preload = join(__dirname, IS_DISCORD_DESKTOP ? "preload.js" : "vencordDesktopPreload.js"); options.webPreferences.sandbox = false; if (settings.frameless) { options.frame = false; diff --git a/src/main/updater/common.ts b/src/main/updater/common.ts index 69832d1..41b9837 100644 --- a/src/main/updater/common.ts +++ b/src/main/updater/common.ts @@ -18,9 +18,9 @@ export const VENCORD_FILES = [ IS_DISCORD_DESKTOP ? "patcher.js" : "vencordDesktopMain.js", - "preload.js", + IS_DISCORD_DESKTOP ? "preload.js" : "vencordDesktopPreload.js", IS_DISCORD_DESKTOP ? "renderer.js" : "vencordDesktopRenderer.js", - "renderer.css" + IS_DISCORD_DESKTOP ? "renderer.css" : "vencordDesktopRenderer.css", ]; export function serializeErrors(func: (...args: any[]) => any) { diff --git a/src/preload.ts b/src/preload.ts index 5f6c445..2beaf39 100644 --- a/src/preload.ts +++ b/src/preload.ts @@ -28,7 +28,7 @@ contextBridge.exposeInMainWorld("VencordNative", VencordNative); // Discord if (location.protocol !== "data:") { // #region cssInsert - const rendererCss = join(__dirname, "renderer.css"); + const rendererCss = join(__dirname, IS_VENCORD_DESKTOP ? "vencordDesktopRenderer.css" : "renderer.css"); const style = document.createElement("style"); style.id = "vencord-css-core"; @@ -51,9 +51,9 @@ if (location.protocol !== "data:") { } // #endregion - if (process.env.DISCORD_PRELOAD) { + if (IS_DISCORD_DESKTOP) { webFrame.executeJavaScript(readFileSync(join(__dirname, "renderer.js"), "utf-8")); - require(process.env.DISCORD_PRELOAD); + require(process.env.DISCORD_PRELOAD!); } } // Monaco popout else {