vite 3.0.0-beta.7 → 3.0.0-beta.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE.md CHANGED
@@ -25,7 +25,7 @@ SOFTWARE.
25
25
 
26
26
  # Licenses of bundled dependencies
27
27
  The published Vite artifact additionally contains code with the following licenses:
28
- Apache-2.0, BSD-2-Clause, CC0-1.0, ISC, MIT, (BSD-3-Clause OR GPL-2.0)
28
+ Apache-2.0, BSD-2-Clause, CC0-1.0, ISC, MIT
29
29
 
30
30
  # Bundled dependencies:
31
31
  ## @ampproject/remapping
@@ -2276,344 +2276,6 @@ Repository: zeit/ms
2276
2276
 
2277
2277
  ---------------------------------------
2278
2278
 
2279
- ## node-forge
2280
- License: (BSD-3-Clause OR GPL-2.0)
2281
- By: Digital Bazaar, Inc., Dave Longley, David I. Lehn, Stefan Siegl, Christoph Dorn
2282
- Repository: https://github.com/digitalbazaar/forge
2283
-
2284
- > You may use the Forge project under the terms of either the BSD License or the
2285
- > GNU General Public License (GPL) Version 2.
2286
- >
2287
- > The BSD License is recommended for most projects. It is simple and easy to
2288
- > understand and it places almost no restrictions on what you can do with the
2289
- > Forge project.
2290
- >
2291
- > If the GPL suits your project better you are also free to use Forge under
2292
- > that license.
2293
- >
2294
- > You don't have to do anything special to choose one license or the other and
2295
- > you don't have to notify anyone which license you are using. You are free to
2296
- > use this project in commercial projects as long as the copyright header is
2297
- > left intact.
2298
- >
2299
- > If you are a commercial entity and use this set of libraries in your
2300
- > commercial software then reasonable payment to Digital Bazaar, if you can
2301
- > afford it, is not required but is expected and would be appreciated. If this
2302
- > library saves you time, then it's saving you money. The cost of developing
2303
- > the Forge software was on the order of several hundred hours and tens of
2304
- > thousands of dollars. We are attempting to strike a balance between helping
2305
- > the development community while not being taken advantage of by lucrative
2306
- > commercial entities for our efforts.
2307
- >
2308
- > -------------------------------------------------------------------------------
2309
- > New BSD License (3-clause)
2310
- > Copyright (c) 2010, Digital Bazaar, Inc.
2311
- > All rights reserved.
2312
- >
2313
- > Redistribution and use in source and binary forms, with or without
2314
- > modification, are permitted provided that the following conditions are met:
2315
- > * Redistributions of source code must retain the above copyright
2316
- > notice, this list of conditions and the following disclaimer.
2317
- > * Redistributions in binary form must reproduce the above copyright
2318
- > notice, this list of conditions and the following disclaimer in the
2319
- > documentation and/or other materials provided with the distribution.
2320
- > * Neither the name of Digital Bazaar, Inc. nor the
2321
- > names of its contributors may be used to endorse or promote products
2322
- > derived from this software without specific prior written permission.
2323
- >
2324
- > THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
2325
- > ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
2326
- > WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
2327
- > DISCLAIMED. IN NO EVENT SHALL DIGITAL BAZAAR BE LIABLE FOR ANY
2328
- > DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
2329
- > (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
2330
- > LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
2331
- > ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2332
- > (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
2333
- > SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2334
- >
2335
- > -------------------------------------------------------------------------------
2336
- > GNU GENERAL PUBLIC LICENSE
2337
- > Version 2, June 1991
2338
- >
2339
- > Copyright (C) 1989, 1991 Free Software Foundation, Inc.
2340
- > 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2341
- > Everyone is permitted to copy and distribute verbatim copies
2342
- > of this license document, but changing it is not allowed.
2343
- >
2344
- > Preamble
2345
- >
2346
- > The licenses for most software are designed to take away your
2347
- > freedom to share and change it. By contrast, the GNU General Public
2348
- > License is intended to guarantee your freedom to share and change free
2349
- > software--to make sure the software is free for all its users. This
2350
- > General Public License applies to most of the Free Software
2351
- > Foundation's software and to any other program whose authors commit to
2352
- > using it. (Some other Free Software Foundation software is covered by
2353
- > the GNU Lesser General Public License instead.) You can apply it to
2354
- > your programs, too.
2355
- >
2356
- > When we speak of free software, we are referring to freedom, not
2357
- > price. Our General Public Licenses are designed to make sure that you
2358
- > have the freedom to distribute copies of free software (and charge for
2359
- > this service if you wish), that you receive source code or can get it
2360
- > if you want it, that you can change the software or use pieces of it
2361
- > in new free programs; and that you know you can do these things.
2362
- >
2363
- > To protect your rights, we need to make restrictions that forbid
2364
- > anyone to deny you these rights or to ask you to surrender the rights.
2365
- > These restrictions translate to certain responsibilities for you if you
2366
- > distribute copies of the software, or if you modify it.
2367
- >
2368
- > For example, if you distribute copies of such a program, whether
2369
- > gratis or for a fee, you must give the recipients all the rights that
2370
- > you have. You must make sure that they, too, receive or can get the
2371
- > source code. And you must show them these terms so they know their
2372
- > rights.
2373
- >
2374
- > We protect your rights with two steps: (1) copyright the software, and
2375
- > (2) offer you this license which gives you legal permission to copy,
2376
- > distribute and/or modify the software.
2377
- >
2378
- > Also, for each author's protection and ours, we want to make certain
2379
- > that everyone understands that there is no warranty for this free
2380
- > software. If the software is modified by someone else and passed on, we
2381
- > want its recipients to know that what they have is not the original, so
2382
- > that any problems introduced by others will not reflect on the original
2383
- > authors' reputations.
2384
- >
2385
- > Finally, any free program is threatened constantly by software
2386
- > patents. We wish to avoid the danger that redistributors of a free
2387
- > program will individually obtain patent licenses, in effect making the
2388
- > program proprietary. To prevent this, we have made it clear that any
2389
- > patent must be licensed for everyone's free use or not licensed at all.
2390
- >
2391
- > The precise terms and conditions for copying, distribution and
2392
- > modification follow.
2393
- >
2394
- > GNU GENERAL PUBLIC LICENSE
2395
- > TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
2396
- >
2397
- > 0. This License applies to any program or other work which contains
2398
- > a notice placed by the copyright holder saying it may be distributed
2399
- > under the terms of this General Public License. The "Program", below,
2400
- > refers to any such program or work, and a "work based on the Program"
2401
- > means either the Program or any derivative work under copyright law:
2402
- > that is to say, a work containing the Program or a portion of it,
2403
- > either verbatim or with modifications and/or translated into another
2404
- > language. (Hereinafter, translation is included without limitation in
2405
- > the term "modification".) Each licensee is addressed as "you".
2406
- >
2407
- > Activities other than copying, distribution and modification are not
2408
- > covered by this License; they are outside its scope. The act of
2409
- > running the Program is not restricted, and the output from the Program
2410
- > is covered only if its contents constitute a work based on the
2411
- > Program (independent of having been made by running the Program).
2412
- > Whether that is true depends on what the Program does.
2413
- >
2414
- > 1. You may copy and distribute verbatim copies of the Program's
2415
- > source code as you receive it, in any medium, provided that you
2416
- > conspicuously and appropriately publish on each copy an appropriate
2417
- > copyright notice and disclaimer of warranty; keep intact all the
2418
- > notices that refer to this License and to the absence of any warranty;
2419
- > and give any other recipients of the Program a copy of this License
2420
- > along with the Program.
2421
- >
2422
- > You may charge a fee for the physical act of transferring a copy, and
2423
- > you may at your option offer warranty protection in exchange for a fee.
2424
- >
2425
- > 2. You may modify your copy or copies of the Program or any portion
2426
- > of it, thus forming a work based on the Program, and copy and
2427
- > distribute such modifications or work under the terms of Section 1
2428
- > above, provided that you also meet all of these conditions:
2429
- >
2430
- > a) You must cause the modified files to carry prominent notices
2431
- > stating that you changed the files and the date of any change.
2432
- >
2433
- > b) You must cause any work that you distribute or publish, that in
2434
- > whole or in part contains or is derived from the Program or any
2435
- > part thereof, to be licensed as a whole at no charge to all third
2436
- > parties under the terms of this License.
2437
- >
2438
- > c) If the modified program normally reads commands interactively
2439
- > when run, you must cause it, when started running for such
2440
- > interactive use in the most ordinary way, to print or display an
2441
- > announcement including an appropriate copyright notice and a
2442
- > notice that there is no warranty (or else, saying that you provide
2443
- > a warranty) and that users may redistribute the program under
2444
- > these conditions, and telling the user how to view a copy of this
2445
- > License. (Exception: if the Program itself is interactive but
2446
- > does not normally print such an announcement, your work based on
2447
- > the Program is not required to print an announcement.)
2448
- >
2449
- > These requirements apply to the modified work as a whole. If
2450
- > identifiable sections of that work are not derived from the Program,
2451
- > and can be reasonably considered independent and separate works in
2452
- > themselves, then this License, and its terms, do not apply to those
2453
- > sections when you distribute them as separate works. But when you
2454
- > distribute the same sections as part of a whole which is a work based
2455
- > on the Program, the distribution of the whole must be on the terms of
2456
- > this License, whose permissions for other licensees extend to the
2457
- > entire whole, and thus to each and every part regardless of who wrote it.
2458
- >
2459
- > Thus, it is not the intent of this section to claim rights or contest
2460
- > your rights to work written entirely by you; rather, the intent is to
2461
- > exercise the right to control the distribution of derivative or
2462
- > collective works based on the Program.
2463
- >
2464
- > In addition, mere aggregation of another work not based on the Program
2465
- > with the Program (or with a work based on the Program) on a volume of
2466
- > a storage or distribution medium does not bring the other work under
2467
- > the scope of this License.
2468
- >
2469
- > 3. You may copy and distribute the Program (or a work based on it,
2470
- > under Section 2) in object code or executable form under the terms of
2471
- > Sections 1 and 2 above provided that you also do one of the following:
2472
- >
2473
- > a) Accompany it with the complete corresponding machine-readable
2474
- > source code, which must be distributed under the terms of Sections
2475
- > 1 and 2 above on a medium customarily used for software interchange; or,
2476
- >
2477
- > b) Accompany it with a written offer, valid for at least three
2478
- > years, to give any third party, for a charge no more than your
2479
- > cost of physically performing source distribution, a complete
2480
- > machine-readable copy of the corresponding source code, to be
2481
- > distributed under the terms of Sections 1 and 2 above on a medium
2482
- > customarily used for software interchange; or,
2483
- >
2484
- > c) Accompany it with the information you received as to the offer
2485
- > to distribute corresponding source code. (This alternative is
2486
- > allowed only for noncommercial distribution and only if you
2487
- > received the program in object code or executable form with such
2488
- > an offer, in accord with Subsection b above.)
2489
- >
2490
- > The source code for a work means the preferred form of the work for
2491
- > making modifications to it. For an executable work, complete source
2492
- > code means all the source code for all modules it contains, plus any
2493
- > associated interface definition files, plus the scripts used to
2494
- > control compilation and installation of the executable. However, as a
2495
- > special exception, the source code distributed need not include
2496
- > anything that is normally distributed (in either source or binary
2497
- > form) with the major components (compiler, kernel, and so on) of the
2498
- > operating system on which the executable runs, unless that component
2499
- > itself accompanies the executable.
2500
- >
2501
- > If distribution of executable or object code is made by offering
2502
- > access to copy from a designated place, then offering equivalent
2503
- > access to copy the source code from the same place counts as
2504
- > distribution of the source code, even though third parties are not
2505
- > compelled to copy the source along with the object code.
2506
- >
2507
- > 4. You may not copy, modify, sublicense, or distribute the Program
2508
- > except as expressly provided under this License. Any attempt
2509
- > otherwise to copy, modify, sublicense or distribute the Program is
2510
- > void, and will automatically terminate your rights under this License.
2511
- > However, parties who have received copies, or rights, from you under
2512
- > this License will not have their licenses terminated so long as such
2513
- > parties remain in full compliance.
2514
- >
2515
- > 5. You are not required to accept this License, since you have not
2516
- > signed it. However, nothing else grants you permission to modify or
2517
- > distribute the Program or its derivative works. These actions are
2518
- > prohibited by law if you do not accept this License. Therefore, by
2519
- > modifying or distributing the Program (or any work based on the
2520
- > Program), you indicate your acceptance of this License to do so, and
2521
- > all its terms and conditions for copying, distributing or modifying
2522
- > the Program or works based on it.
2523
- >
2524
- > 6. Each time you redistribute the Program (or any work based on the
2525
- > Program), the recipient automatically receives a license from the
2526
- > original licensor to copy, distribute or modify the Program subject to
2527
- > these terms and conditions. You may not impose any further
2528
- > restrictions on the recipients' exercise of the rights granted herein.
2529
- > You are not responsible for enforcing compliance by third parties to
2530
- > this License.
2531
- >
2532
- > 7. If, as a consequence of a court judgment or allegation of patent
2533
- > infringement or for any other reason (not limited to patent issues),
2534
- > conditions are imposed on you (whether by court order, agreement or
2535
- > otherwise) that contradict the conditions of this License, they do not
2536
- > excuse you from the conditions of this License. If you cannot
2537
- > distribute so as to satisfy simultaneously your obligations under this
2538
- > License and any other pertinent obligations, then as a consequence you
2539
- > may not distribute the Program at all. For example, if a patent
2540
- > license would not permit royalty-free redistribution of the Program by
2541
- > all those who receive copies directly or indirectly through you, then
2542
- > the only way you could satisfy both it and this License would be to
2543
- > refrain entirely from distribution of the Program.
2544
- >
2545
- > If any portion of this section is held invalid or unenforceable under
2546
- > any particular circumstance, the balance of the section is intended to
2547
- > apply and the section as a whole is intended to apply in other
2548
- > circumstances.
2549
- >
2550
- > It is not the purpose of this section to induce you to infringe any
2551
- > patents or other property right claims or to contest validity of any
2552
- > such claims; this section has the sole purpose of protecting the
2553
- > integrity of the free software distribution system, which is
2554
- > implemented by public license practices. Many people have made
2555
- > generous contributions to the wide range of software distributed
2556
- > through that system in reliance on consistent application of that
2557
- > system; it is up to the author/donor to decide if he or she is willing
2558
- > to distribute software through any other system and a licensee cannot
2559
- > impose that choice.
2560
- >
2561
- > This section is intended to make thoroughly clear what is believed to
2562
- > be a consequence of the rest of this License.
2563
- >
2564
- > 8. If the distribution and/or use of the Program is restricted in
2565
- > certain countries either by patents or by copyrighted interfaces, the
2566
- > original copyright holder who places the Program under this License
2567
- > may add an explicit geographical distribution limitation excluding
2568
- > those countries, so that distribution is permitted only in or among
2569
- > countries not thus excluded. In such case, this License incorporates
2570
- > the limitation as if written in the body of this License.
2571
- >
2572
- > 9. The Free Software Foundation may publish revised and/or new versions
2573
- > of the General Public License from time to time. Such new versions will
2574
- > be similar in spirit to the present version, but may differ in detail to
2575
- > address new problems or concerns.
2576
- >
2577
- > Each version is given a distinguishing version number. If the Program
2578
- > specifies a version number of this License which applies to it and "any
2579
- > later version", you have the option of following the terms and conditions
2580
- > either of that version or of any later version published by the Free
2581
- > Software Foundation. If the Program does not specify a version number of
2582
- > this License, you may choose any version ever published by the Free Software
2583
- > Foundation.
2584
- >
2585
- > 10. If you wish to incorporate parts of the Program into other free
2586
- > programs whose distribution conditions are different, write to the author
2587
- > to ask for permission. For software which is copyrighted by the Free
2588
- > Software Foundation, write to the Free Software Foundation; we sometimes
2589
- > make exceptions for this. Our decision will be guided by the two goals
2590
- > of preserving the free status of all derivatives of our free software and
2591
- > of promoting the sharing and reuse of software generally.
2592
- >
2593
- > NO WARRANTY
2594
- >
2595
- > 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
2596
- > FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
2597
- > OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
2598
- > PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
2599
- > OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
2600
- > MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
2601
- > TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
2602
- > PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
2603
- > REPAIR OR CORRECTION.
2604
- >
2605
- > 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
2606
- > WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
2607
- > REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
2608
- > INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
2609
- > OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
2610
- > TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
2611
- > YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
2612
- > PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
2613
- > POSSIBILITY OF SUCH DAMAGES.
2614
-
2615
- ---------------------------------------
2616
-
2617
2279
  ## normalize-path
