From 31c6fd8e6d4e059682f4721b447b60f7d19396ab Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Thu, 23 Jun 2022 17:30:33 +0800 Subject: [PATCH 01/13] chore: update commonjs plugin to v22 and make build work Well, the built bundle doesn't work yet. Blocked by https://github.com/rollup/plugins/pull/1180 --- packages/vite/LICENSE.md | 362 ++++++++++++++++++++++++++++++++- packages/vite/package.json | 2 +- packages/vite/rollup.config.ts | 5 - pnpm-lock.yaml | 22 +- 4 files changed, 380 insertions(+), 11 deletions(-) diff --git a/packages/vite/LICENSE.md b/packages/vite/LICENSE.md index 9bfb71d673183a..0fb14d41d4c961 100644 --- a/packages/vite/LICENSE.md +++ b/packages/vite/LICENSE.md @@ -25,7 +25,7 @@ SOFTWARE. # Licenses of bundled dependencies The published Vite artifact additionally contains code with the following licenses: -Apache-2.0, BSD-2-Clause, CC0-1.0, ISC, MIT, (BSD-3-Clause OR GPL-2.0) +Apache-2.0, BSD-2-Clause, BSD-3-Clause, CC0-1.0, ISC, MIT, (BSD-3-Clause OR GPL-2.0) # Bundled dependencies: ## @ampproject/remapping @@ -237,6 +237,34 @@ Repository: git+https://github.com/ampproject/remapping.git --------------------------------------- +## @cspotcode/source-map-support +License: MIT +Repository: https://github.com/cspotcode/node-source-map-support + +> The MIT License (MIT) +> +> Copyright (c) 2014 Evan Wallace +> +> Permission is hereby granted, free of charge, to any person obtaining a copy +> of this software and associated documentation files (the "Software"), to deal +> in the Software without restriction, including without limitation the rights +> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +> copies of the Software, and to permit persons to whom the Software is +> furnished to do so, subject to the following conditions: +> +> The above copyright notice and this permission notice shall be included in all +> copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +> SOFTWARE. + +--------------------------------------- + ## @jridgewell/gen-mapping License: MIT By: Justin Ridgewell @@ -559,6 +587,118 @@ Repository: rollup/plugins --------------------------------------- +## @tsconfig/node10 +License: MIT +Repository: https://github.com/tsconfig/bases.git + +> MIT License +> +> Copyright (c) Microsoft Corporation. +> +> Permission is hereby granted, free of charge, to any person obtaining a copy +> of this software and associated documentation files (the "Software"), to deal +> in the Software without restriction, including without limitation the rights +> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +> copies of the Software, and to permit persons to whom the Software is +> furnished to do so, subject to the following conditions: +> +> The above copyright notice and this permission notice shall be included in all +> copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +> SOFTWARE + +--------------------------------------- + +## @tsconfig/node12 +License: MIT +Repository: https://github.com/tsconfig/bases.git + +> MIT License +> +> Copyright (c) Microsoft Corporation. +> +> Permission is hereby granted, free of charge, to any person obtaining a copy +> of this software and associated documentation files (the "Software"), to deal +> in the Software without restriction, including without limitation the rights +> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +> copies of the Software, and to permit persons to whom the Software is +> furnished to do so, subject to the following conditions: +> +> The above copyright notice and this permission notice shall be included in all +> copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +> SOFTWARE + +--------------------------------------- + +## @tsconfig/node14 +License: MIT +Repository: https://github.com/tsconfig/bases.git + +> MIT License +> +> Copyright (c) Microsoft Corporation. +> +> Permission is hereby granted, free of charge, to any person obtaining a copy +> of this software and associated documentation files (the "Software"), to deal +> in the Software without restriction, including without limitation the rights +> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +> copies of the Software, and to permit persons to whom the Software is +> furnished to do so, subject to the following conditions: +> +> The above copyright notice and this permission notice shall be included in all +> copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +> SOFTWARE + +--------------------------------------- + +## @tsconfig/node16 +License: MIT +Repository: https://github.com/tsconfig/bases.git + +> MIT License +> +> Copyright (c) Microsoft Corporation. +> +> Permission is hereby granted, free of charge, to any person obtaining a copy +> of this software and associated documentation files (the "Software"), to deal +> in the Software without restriction, including without limitation the rights +> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +> copies of the Software, and to permit persons to whom the Software is +> furnished to do so, subject to the following conditions: +> +> The above copyright notice and this permission notice shall be included in all +> copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +> SOFTWARE + +--------------------------------------- + ## @vue/compiler-core License: MIT By: Evan You @@ -675,6 +815,35 @@ Repository: https://github.com/acornjs/acorn.git --------------------------------------- +## acorn-walk +License: MIT +By: Marijn Haverbeke, Ingvar Stepanyan, Adrian Heine +Repository: https://github.com/acornjs/acorn.git + +> MIT License +> +> Copyright (C) 2012-2020 by various contributors (see AUTHORS) +> +> Permission is hereby granted, free of charge, to any person obtaining a copy +> of this software and associated documentation files (the "Software"), to deal +> in the Software without restriction, including without limitation the rights +> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +> copies of the Software, and to permit persons to whom the Software is +> furnished to do so, subject to the following conditions: +> +> The above copyright notice and this permission notice shall be included in +> all copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +> THE SOFTWARE. + +--------------------------------------- + ## ansi-regex License: MIT By: Sindre Sorhus @@ -715,6 +884,35 @@ Repository: https://github.com/micromatch/anymatch --------------------------------------- +## arg +License: MIT +By: Josh Junon +Repository: zeit/arg + +> MIT License +> +> Copyright (c) 2017-2019 Zeit, Inc. +> +> Permission is hereby granted, free of charge, to any person obtaining a copy +> of this software and associated documentation files (the "Software"), to deal +> in the Software without restriction, including without limitation the rights +> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +> copies of the Software, and to permit persons to whom the Software is +> furnished to do so, subject to the following conditions: +> +> The above copyright notice and this permission notice shall be included in all +> copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +> SOFTWARE. + +--------------------------------------- + ## balanced-match License: MIT By: Julian Gruber @@ -1058,6 +1256,39 @@ Repository: expressjs/cors --------------------------------------- +## create-require +License: MIT +By: Maël Nison, Paul Soporan, Pooya Parsa +Repository: nuxt-contrib/create-require + +> MIT License +> +> Copyright (c) 2020 +> +> Maël Nison +> Paul Soporan +> Pooya Parsa +> +> Permission is hereby granted, free of charge, to any person obtaining a copy +> of this software and associated documentation files (the "Software"), to deal +> in the Software without restriction, including without limitation the rights +> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +> copies of the Software, and to permit persons to whom the Software is +> furnished to do so, subject to the following conditions: +> +> The above copyright notice and this permission notice shall be included in all +> copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +> SOFTWARE. + +--------------------------------------- + ## cross-spawn License: MIT By: André Cruz @@ -1159,6 +1390,45 @@ Repository: sindresorhus/define-lazy-prop --------------------------------------- +## diff +License: BSD-3-Clause +By: Kevin Decker (http://incaseofstairs.com) +Repository: git://github.com/kpdecker/jsdiff.git + +> Software License Agreement (BSD License) +> +> Copyright (c) 2009-2015, Kevin Decker +> +> All rights reserved. +> +> Redistribution and use of this software in source and binary forms, with or without modification, +> are permitted provided that the following conditions are met: +> +> * Redistributions of source code must retain the above +> copyright notice, this list of conditions and the +> following disclaimer. +> +> * Redistributions in binary form must reproduce the above +> copyright notice, this list of conditions and the +> following disclaimer in the documentation and/or other +> materials provided with the distribution. +> +> * Neither the name of Kevin Decker nor the names of its +> contributors may be used to endorse or promote products +> derived from this software without specific prior +> written permission. +> +> THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR +> IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +> FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +> CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +> DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +> DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +> IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +> OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +--------------------------------------- + ## dotenv License: BSD-2-Clause Repository: git://github.com/motdotla/dotenv.git @@ -2111,6 +2381,19 @@ Repository: https://github.com/rich-harris/magic-string --------------------------------------- +## make-error +License: ISC +By: Julien Fontanet +Repository: git://github.com/JsCommunity/make-error.git + +> Copyright 2014 Julien Fontanet +> +> Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. +> +> THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +--------------------------------------- + ## merge2 License: MIT Repository: git@github.com:teambition/merge2.git @@ -2197,7 +2480,7 @@ Repository: unjs/mlly > MIT License > -> Copyright (c) 2022 UnJS +> Copyright (c) 2021 > > Permission is hereby granted, free of charge, to any person obtaining a copy > of this software and associated documentation files (the "Software"), to deal @@ -3631,6 +3914,35 @@ Repository: lukeed/totalist --------------------------------------- +## ts-node +License: MIT +By: Blake Embrey, Andrew Bradley +Repository: git://github.com/TypeStrong/ts-node.git + +> The MIT License (MIT) +> +> Copyright (c) 2014 Blake Embrey (hello@blakeembrey.com) +> +> Permission is hereby granted, free of charge, to any person obtaining a copy +> of this software and associated documentation files (the "Software"), to deal +> in the Software without restriction, including without limitation the rights +> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +> copies of the Software, and to permit persons to whom the Software is +> furnished to do so, subject to the following conditions: +> +> The above copyright notice and this permission notice shall be included in +> all copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +> THE SOFTWARE. + +--------------------------------------- + ## tsconfck License: MIT By: dominikg @@ -3803,6 +4115,35 @@ Repository: git://github.com/jaredhanson/utils-merge.git --------------------------------------- +## v8-compile-cache-lib +License: MIT +By: Andrew Bradley +Repository: https://github.com/cspotcode/v8-compile-cache-lib.git + +> The MIT License (MIT) +> +> Copyright (c) 2019 Andres Suarez +> +> Permission is hereby granted, free of charge, to any person obtaining a copy +> of this software and associated documentation files (the "Software"), to deal +> in the Software without restriction, including without limitation the rights +> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +> copies of the Software, and to permit persons to whom the Software is +> furnished to do so, subject to the following conditions: +> +> The above copyright notice and this permission notice shall be included in all +> copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +> SOFTWARE. + +--------------------------------------- + ## vary License: MIT By: Douglas Christopher Wilson @@ -3924,3 +4265,20 @@ Repository: github:eemeli/yaml > OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER > TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF > THIS SOFTWARE. + +--------------------------------------- + +## yn +License: MIT +By: Sindre Sorhus +Repository: sindresorhus/yn + +> MIT License +> +> Copyright (c) Sindre Sorhus (sindresorhus.com) +> +> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +> +> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/packages/vite/package.json b/packages/vite/package.json index 378441a86d7d26..010077c9ef6fed 100644 --- a/packages/vite/package.json +++ b/packages/vite/package.json @@ -71,7 +71,7 @@ "@babel/types": "^7.18.4", "@jridgewell/trace-mapping": "^0.3.13", "@rollup/plugin-alias": "^3.1.9", - "@rollup/plugin-commonjs": "^21.1.0", + "@rollup/plugin-commonjs": "^22.0.0", "@rollup/plugin-dynamic-import-vars": "^1.4.3", "@rollup/plugin-json": "^4.1.0", "@rollup/plugin-node-resolve": "13.3.0", diff --git a/packages/vite/rollup.config.ts b/packages/vite/rollup.config.ts index fc51e94c299e3c..b07bf5810e6e37 100644 --- a/packages/vite/rollup.config.ts +++ b/packages/vite/rollup.config.ts @@ -136,11 +136,6 @@ function createNodePlugins( 'postcss-load-config/src/index.js': { src: `require(configFile)`, replacement: `__require(configFile)` - }, - // @rollup/plugin-commonjs uses incorrect esm - '@rollup/plugin-commonjs/dist/index.es.js': { - src: `import { sync } from 'resolve';`, - replacement: `import __resolve from 'resolve';const sync = __resolve.sync;` } }), commonjs({ diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 55ad67574c0778..fff02ef69681df 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -216,7 +216,7 @@ importers: '@babel/types': ^7.18.4 '@jridgewell/trace-mapping': ^0.3.13 '@rollup/plugin-alias': ^3.1.9 - '@rollup/plugin-commonjs': ^21.1.0 + '@rollup/plugin-commonjs': ^22.0.0 '@rollup/plugin-dynamic-import-vars': ^1.4.3 '@rollup/plugin-json': ^4.1.0 '@rollup/plugin-node-resolve': 13.3.0 @@ -284,7 +284,7 @@ importers: '@babel/types': 7.18.4 '@jridgewell/trace-mapping': 0.3.13 '@rollup/plugin-alias': 3.1.9_rollup@2.75.6 - '@rollup/plugin-commonjs': 21.1.0_rollup@2.75.6 + '@rollup/plugin-commonjs': 22.0.0_rollup@2.75.6 '@rollup/plugin-dynamic-import-vars': 1.4.3_rollup@2.75.6 '@rollup/plugin-json': 4.1.0_rollup@2.75.6 '@rollup/plugin-node-resolve': 13.3.0_rollup@2.75.6 @@ -2010,6 +2010,22 @@ packages: rollup: 2.75.6 dev: true + /@rollup/plugin-commonjs/22.0.0_rollup@2.75.6: + resolution: {integrity: sha512-Ktvf2j+bAO+30awhbYoCaXpBcyPmJbaEUYClQns/+6SNCYFURbvBiNbWgHITEsIgDDWCDUclWRKEuf8cwZCFoQ==} + engines: {node: '>= 12.0.0'} + peerDependencies: + rollup: ^2.68.0 + dependencies: + '@rollup/pluginutils': 3.1.0_rollup@2.75.6 + commondir: 1.0.1 + estree-walker: 2.0.2 + glob: 7.2.0 + is-reference: 1.2.1 + magic-string: 0.25.9 + resolve: 1.22.1 + rollup: 2.75.6 + dev: true + /@rollup/plugin-dynamic-import-vars/1.4.3_rollup@2.75.6: resolution: {integrity: sha512-VYP9BBVI0pcYpLp/DkFT8YP+EmqmWFMmWXoTObDH6OouERxJyPsIj0tC3HxhjNBOKgcRc7eV75IQItzELt7QSg==} engines: {node: '>= 10.0.0'} @@ -3245,7 +3261,7 @@ packages: dev: true /commondir/1.0.1: - resolution: {integrity: sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=} + resolution: {integrity: sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==} dev: true /compare-func/2.0.0: From 0ff13b48570b655f45e15e69cb452f365170e9f9 Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Thu, 23 Jun 2022 23:01:47 +0800 Subject: [PATCH 02/13] build: resolve `import.meta.url` at build time --- packages/vite/rollup.config.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/packages/vite/rollup.config.ts b/packages/vite/rollup.config.ts index b07bf5810e6e37..cd947a3e5ab7b8 100644 --- a/packages/vite/rollup.config.ts +++ b/packages/vite/rollup.config.ts @@ -138,6 +138,9 @@ function createNodePlugins( replacement: `__require(configFile)` } }), + + buildTimeImportMetaUrl(), + commonjs({ extensions: ['.js'], // Optional peer deps of ws. Native deps that are mostly for performance. @@ -282,6 +285,21 @@ function shimDepsPlugin(deps: Record): Plugin { } } +// The use of `import.meta.url` in source code is not reliable after bundling. +// For example, it is affected by the `isEntry` bug brought in by the Rollup CJS plugin +// https://github.com/rollup/plugins/pull/1180 +// The better way is to resolve it at build time. +function buildTimeImportMetaUrl(): Plugin { + return { + name: 'buildTimeImportMetaUrl', + resolveImportMeta: (property, chunk) => { + if (property === 'url') { + return `'file://${chunk.moduleId}'` + } + } + } +} + function licensePlugin() { return license({ thirdParty(dependencies) { From a90d1fb8b2ea08233a0bee385940873c86cb64d0 Mon Sep 17 00:00:00 2001 From: sapphi-red Date: Fri, 20 May 2022 18:02:00 +0900 Subject: [PATCH 03/13] fix: exclude ts-node from bundle --- packages/vite/LICENSE.md | 360 +-------------------------------- packages/vite/rollup.config.ts | 4 +- 2 files changed, 3 insertions(+), 361 deletions(-) diff --git a/packages/vite/LICENSE.md b/packages/vite/LICENSE.md index 0fb14d41d4c961..47a0dedf591847 100644 --- a/packages/vite/LICENSE.md +++ b/packages/vite/LICENSE.md @@ -25,7 +25,7 @@ SOFTWARE. # Licenses of bundled dependencies The published Vite artifact additionally contains code with the following licenses: -Apache-2.0, BSD-2-Clause, BSD-3-Clause, CC0-1.0, ISC, MIT, (BSD-3-Clause OR GPL-2.0) +Apache-2.0, BSD-2-Clause, CC0-1.0, ISC, MIT, (BSD-3-Clause OR GPL-2.0) # Bundled dependencies: ## @ampproject/remapping @@ -237,34 +237,6 @@ Repository: git+https://github.com/ampproject/remapping.git --------------------------------------- -## @cspotcode/source-map-support -License: MIT -Repository: https://github.com/cspotcode/node-source-map-support - -> The MIT License (MIT) -> -> Copyright (c) 2014 Evan Wallace -> -> Permission is hereby granted, free of charge, to any person obtaining a copy -> of this software and associated documentation files (the "Software"), to deal -> in the Software without restriction, including without limitation the rights -> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -> copies of the Software, and to permit persons to whom the Software is -> furnished to do so, subject to the following conditions: -> -> The above copyright notice and this permission notice shall be included in all -> copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -> SOFTWARE. - ---------------------------------------- - ## @jridgewell/gen-mapping License: MIT By: Justin Ridgewell @@ -587,118 +559,6 @@ Repository: rollup/plugins --------------------------------------- -## @tsconfig/node10 -License: MIT -Repository: https://github.com/tsconfig/bases.git - -> MIT License -> -> Copyright (c) Microsoft Corporation. -> -> Permission is hereby granted, free of charge, to any person obtaining a copy -> of this software and associated documentation files (the "Software"), to deal -> in the Software without restriction, including without limitation the rights -> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -> copies of the Software, and to permit persons to whom the Software is -> furnished to do so, subject to the following conditions: -> -> The above copyright notice and this permission notice shall be included in all -> copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -> SOFTWARE - ---------------------------------------- - -## @tsconfig/node12 -License: MIT -Repository: https://github.com/tsconfig/bases.git - -> MIT License -> -> Copyright (c) Microsoft Corporation. -> -> Permission is hereby granted, free of charge, to any person obtaining a copy -> of this software and associated documentation files (the "Software"), to deal -> in the Software without restriction, including without limitation the rights -> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -> copies of the Software, and to permit persons to whom the Software is -> furnished to do so, subject to the following conditions: -> -> The above copyright notice and this permission notice shall be included in all -> copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -> SOFTWARE - ---------------------------------------- - -## @tsconfig/node14 -License: MIT -Repository: https://github.com/tsconfig/bases.git - -> MIT License -> -> Copyright (c) Microsoft Corporation. -> -> Permission is hereby granted, free of charge, to any person obtaining a copy -> of this software and associated documentation files (the "Software"), to deal -> in the Software without restriction, including without limitation the rights -> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -> copies of the Software, and to permit persons to whom the Software is -> furnished to do so, subject to the following conditions: -> -> The above copyright notice and this permission notice shall be included in all -> copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -> SOFTWARE - ---------------------------------------- - -## @tsconfig/node16 -License: MIT -Repository: https://github.com/tsconfig/bases.git - -> MIT License -> -> Copyright (c) Microsoft Corporation. -> -> Permission is hereby granted, free of charge, to any person obtaining a copy -> of this software and associated documentation files (the "Software"), to deal -> in the Software without restriction, including without limitation the rights -> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -> copies of the Software, and to permit persons to whom the Software is -> furnished to do so, subject to the following conditions: -> -> The above copyright notice and this permission notice shall be included in all -> copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -> SOFTWARE - ---------------------------------------- - ## @vue/compiler-core License: MIT By: Evan You @@ -815,35 +675,6 @@ Repository: https://github.com/acornjs/acorn.git --------------------------------------- -## acorn-walk -License: MIT -By: Marijn Haverbeke, Ingvar Stepanyan, Adrian Heine -Repository: https://github.com/acornjs/acorn.git - -> MIT License -> -> Copyright (C) 2012-2020 by various contributors (see AUTHORS) -> -> Permission is hereby granted, free of charge, to any person obtaining a copy -> of this software and associated documentation files (the "Software"), to deal -> in the Software without restriction, including without limitation the rights -> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -> copies of the Software, and to permit persons to whom the Software is -> furnished to do so, subject to the following conditions: -> -> The above copyright notice and this permission notice shall be included in -> all copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -> THE SOFTWARE. - ---------------------------------------- - ## ansi-regex License: MIT By: Sindre Sorhus @@ -884,35 +715,6 @@ Repository: https://github.com/micromatch/anymatch --------------------------------------- -## arg -License: MIT -By: Josh Junon -Repository: zeit/arg - -> MIT License -> -> Copyright (c) 2017-2019 Zeit, Inc. -> -> Permission is hereby granted, free of charge, to any person obtaining a copy -> of this software and associated documentation files (the "Software"), to deal -> in the Software without restriction, including without limitation the rights -> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -> copies of the Software, and to permit persons to whom the Software is -> furnished to do so, subject to the following conditions: -> -> The above copyright notice and this permission notice shall be included in all -> copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -> SOFTWARE. - ---------------------------------------- - ## balanced-match License: MIT By: Julian Gruber @@ -1256,39 +1058,6 @@ Repository: expressjs/cors --------------------------------------- -## create-require -License: MIT -By: Maël Nison, Paul Soporan, Pooya Parsa -Repository: nuxt-contrib/create-require - -> MIT License -> -> Copyright (c) 2020 -> -> Maël Nison -> Paul Soporan -> Pooya Parsa -> -> Permission is hereby granted, free of charge, to any person obtaining a copy -> of this software and associated documentation files (the "Software"), to deal -> in the Software without restriction, including without limitation the rights -> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -> copies of the Software, and to permit persons to whom the Software is -> furnished to do so, subject to the following conditions: -> -> The above copyright notice and this permission notice shall be included in all -> copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -> SOFTWARE. - ---------------------------------------- - ## cross-spawn License: MIT By: André Cruz @@ -1390,45 +1159,6 @@ Repository: sindresorhus/define-lazy-prop --------------------------------------- -## diff -License: BSD-3-Clause -By: Kevin Decker (http://incaseofstairs.com) -Repository: git://github.com/kpdecker/jsdiff.git - -> Software License Agreement (BSD License) -> -> Copyright (c) 2009-2015, Kevin Decker -> -> All rights reserved. -> -> Redistribution and use of this software in source and binary forms, with or without modification, -> are permitted provided that the following conditions are met: -> -> * Redistributions of source code must retain the above -> copyright notice, this list of conditions and the -> following disclaimer. -> -> * Redistributions in binary form must reproduce the above -> copyright notice, this list of conditions and the -> following disclaimer in the documentation and/or other -> materials provided with the distribution. -> -> * Neither the name of Kevin Decker nor the names of its -> contributors may be used to endorse or promote products -> derived from this software without specific prior -> written permission. -> -> THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR -> IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND -> FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -> CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -> DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -> DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER -> IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT -> OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ---------------------------------------- - ## dotenv License: BSD-2-Clause Repository: git://github.com/motdotla/dotenv.git @@ -2381,19 +2111,6 @@ Repository: https://github.com/rich-harris/magic-string --------------------------------------- -## make-error -License: ISC -By: Julien Fontanet -Repository: git://github.com/JsCommunity/make-error.git - -> Copyright 2014 Julien Fontanet -> -> Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. -> -> THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - ---------------------------------------- - ## merge2 License: MIT Repository: git@github.com:teambition/merge2.git @@ -3914,35 +3631,6 @@ Repository: lukeed/totalist --------------------------------------- -## ts-node -License: MIT -By: Blake Embrey, Andrew Bradley -Repository: git://github.com/TypeStrong/ts-node.git - -> The MIT License (MIT) -> -> Copyright (c) 2014 Blake Embrey (hello@blakeembrey.com) -> -> Permission is hereby granted, free of charge, to any person obtaining a copy -> of this software and associated documentation files (the "Software"), to deal -> in the Software without restriction, including without limitation the rights -> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -> copies of the Software, and to permit persons to whom the Software is -> furnished to do so, subject to the following conditions: -> -> The above copyright notice and this permission notice shall be included in -> all copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -> THE SOFTWARE. - ---------------------------------------- - ## tsconfck License: MIT By: dominikg @@ -4115,35 +3803,6 @@ Repository: git://github.com/jaredhanson/utils-merge.git --------------------------------------- -## v8-compile-cache-lib -License: MIT -By: Andrew Bradley -Repository: https://github.com/cspotcode/v8-compile-cache-lib.git - -> The MIT License (MIT) -> -> Copyright (c) 2019 Andres Suarez -> -> Permission is hereby granted, free of charge, to any person obtaining a copy -> of this software and associated documentation files (the "Software"), to deal -> in the Software without restriction, including without limitation the rights -> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -> copies of the Software, and to permit persons to whom the Software is -> furnished to do so, subject to the following conditions: -> -> The above copyright notice and this permission notice shall be included in all -> copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -> SOFTWARE. - ---------------------------------------- - ## vary License: MIT By: Douglas Christopher Wilson @@ -4265,20 +3924,3 @@ Repository: github:eemeli/yaml > OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER > TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF > THIS SOFTWARE. - ---------------------------------------- - -## yn -License: MIT -By: Sindre Sorhus -Repository: sindresorhus/yn - -> MIT License -> -> Copyright (c) Sindre Sorhus (sindresorhus.com) -> -> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -> -> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/packages/vite/rollup.config.ts b/packages/vite/rollup.config.ts index cd947a3e5ab7b8..19f150ab3278e4 100644 --- a/packages/vite/rollup.config.ts +++ b/packages/vite/rollup.config.ts @@ -134,8 +134,8 @@ function createNodePlugins( }, // postcss-load-config calls require after register ts-node 'postcss-load-config/src/index.js': { - src: `require(configFile)`, - replacement: `__require(configFile)` + pattern: /require(?=\((configFile|'ts-node')\))/g, + replacement: `eval('require')` } }), From 14e7ec903cee75af7e499f3658e05cd9b3a5cf99 Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Thu, 23 Jun 2022 23:24:24 +0800 Subject: [PATCH 04/13] build: use `pathToFileURL` to support Windows paths --- packages/vite/rollup.config.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/vite/rollup.config.ts b/packages/vite/rollup.config.ts index 19f150ab3278e4..102a1df2ec4207 100644 --- a/packages/vite/rollup.config.ts +++ b/packages/vite/rollup.config.ts @@ -1,6 +1,7 @@ /* eslint-disable no-restricted-globals */ import fs from 'node:fs' import path from 'node:path' +import url from 'node:url' import nodeResolve from '@rollup/plugin-node-resolve' import typescript from '@rollup/plugin-typescript' import commonjs from '@rollup/plugin-commonjs' @@ -294,7 +295,7 @@ function buildTimeImportMetaUrl(): Plugin { name: 'buildTimeImportMetaUrl', resolveImportMeta: (property, chunk) => { if (property === 'url') { - return `'file://${chunk.moduleId}'` + return `'${url.pathToFileURL(chunk.moduleId).href}'` } } } From 03502a33d0a277b8e57e95cc123fdac1fdd666ba Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Fri, 24 Jun 2022 20:33:38 +0800 Subject: [PATCH 05/13] chore: update commonjs plugin to v22.0.1 --- packages/vite/LICENSE.md | 2 +- packages/vite/package.json | 2 +- pnpm-lock.yaml | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/vite/LICENSE.md b/packages/vite/LICENSE.md index 47a0dedf591847..9bfb71d673183a 100644 --- a/packages/vite/LICENSE.md +++ b/packages/vite/LICENSE.md @@ -2197,7 +2197,7 @@ Repository: unjs/mlly > MIT License > -> Copyright (c) 2021 +> Copyright (c) 2022 UnJS > > Permission is hereby granted, free of charge, to any person obtaining a copy > of this software and associated documentation files (the "Software"), to deal diff --git a/packages/vite/package.json b/packages/vite/package.json index 010077c9ef6fed..39177ab5eb38d6 100644 --- a/packages/vite/package.json +++ b/packages/vite/package.json @@ -71,7 +71,7 @@ "@babel/types": "^7.18.4", "@jridgewell/trace-mapping": "^0.3.13", "@rollup/plugin-alias": "^3.1.9", - "@rollup/plugin-commonjs": "^22.0.0", + "@rollup/plugin-commonjs": "^22.0.1", "@rollup/plugin-dynamic-import-vars": "^1.4.3", "@rollup/plugin-json": "^4.1.0", "@rollup/plugin-node-resolve": "13.3.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index fff02ef69681df..31da3070e886b7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -216,7 +216,7 @@ importers: '@babel/types': ^7.18.4 '@jridgewell/trace-mapping': ^0.3.13 '@rollup/plugin-alias': ^3.1.9 - '@rollup/plugin-commonjs': ^22.0.0 + '@rollup/plugin-commonjs': ^22.0.1 '@rollup/plugin-dynamic-import-vars': ^1.4.3 '@rollup/plugin-json': ^4.1.0 '@rollup/plugin-node-resolve': 13.3.0 @@ -284,7 +284,7 @@ importers: '@babel/types': 7.18.4 '@jridgewell/trace-mapping': 0.3.13 '@rollup/plugin-alias': 3.1.9_rollup@2.75.6 - '@rollup/plugin-commonjs': 22.0.0_rollup@2.75.6 + '@rollup/plugin-commonjs': 22.0.1_rollup@2.75.6 '@rollup/plugin-dynamic-import-vars': 1.4.3_rollup@2.75.6 '@rollup/plugin-json': 4.1.0_rollup@2.75.6 '@rollup/plugin-node-resolve': 13.3.0_rollup@2.75.6 @@ -2010,8 +2010,8 @@ packages: rollup: 2.75.6 dev: true - /@rollup/plugin-commonjs/22.0.0_rollup@2.75.6: - resolution: {integrity: sha512-Ktvf2j+bAO+30awhbYoCaXpBcyPmJbaEUYClQns/+6SNCYFURbvBiNbWgHITEsIgDDWCDUclWRKEuf8cwZCFoQ==} + /@rollup/plugin-commonjs/22.0.1_rollup@2.75.6: + resolution: {integrity: sha512-dGfEZvdjDHObBiP5IvwTKMVeq/tBZGMBHZFMdIV1ClMM/YoWS34xrHFGfag9SN2ZtMgNZRFruqvxZQEa70O6nQ==} engines: {node: '>= 12.0.0'} peerDependencies: rollup: ^2.68.0 From 2d2b0fb820d57a81bef08a727bf226675df82a85 Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Fri, 24 Jun 2022 20:34:18 +0800 Subject: [PATCH 06/13] test: add tests for legacy cjs plugin --- package.json | 3 ++- packages/vite/src/node/config.ts | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 1e7ce0fe72ec31..b8d6b2fd24742a 100644 --- a/package.json +++ b/package.json @@ -17,9 +17,10 @@ "format": "prettier --write --cache .", "lint": "eslint --cache packages/*/{src,types,__tests__}/** playground/**/__tests__/**/*.ts scripts/**", "typecheck": "tsc -p scripts --noEmit && tsc -p playground --noEmit", - "test": "run-s test-unit test-serve test-build", + "test": "run-s test-unit test-serve test-build test-build-legacy-cjs", "test-serve": "vitest run -c vitest.config.e2e.ts", "test-build": "cross-env VITE_TEST_BUILD=1 vitest run -c vitest.config.e2e.ts", + "test-build-legacy-cjs": "cross-env VITE_TEST_BUILD=1 pnpm test-build", "test-unit": "vitest run", "test-docs": "pnpm run docs-build", "debug-serve": "cross-env VITE_DEBUG_SERVE=1 vitest run -c vitest.config.e2e.ts", diff --git a/packages/vite/src/node/config.ts b/packages/vite/src/node/config.ts index 06b222736667c8..2efc16a596ddd0 100644 --- a/packages/vite/src/node/config.ts +++ b/packages/vite/src/node/config.ts @@ -642,6 +642,13 @@ export async function resolveConfig( } } + if (process.env.VITE_TEST_LEGACY_CJS_PLUGIN) { + config.legacy = { + ...config.legacy, + buildRollupPluginCommonjs: true + } + } + if (middlewareMode === 'ssr') { logger.warn( colors.yellow( From 4cc55cff821d1a58d48716eeb02f38e561ef0a1a Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Fri, 24 Jun 2022 20:34:43 +0800 Subject: [PATCH 07/13] test: add commonjsOptions to the `external` test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit …so that it can correctly transpile `require` to `import *` --- playground/external/vite.config.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/playground/external/vite.config.js b/playground/external/vite.config.js index f6126b069cf49d..fde8e763f810e0 100644 --- a/playground/external/vite.config.js +++ b/playground/external/vite.config.js @@ -5,6 +5,9 @@ export default defineConfig({ minify: false, rollupOptions: { external: ['vue'] + }, + commonjsOptions: { + esmExternals: ['vue'] } } }) From d2a1c820bfa1f9424ec35d0f348b56c3028d4af4 Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Fri, 24 Jun 2022 20:45:28 +0800 Subject: [PATCH 08/13] =?UTF-8?q?test:=20fix=20env=20var=20name=20?= =?UTF-8?q?=F0=9F=98=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b8d6b2fd24742a..4c388d2de6cedf 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "test": "run-s test-unit test-serve test-build test-build-legacy-cjs", "test-serve": "vitest run -c vitest.config.e2e.ts", "test-build": "cross-env VITE_TEST_BUILD=1 vitest run -c vitest.config.e2e.ts", - "test-build-legacy-cjs": "cross-env VITE_TEST_BUILD=1 pnpm test-build", + "test-build-legacy-cjs": "cross-env VITE_TEST_LEGACY_CJS_PLUGIN=1 pnpm test-build", "test-unit": "vitest run", "test-docs": "pnpm run docs-build", "debug-serve": "cross-env VITE_DEBUG_SERVE=1 vitest run -c vitest.config.e2e.ts", From 7202161a8438d309ab59cc3de9835655b2ef34ed Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Fri, 24 Jun 2022 20:48:34 +0800 Subject: [PATCH 09/13] ci: add cjs test to CI workflow --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f190529faa247d..345e06a4af261d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -89,6 +89,9 @@ jobs: - name: Test build run: pnpm run test-build + - name: Test build with CJS plugin + run: pnpm run test-build-legacy-cjs + - name: Test docs run: pnpm run test-docs From 5c264f8c06d12ca6040e9367b652ef807c55cf92 Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Fri, 24 Jun 2022 21:05:32 +0800 Subject: [PATCH 10/13] =?UTF-8?q?test:=20should=20apply=20the=20test=20con?= =?UTF-8?q?fig=20before=20resolving=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/vite/src/node/config.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/vite/src/node/config.ts b/packages/vite/src/node/config.ts index 2efc16a596ddd0..74b0d0378633db 100644 --- a/packages/vite/src/node/config.ts +++ b/packages/vite/src/node/config.ts @@ -588,6 +588,13 @@ export async function resolveConfig( config = mergeConfig(config, externalConfigCompat(config, configEnv)) const optimizeDeps = config.optimizeDeps || {} + if (process.env.VITE_TEST_LEGACY_CJS_PLUGIN) { + config.legacy = { + ...config.legacy, + buildRollupPluginCommonjs: true + } + } + const BASE_URL = resolvedBase const resolved: ResolvedConfig = { @@ -642,13 +649,6 @@ export async function resolveConfig( } } - if (process.env.VITE_TEST_LEGACY_CJS_PLUGIN) { - config.legacy = { - ...config.legacy, - buildRollupPluginCommonjs: true - } - } - if (middlewareMode === 'ssr') { logger.warn( colors.yellow( From 4234d7a4e7812f5f1e54fae07a60e09d5a13cc4c Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Fri, 24 Jun 2022 21:28:13 +0800 Subject: [PATCH 11/13] test: use the correct id of browserExternalId In production there's no `:fs` suffix https://github.com/vitejs/vite/blob/32712668f6586734afa592384e325e9a8b528fe9/packages/vite/src/node/plugins/resolve.ts#L328-L330 --- playground/optimize-deps/vite.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/playground/optimize-deps/vite.config.js b/playground/optimize-deps/vite.config.js index e268510d5c8d76..133d0da1e32b74 100644 --- a/playground/optimize-deps/vite.config.js +++ b/playground/optimize-deps/vite.config.js @@ -72,7 +72,7 @@ module.exports = { apply: 'build', enforce: 'pre', load(id) { - if (id === '__vite-browser-external:fs') { + if (id === '__vite-browser-external') { return `export default {}; export function readFileSync() {}` } } From a81c64f3eedc079cc87f32c0c8ed4ea37dcbbb3c Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Fri, 24 Jun 2022 21:35:46 +0800 Subject: [PATCH 12/13] test: skip the esbuild-plugin test when testing the rollup cjs plugin --- .../optimize-deps/__tests__/optimize-deps.spec.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/playground/optimize-deps/__tests__/optimize-deps.spec.ts b/playground/optimize-deps/__tests__/optimize-deps.spec.ts index df1713b3fc76f8..b0af6debca526e 100644 --- a/playground/optimize-deps/__tests__/optimize-deps.spec.ts +++ b/playground/optimize-deps/__tests__/optimize-deps.spec.ts @@ -103,11 +103,16 @@ test('vue + vuex', async () => { expect(await page.textContent('.vue')).toMatch(`[success]`) }) -test('esbuild-plugin', async () => { - expect(await page.textContent('.esbuild-plugin')).toMatch( - `Hello from an esbuild plugin` - ) -}) +// When we use the Rollup CommonJS plugin instead of esbuild prebundling, +// the esbuild plugins won't apply to dependencies +test.skipIf(isBuild && process.env.VITE_TEST_LEGACY_CJS_PLUGIN)( + 'esbuild-plugin', + async () => { + expect(await page.textContent('.esbuild-plugin')).toMatch( + `Hello from an esbuild plugin` + ) + } +) test('import from hidden dir', async () => { expect(await page.textContent('.hidden-dir')).toBe('hello!') From 0a36140b9d2c5d7be47fd0e581905682103c13a7 Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Fri, 24 Jun 2022 22:55:26 +0800 Subject: [PATCH 13/13] ci: remove cjs plugin test from the main CI tests We'll move it to the ecosystem-ci instead --- .github/workflows/ci.yml | 3 --- package.json | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 345e06a4af261d..f190529faa247d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -89,9 +89,6 @@ jobs: - name: Test build run: pnpm run test-build - - name: Test build with CJS plugin - run: pnpm run test-build-legacy-cjs - - name: Test docs run: pnpm run test-docs diff --git a/package.json b/package.json index 4c388d2de6cedf..f877a59b859956 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "format": "prettier --write --cache .", "lint": "eslint --cache packages/*/{src,types,__tests__}/** playground/**/__tests__/**/*.ts scripts/**", "typecheck": "tsc -p scripts --noEmit && tsc -p playground --noEmit", - "test": "run-s test-unit test-serve test-build test-build-legacy-cjs", + "test": "run-s test-unit test-serve test-build", "test-serve": "vitest run -c vitest.config.e2e.ts", "test-build": "cross-env VITE_TEST_BUILD=1 vitest run -c vitest.config.e2e.ts", "test-build-legacy-cjs": "cross-env VITE_TEST_LEGACY_CJS_PLUGIN=1 pnpm test-build",