2618
2280
  License: MIT
2619
2281
  By: Jon Schlinkert, Blaine Bublitz
@@ -1,4 +1,4 @@
1
- import { A as getAugmentedNamespace, B as getDefaultExportFromCjs } from './dep-706f59ea.js';
1
+ import { A as getAugmentedNamespace, B as getDefaultExportFromCjs } from './dep-5ccc5f38.js';
2
2
 
3
3
  import { fileURLToPath as __cjs_fileURLToPath } from 'node:url';
4
4
  import { dirname as __cjs_dirname } from 'node:path';
@@ -1,5 +1,5 @@
1
1
  import require$$0$1 from 'postcss';
2
- import { z as commonjsGlobal } from './dep-706f59ea.js';
2
+ import { z as commonjsGlobal } from './dep-5ccc5f38.js';
3
3
  import require$$0 from 'path';
4
4
  import require$$5 from 'crypto';
5
5
  import require$$0__default from 'fs';
@@ -33823,7 +33823,8 @@ function resolvePlugin(resolveOptions) {
33823
33823
  scan: resolveOpts?.scan ?? resolveOptions.scan
33824
33824
  };
33825
33825
  if (importer) {
33826
- if (isTsRequest(importer)) {
33826
+ if (isTsRequest(importer) ||
33827
+ resolveOpts.custom?.depScan?.loader?.startsWith('ts')) {
33827
33828
  options.isFromTsImporter = true;
33828
33829
  }
33829
33830
  else {
@@ -34950,6 +34951,8 @@ async function createPluginContainer({ plugins, logger, root, build: { rollupOpt
34950
34951
  skip.add(this._activePlugin);
34951
34952
  }
34952
34953
  let out = await container.resolveId(id, importer, {
34954
+ custom: options?.custom,
34955
+ isEntry: !!options?.isEntry,
34953
34956
  skip,
34954
34957
  ssr: this.ssr,
34955
34958
  scan: this._scan
@@ -35168,7 +35171,6 @@ async function createPluginContainer({ plugins, logger, root, build: { rollupOpt
35168
35171
  const skip = options?.skip;
35169
35172
  const ssr = options?.ssr;
35170
35173
  const scan = !!options?.scan;
35171
- const isEntry = !!options?.isEntry;
35172
35174
  const ctx = new Context();
35173
35175
  ctx.ssr = !!ssr;
35174
35176
  ctx._scan = scan;
@@ -35183,7 +35185,12 @@ async function createPluginContainer({ plugins, logger, root, build: { rollupOpt
35183
35185
  continue;
35184
35186
  ctx._activePlugin = plugin;
35185
35187
  const pluginResolveStart = isDebug ? performance.now() : 0;
35186
- const result = await plugin.resolveId.call(ctx, rawId, importer, { ssr, scan, isEntry });
35188
+ const result = await plugin.resolveId.call(ctx, rawId, importer, {
35189
+ custom: options?.custom,
35190
+ isEntry: !!options?.isEntry,
35191
+ ssr,
35192
+ scan
35193
+ });
35187
35194
  if (!result)
35188
35195
  continue;
35189
35196
  if (typeof result === 'string') {
@@ -35788,12 +35795,13 @@ const langRE = /\blang\s*=\s*(?:"([^"]+)"|'([^']+)'|([^\s'">]+))/im;
35788
35795
  const contextRE = /\bcontext\s*=\s*(?:"([^"]+)"|'([^']+)'|([^\s'">]+))/im;
35789
35796
  function esbuildScanPlugin(config, container, depImports, missing, entries) {
35790
35797
  const seen = new Map();
35791
- const resolve = async (id, importer) => {
35798
+ const resolve = async (id, importer, options) => {
35792
35799
  const key = id + (importer && path$n.dirname(importer));
35793
35800
  if (seen.has(key)) {
35794
35801
  return seen.get(key);
35795
35802
  }
35796
35803
  const resolved = await container.resolveId(id, importer && normalizePath$3(importer), {
35804
+ ...options,
35797
35805
  scan: true
35798
35806
  });
35799
35807
  const res = resolved?.id;
@@ -35910,13 +35918,19 @@ function esbuildScanPlugin(config, container, depImports, missing, entries) {
35910
35918
  }
35911
35919
  scripts[key] = {
35912
35920
  loader: 'js',
35913
- contents: (await transformGlobImport(transpiledContents, path, config.root, resolve))?.s.toString() || transpiledContents
35921
+ contents: (await transformGlobImport(transpiledContents, path, config.root, resolve))?.s.toString() || transpiledContents,
35922
+ pluginData: {
35923
+ htmlType: { loader }
35924
+ }
35914
35925
  };
35915
35926
  }
35916
35927
  else {
35917
35928
  scripts[key] = {
35918
35929
  loader,
35919
- contents
35930
+ contents,
35931
+ pluginData: {
35932
+ htmlType: { loader }
35933
+ }
35920
35934
  };
35921
35935
  }
35922
35936
  const virtualModulePath = JSON.stringify(virtualModulePrefix + key);
@@ -36006,9 +36020,13 @@ function esbuildScanPlugin(config, container, depImports, missing, entries) {
36006
36020
  // catch all -------------------------------------------------------------
36007
36021
  build.onResolve({
36008
36022
  filter: /.*/
36009
- }, async ({ path: id, importer }) => {
36023
+ }, async ({ path: id, importer, pluginData }) => {
36010
36024
  // use vite resolver to support urls and omitted extensions
36011
- const resolved = await resolve(id, importer);
36025
+ const resolved = await resolve(id, importer, {
36026
+ custom: {
36027
+ depScan: { loader: pluginData?.htmlType?.loader }
36028
+ }
36029
+ });
36012
36030
  if (resolved) {
36013
36031
  if (shouldExternalizeDep(resolved, id) || !isScannable(resolved)) {
36014
36032
  return externalUnlessEntry({ path: id });
@@ -36870,8 +36888,7 @@ async function runOptimizeDeps(resolvedConfig, depsInfo, ssr = !!resolvedConfig.
36870
36888
  // They're not supported yet because `optimizeDeps.exclude` currently only accepts strings
36871
36889
  if (!Array.isArray(rollupOptionsExternal) ||
36872
36890
  rollupOptionsExternal.some((ext) => typeof ext !== 'string')) {
36873
- throw new Error(`[vite] 'build.rollupOptions.external' can only be an array of strings or a string.\n` +
36874
- `You can turn on 'legacy.buildRollupPluginCommonjs' to support more advanced options.`);
36891
+ throw new Error(`[vite] 'build.rollupOptions.external' can only be an array of strings or a string when using esbuild optimization at build time.`);
36875
36892
  }
36876
36893
  external.push(...rollupOptionsExternal);
36877
36894
  }
@@ -39474,7 +39491,7 @@ function serveStaticMiddleware(dir, server) {
39474
39491
  return;
39475
39492
  }
39476
39493
  if (redirected) {
39477
- req.url = redirected;
39494
+ req.url = encodeURIComponent(redirected);
39478
39495
  }
39479
39496
  serve(req, res, next);
39480
39497
  };
@@ -39496,7 +39513,7 @@ function serveRawFsMiddleware(server) {
39496
39513
  url = url.slice(FS_PREFIX.length);
39497
39514
  if (isWindows$4)
39498
39515
  url = url.replace(/^[A-Z]:/i, '');
39499
- req.url = url;
39516
+ req.url = encodeURIComponent(url);
39500
39517
  serveFromRoot(req, res, next);
39501
39518
  }
39502
39519
  else {
@@ -40455,6 +40472,7 @@ function transformCjsImport(importExp, url, rawUrl, importIndex) {
40455
40472
  else if (spec.type === 'ExportSpecifier' &&
40456
40473
  spec.exported.type === 'Identifier') {
40457
40474
  // for ExportSpecifier, local name is same as imported name
40475
+ // prefix the variable name to avoid clashing with other local variables
40458
40476
  const importedName = spec.local.name;
40459
40477
  // we want to specify exported name as variable and re-export it
40460
40478
  const exportedName = spec.exported.name;
@@ -40463,8 +40481,9 @@ function transformCjsImport(importExp, url, rawUrl, importIndex) {
40463
40481
  importNames.push({ importedName, localName: defaultExports });
40464
40482
  }
40465
40483
  else {
40466
- importNames.push({ importedName, localName: exportedName });
40467
- exportNames.push(exportedName);
40484
+ const localName = makeLegalIdentifier(`__vite__cjsExport_${exportedName}`);
40485
+ importNames.push({ importedName, localName });
40486
+ exportNames.push(`${localName} as ${exportedName}`);
40468
40487
  }
40469
40488
  }
40470
40489
  }
@@ -41002,7 +41021,7 @@ const assetAttrsConfig = {
41002
41021
  const isAsyncScriptMap = new WeakMap();
41003
41022
  async function traverseHtml(html, filePath, visitor) {
41004
41023
  // lazy load compiler
41005
- const { parse, transform } = await import('./dep-5d9e5830.js').then(function (n) { return n.c; });
41024
+ const { parse, transform } = await import('./dep-001f95ce.js').then(function (n) { return n.c; });
41006
41025
  // @vue/compiler-core doesn't like lowercase doctypes
41007
41026
  html = html.replace(/<!doctype\s/i, '<!DOCTYPE ');
41008
41027
  try {
@@ -42132,7 +42151,7 @@ async function compileCSS(id, code, config, urlReplacer, atImportResolvers, serv
42132
42151
  logger: config.logger
42133
42152
  }));
42134
42153
  if (isModule) {
42135
- postcssPlugins.unshift((await import('./dep-d3bbad19.js').then(function (n) { return n.i; })).default({
42154
+ postcssPlugins.unshift((await import('./dep-0921e73a.js').then(function (n) { return n.i; })).default({
42136
42155
  ...modulesOptions,
42137
42156
  getJSON(cssFileName, _modules, outputFileName) {
42138
42157
  modules = _modules;
@@ -43193,13 +43212,14 @@ function resolveBuildOptions(raw, isBuild, logger) {
43193
43212
  }
43194
43213
  function resolveBuildPlugins(config) {
43195
43214
  const options = config.build;
43215
+ const { commonjsOptions } = options;
43216
+ const usePluginCommonjs = !Array.isArray(commonjsOptions?.include) ||
43217
+ commonjsOptions?.include.length !== 0;
43196
43218
  return {
43197
43219
  pre: [
43198
43220
  ...(options.watch ? [ensureWatchPlugin()] : []),
43199
43221
  watchPackageDataPlugin(config),
43200
- ...(config.legacy?.buildRollupPluginCommonjs
43201
- ? [commonjs(options.commonjsOptions)]
43202
- : []),
43222
+ ...(usePluginCommonjs ? [commonjs(options.commonjsOptions)] : []),
43203
43223
  dataURIPlugin(),
43204
43224
  assetImportMetaUrlPlugin(config),
43205
43225
  ...(options.rollupOptions.plugins
@@ -49989,9 +50009,6 @@ async function resolveHttpsConfig(https, cacheDir) {
49989
50009
  key: readFileIfExists(key),
49990
50010
  pfx: readFileIfExists(pfx)
49991
50011
  });
49992
- if (!httpsOption.key || !httpsOption.cert) {
49993
- httpsOption.cert = httpsOption.key = await getCertificate(cacheDir);
49994
- }
49995
50012
  return httpsOption;
49996
50013
  }
49997
50014
  function readFileIfExists(value) {
@@ -50005,27 +50022,6 @@ function readFileIfExists(value) {
50005
50022
  }
50006
50023
  return value;
50007
50024
  }
50008
- async function getCertificate(cacheDir) {
50009
- const cachePath = path$n.join(cacheDir, '_cert.pem');
50010
- try {
50011
- const [stat, content] = await Promise.all([
50012
- promises$2.stat(cachePath),
50013
- promises$2.readFile(cachePath, 'utf8')
50014
- ]);
50015
- if (Date.now() - stat.ctime.valueOf() > 30 * 24 * 60 * 60 * 1000) {
50016
- throw new Error('cache is outdated.');
50017
- }
50018
- return content;
50019
- }
50020
- catch {
50021
- const content = (await import('./dep-e8d443bf.js')).createCertificate();
50022
- promises$2
50023
- .mkdir(cacheDir, { recursive: true })
50024
- .then(() => promises$2.writeFile(cachePath, content))
50025
- .catch(() => { });
50026
- return content;
50027
- }
50028
- }
50029
50025
  async function httpServerStart(httpServer, serverOptions) {
50030
50026
  let { port, strictPort, host, logger } = serverOptions;
50031
50027
  return new Promise((resolve, reject) => {
@@ -58896,7 +58892,7 @@ function searchForWorkspaceRoot(current, root = searchForPackageRoot(current)) {
58896
58892
  async function createServer(inlineConfig = {}) {
58897
58893
  const config = await resolveConfig(inlineConfig, 'serve', 'development');
58898
58894
  const { root, server: serverConfig } = config;
58899
- const httpsOptions = await resolveHttpsConfig(config.server.https, config.cacheDir);
58895
+ const httpsOptions = await resolveHttpsConfig(config.server.https);
58900
58896
  const { middlewareMode } = serverConfig;
58901
58897
  const middlewares = connect();
58902
58898
  const httpServer = middlewareMode
@@ -59452,7 +59448,7 @@ function resolvePreviewOptions(preview, server) {
59452
59448
  async function preview(inlineConfig = {}) {
59453
59449
  const config = await resolveConfig(inlineConfig, 'serve', 'production');
59454
59450
  const app = connect();
59455
- const httpServer = await resolveHttpServer(config.preview, app, await resolveHttpsConfig(config.preview?.https, config.cacheDir));
59451
+ const httpServer = await resolveHttpServer(config.preview, app, await resolveHttpsConfig(config.preview?.https));
59456
59452
  // apply server hooks from plugins
59457
59453
  const postHooks = [];
59458
59454
  for (const plugin of config.plugins) {
@@ -62221,6 +62217,7 @@ function resolveSSROptions(ssr, buildSsrCjsExternalHeuristics, preserveSymlinks)
62221
62217
  target,
62222
62218
  ...ssr,
62223
62219
  optimizeDeps: {
62220
+ disabled: true,
62224
62221
  ...optimizeDeps,
62225
62222
  esbuildOptions: {
62226
62223
  preserveSymlinks,
@@ -62241,6 +62238,7 @@ function defineConfig(config) {
62241
62238
  return config;
62242
62239
  }
62243
62240
  async function resolveConfig(inlineConfig, command, defaultMode = 'development') {
62241
+ var _a;
62244
62242
  let config = inlineConfig;
62245
62243
  let configFileDependencies = [];
62246
62244
  let mode = inlineConfig.mode || defaultMode;
@@ -62403,11 +62401,14 @@ async function resolveConfig(inlineConfig, command, defaultMode = 'development')
62403
62401
  const ssr = resolveSSROptions(config.ssr, config.legacy?.buildSsrCjsExternalHeuristics, config.resolve?.preserveSymlinks);
62404
62402
  const middlewareMode = config?.server?.middlewareMode;
62405
62403
  const optimizeDeps = config.optimizeDeps || {};
62406
- if (process.env.VITE_TEST_LEGACY_CJS_PLUGIN) {
62407
- config.legacy = {
62408
- ...config.legacy,
62409
- buildRollupPluginCommonjs: true
62410
- };
62404
+ if (process.env.VITE_TEST_WITHOUT_PLUGIN_COMMONJS) {
62405
+ config.build ?? (config.build = {});
62406
+ config.build.commonjsOptions = { include: [] };
62407
+ config.optimizeDeps ?? (config.optimizeDeps = {});
62408
+ config.optimizeDeps.disabled = false;
62409
+ config.ssr ?? (config.ssr = {});
62410
+ (_a = config.ssr).optimizeDeps ?? (_a.optimizeDeps = {});
62411
+ config.ssr.optimizeDeps.disabled = false;
62411
62412
  }
62412
62413
  const BASE_URL = resolvedBase;
62413
62414
  const resolved = {
@@ -62444,6 +62445,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = 'development')
62444
62445
  packageCache: new Map(),
62445
62446
  createResolver,
62446
62447
  optimizeDeps: {
62448
+ disabled: 'build',
62447
62449
  ...optimizeDeps,
62448
62450
  esbuildOptions: {
62449
62451
  preserveSymlinks: config.resolve?.preserveSymlinks,
@@ -62451,7 +62453,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = 'development')
62451
62453
  }
62452
62454
  },
62453
62455
  worker: resolvedWorkerOptions,
62454
- appType: config.appType ?? middlewareMode === 'ssr' ? 'custom' : 'spa',
62456
+ appType: config.appType ?? (middlewareMode === 'ssr' ? 'custom' : 'spa'),
62455
62457
  experimental: {
62456
62458
  importGlobRestoreExtension: false,
62457
62459
  hmrPartialAccept: false,
@@ -62470,22 +62472,6 @@ async function resolveConfig(inlineConfig, command, defaultMode = 'development')
62470
62472
  resolved.optimizeDeps.force = true;
62471
62473
  logger.warn(picocolors.exports.yellow(`server.force is deprecated, use optimizeDeps.force instead`));
62472
62474
  }
62473
- if (resolved.legacy?.buildRollupPluginCommonjs) {
62474
- const optimizerDisabled = resolved.optimizeDeps.disabled;
62475
- if (!optimizerDisabled) {
62476
- resolved.optimizeDeps.disabled = 'build';
62477
- }
62478
- else if (optimizerDisabled === 'dev') {
62479
- resolved.optimizeDeps.disabled = true; // Also disabled during build
62480
- }
62481
- const ssrOptimizerDisabled = resolved.ssr.optimizeDeps.disabled;
62482
- if (!ssrOptimizerDisabled) {
62483
- resolved.ssr.optimizeDeps.disabled = 'build';
62484
- }
62485
- else if (ssrOptimizerDisabled === 'dev') {
62486
- resolved.ssr.optimizeDeps.disabled = true; // Also disabled during build
62487
- }
62488
- }
62489
62475
  // Some plugins that aren't intended to work in the bundling of workers (doing post-processing at build time for example).
62490
62476
  // And Plugins may also have cached that could be corrupted by being used in these extra rollup calls.
62491
62477
  // So we need to separate the worker plugin from the plugin that vite needs to run.