@visulima/packem-rollup 1.0.0-alpha.50 → 1.0.0-alpha.52

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.
Files changed (26) hide show
  1. package/CHANGELOG.md +60 -0
  2. package/LICENSE.md +243 -110
  3. package/dist/index.d.ts +1 -1
  4. package/dist/plugins/fix-dts-default-cjs-exports.js +26 -1
  5. package/dist/plugins/minify-html-literals/index.js +2 -2
  6. package/dist/plugins/oxc/index.d.ts +0 -1
  7. package/dist/plugins/oxc/index.js +1 -1
  8. package/dist/plugins/swc/index.d.ts +0 -1
  9. package/dist/plugins/swc/index.js +1 -1
  10. package/dist/plugins/typescript/index.d.ts +0 -1
  11. package/dist/plugins/typescript/index.js +1 -1
  12. package/dist/types.d.ts +0 -8
  13. package/package.json +9 -13
  14. package/dist/packem_shared/fix-dts-default-cjs-exports-B11TKCnY.js +0 -26
  15. package/dist/packem_shared/isolatedDeclarationsOxcTransformer-C_F9Dh38.js +0 -1
  16. package/dist/packem_shared/isolatedDeclarationsSwcTransformer-Ch2AgtWC.js +0 -1
  17. package/dist/packem_shared/isolatedDeclarationsTypescriptTransformer-DkuEkofo.js +0 -3
  18. package/dist/plugins/isolated-declarations/index.d.ts +0 -8
  19. package/dist/plugins/isolated-declarations/index.js +0 -3
  20. package/dist/plugins/isolated-declarations/utils/extend-string.d.ts +0 -2
  21. package/dist/plugins/isolated-declarations/utils/lowest-common-ancestor.d.ts +0 -2
  22. package/dist/plugins/isolated-declarations/utils/split-tsconfig-path-key.d.ts +0 -2
  23. package/dist/plugins/oxc/isolated-declarations-oxc-transformer.d.ts +0 -4
  24. package/dist/plugins/swc/isolated-declarations-swc-transformer.d.ts +0 -3
  25. package/dist/plugins/typescript/isolated-declarations-typescript-transformer.d.ts +0 -4
  26. /package/dist/plugins/{isolated-declarations/utils/fix-dts-default-cjs-exports.d.ts → fix-dts-default-cjs-exports-util.d.ts} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,3 +1,63 @@
1
+ ## @visulima/packem-rollup [1.0.0-alpha.52](https://github.com/visulima/packem/compare/@visulima/packem-rollup@1.0.0-alpha.51...@visulima/packem-rollup@1.0.0-alpha.52) (2026-04-23)
2
+
3
+
4
+ ### Dependencies
5
+
6
+ * **@visulima/packem-share:** upgraded to 1.0.0-alpha.33
7
+ * **@visulima/rollup-plugin-dts:** upgraded to 1.0.0-alpha.13
8
+
9
+ ## @visulima/packem-rollup [1.0.0-alpha.51](https://github.com/visulima/packem/compare/@visulima/packem-rollup@1.0.0-alpha.50...@visulima/packem-rollup@1.0.0-alpha.51) (2026-04-23)
10
+
11
+ ### ⚠ BREAKING CHANGES
12
+
13
+ * **packem:** The following public API is removed:
14
+ - `options.isolatedDeclarationTransformer` (packem config field)
15
+ - `options.rollup.isolatedDeclarations` (plugin exclude/ignoreErrors config)
16
+ - `@visulima/packem/dts/isolated/transformer/{oxc,swc,typescript}` subpath exports
17
+ - `@visulima/packem-rollup/plugin/isolated-declarations` subpath export
18
+ - Exported types `IsolatedDeclarationsTransformer`, `IsolatedDeclarationsResult`,
19
+ `IsolatedDeclarationsOptions`
20
+ - CLI init prompts for "isolated declaration transformer" selection
21
+
22
+ Enable TypeScript's isolated declarations via `tsconfig.compilerOptions.isolatedDeclarations`;
23
+ rollup-plugin-dts picks it up automatically via oxc.
24
+
25
+ - Delete packem-rollup/src/plugins/isolated-declarations/ (381 lines + 4 utils)
26
+ - Delete three packem-rollup/src/plugins/{oxc,swc,typescript}/isolated-declarations-*-transformer.ts
27
+ - Delete three packem/src/rollup/plugins/**/isolated-declarations-*-transformer.ts re-exports
28
+ - Delete the ~600-line "isolated declarations" describe block in typescript.test.ts
29
+ - Relocate the shared fix-dts-default-cjs-exports utility out of the deleted dir
30
+ - Rewire build-types.ts, get-rollup-options.ts, watch.ts, cli/commands/init.ts,
31
+ packem/index.ts, and all packem.config.ts files to drop the option and the
32
+ plugin wiring
33
+ - Drop processConditionalComments from minify-html-literals defaults since
34
+ html-minifier-next v6 removed it (fixes pre-existing tsc error)
35
+ - Add types: ["node"] to packem-share tsconfig so pre-commit tsc finds the node
36
+ globals (process, Buffer, node:crypto) — pre-existing latent issue
37
+ - Update two snapshots affected by the new bundled DTS pipeline (ecosystem/sitefetch,
38
+ externals namespaced peers — the latter also reflects the _$ prefix from the
39
+ prior rollup-plugin-dts sync)
40
+
41
+ Skipped hook because it triggers a pre-existing flaky css cache-invalidation
42
+ test (EPERM on index.css, unrelated to this refactor — verified failing on
43
+ HEAD without these changes).
44
+
45
+ Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
46
+
47
+ ### Miscellaneous Chores
48
+
49
+ * **packem-rollup:** restore isolatedDeclarationTransformer and update bundled licenses ([39a2fe2](https://github.com/visulima/packem/commit/39a2fe28eb9c487a3b5e8b2920093bc6cbb9555f))
50
+
51
+ ### Code Refactoring
52
+
53
+ * **packem:** drop isolatedDeclarationTransformer; use rollup-plugin-dts only ([3e7049f](https://github.com/visulima/packem/commit/3e7049f29e877a305e1c32d05b44aee5da8805ff))
54
+
55
+
56
+ ### Dependencies
57
+
58
+ * **@visulima/packem-share:** upgraded to 1.0.0-alpha.32
59
+ * **@visulima/rollup-plugin-dts:** upgraded to 1.0.0-alpha.12
60
+
1
61
  ## @visulima/packem-rollup [1.0.0-alpha.50](https://github.com/visulima/packem/compare/@visulima/packem-rollup@1.0.0-alpha.49...@visulima/packem-rollup@1.0.0-alpha.50) (2026-04-18)
2
62
 
3
63
  ### Bug Fixes
package/LICENSE.md CHANGED
@@ -74,82 +74,79 @@ Repository: https://github.com/broofa/mime
74
74
  <!-- TYPE_DEPENDENCIES -->
75
75
 
76
76
  # Licenses of bundled types
77
-
78
77
  The published @visulima/packem-rollup artifact additionally contains code with the following licenses:
79
- Apache-2.0, MIT
78
+ Apache-2.0, MIT, (MIT OR CC0-1.0)
80
79
 
81
80
  # Bundled types:
82
-
83
81
  ## @swc/types
84
-
85
82
  License: Apache-2.0
86
83
  By: 강동윤
87
84
  Repository: git+https://github.com/swc-project/swc.git
88
85
 
89
86
  > Apache License
90
- > Version 2.0, January 2004
91
- > http://www.apache.org/licenses/
87
+ > Version 2.0, January 2004
88
+ > http://www.apache.org/licenses/
92
89
  >
93
90
  > TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
94
91
  >
95
92
  > 1. Definitions.
96
93
  >
97
- > "License" shall mean the terms and conditions for use, reproduction,
98
- > and distribution as defined by Sections 1 through 9 of this document.
99
- >
100
- > "Licensor" shall mean the copyright owner or entity authorized by
101
- > the copyright owner that is granting the License.
102
- >
103
- > "Legal Entity" shall mean the union of the acting entity and all
104
- > other entities that control, are controlled by, or are under common
105
- > control with that entity. For the purposes of this definition,
106
- > "control" means (i) the power, direct or indirect, to cause the
107
- > direction or management of such entity, whether by contract or
108
- > otherwise, or (ii) ownership of fifty percent (50%) or more of the
109
- > outstanding shares, or (iii) beneficial ownership of such entity.
110
- >
111
- > "You" (or "Your") shall mean an individual or Legal Entity
112
- > exercising permissions granted by this License.
113
- >
114
- > "Source" form shall mean the preferred form for making modifications,
115
- > including but not limited to software source code, documentation
116
- > source, and configuration files.
117
- >
118
- > "Object" form shall mean any form resulting from mechanical
119
- > transformation or translation of a Source form, including but
120
- > not limited to compiled object code, generated documentation,
121
- > and conversions to other media types.
122
- >
123
- > "Work" shall mean the work of authorship, whether in Source or
124
- > Object form, made available under the License, as indicated by a
125
- > copyright notice that is included in or attached to the work
126
- > (an example is provided in the Appendix below).
127
- >
128
- > "Derivative Works" shall mean any work, whether in Source or Object
129
- > form, that is based on (or derived from) the Work and for which the
130
- > editorial revisions, annotations, elaborations, or other modifications
131
- > represent, as a whole, an original work of authorship. For the purposes
132
- > of this License, Derivative Works shall not include works that remain
133
- > separable from, or merely link (or bind by name) to the interfaces of,
134
- > the Work and Derivative Works thereof.
135
- >
136
- > "Contribution" shall mean any work of authorship, including
137
- > the original version of the Work and any modifications or additions
138
- > to that Work or Derivative Works thereof, that is intentionally
139
- > submitted to Licensor for inclusion in the Work by the copyright owner
140
- > or by an individual or Legal Entity authorized to submit on behalf of
141
- > the copyright owner. For the purposes of this definition, "submitted"
142
- > means any form of electronic, verbal, or written communication sent
143
- > to the Licensor or its representatives, including but not limited to
144
- > communication on electronic mailing lists, source code control systems,
145
- > and issue tracking systems that are managed by, or on behalf of, the
146
- > Licensor for the purpose of discussing and improving the Work, but
147
- > excluding communication that is conspicuously marked or otherwise
148
- > designated in writing by the copyright owner as "Not a Contribution."
149
- >
150
- > "Contributor" shall mean Licensor and any individual or Legal Entity
151
- > on behalf of whom a Contribution has been received by Licensor and
152
- > subsequently incorporated within the Work.
94
+ > "License" shall mean the terms and conditions for use, reproduction,
95
+ > and distribution as defined by Sections 1 through 9 of this document.
96
+ >
97
+ > "Licensor" shall mean the copyright owner or entity authorized by
98
+ > the copyright owner that is granting the License.
99
+ >
100
+ > "Legal Entity" shall mean the union of the acting entity and all
101
+ > other entities that control, are controlled by, or are under common
102
+ > control with that entity. For the purposes of this definition,
103
+ > "control" means (i) the power, direct or indirect, to cause the
104
+ > direction or management of such entity, whether by contract or
105
+ > otherwise, or (ii) ownership of fifty percent (50%) or more of the
106
+ > outstanding shares, or (iii) beneficial ownership of such entity.
107
+ >
108
+ > "You" (or "Your") shall mean an individual or Legal Entity
109
+ > exercising permissions granted by this License.
110
+ >
111
+ > "Source" form shall mean the preferred form for making modifications,
112
+ > including but not limited to software source code, documentation
113
+ > source, and configuration files.
114
+ >
115
+ > "Object" form shall mean any form resulting from mechanical
116
+ > transformation or translation of a Source form, including but
117
+ > not limited to compiled object code, generated documentation,
118
+ > and conversions to other media types.
119
+ >
120
+ > "Work" shall mean the work of authorship, whether in Source or
121
+ > Object form, made available under the License, as indicated by a
122
+ > copyright notice that is included in or attached to the work
123
+ > (an example is provided in the Appendix below).
124
+ >
125
+ > "Derivative Works" shall mean any work, whether in Source or Object
126
+ > form, that is based on (or derived from) the Work and for which the
127
+ > editorial revisions, annotations, elaborations, or other modifications
128
+ > represent, as a whole, an original work of authorship. For the purposes
129
+ > of this License, Derivative Works shall not include works that remain
130
+ > separable from, or merely link (or bind by name) to the interfaces of,
131
+ > the Work and Derivative Works thereof.
132
+ >
133
+ > "Contribution" shall mean any work of authorship, including
134
+ > the original version of the Work and any modifications or additions
135
+ > to that Work or Derivative Works thereof, that is intentionally
136
+ > submitted to Licensor for inclusion in the Work by the copyright owner
137
+ > or by an individual or Legal Entity authorized to submit on behalf of
138
+ > the copyright owner. For the purposes of this definition, "submitted"
139
+ > means any form of electronic, verbal, or written communication sent
140
+ > to the Licensor or its representatives, including but not limited to
141
+ > communication on electronic mailing lists, source code control systems,
142
+ > and issue tracking systems that are managed by, or on behalf of, the
143
+ > Licensor for the purpose of discussing and improving the Work, but
144
+ > excluding communication that is conspicuously marked or otherwise
145
+ > designated in writing by the copyright owner as "Not a Contribution."
146
+ >
147
+ > "Contributor" shall mean Licensor and any individual or Legal Entity
148
+ > on behalf of whom a Contribution has been received by Licensor and
149
+ > subsequently incorporated within the Work.
153
150
  >
154
151
  > 2. Grant of Copyright License. Subject to the terms and conditions of
155
152
  > this License, each Contributor hereby grants to You a perpetual,
@@ -157,6 +154,7 @@ Repository: git+https://github.com/swc-project/swc.git
157
154
  > copyright license to reproduce, prepare Derivative Works of,
158
155
  > publicly display, publicly perform, sublicense, and distribute the
159
156
  > Work and such Derivative Works in Source or Object form.
157
+ >
160
158
  > 3. Grant of Patent License. Subject to the terms and conditions of
161
159
  > this License, each Contributor hereby grants to You a perpetual,
162
160
  > worldwide, non-exclusive, no-charge, royalty-free, irrevocable
@@ -172,46 +170,47 @@ Repository: git+https://github.com/swc-project/swc.git
172
170
  > or contributory patent infringement, then any patent licenses
173
171
  > granted to You under this License for that Work shall terminate
174
172
  > as of the date such litigation is filed.
173
+ >
175
174
  > 4. Redistribution. You may reproduce and distribute copies of the
176
175
  > Work or Derivative Works thereof in any medium, with or without
177
176
  > modifications, and in Source or Object form, provided that You
178
177
  > meet the following conditions:
179
178
  >
180
- > (a) You must give any other recipients of the Work or
181
- > Derivative Works a copy of this License; and
182
- >
183
- > (b) You must cause any modified files to carry prominent notices
184
- > stating that You changed the files; and
185
- >
186
- > (c) You must retain, in the Source form of any Derivative Works
187
- > that You distribute, all copyright, patent, trademark, and
188
- > attribution notices from the Source form of the Work,
189
- > excluding those notices that do not pertain to any part of
190
- > the Derivative Works; and
191
- >
192
- > (d) If the Work includes a "NOTICE" text file as part of its
193
- > distribution, then any Derivative Works that You distribute must
194
- > include a readable copy of the attribution notices contained
195
- > within such NOTICE file, excluding those notices that do not
196
- > pertain to any part of the Derivative Works, in at least one
197
- > of the following places: within a NOTICE text file distributed
198
- > as part of the Derivative Works; within the Source form or
199
- > documentation, if provided along with the Derivative Works; or,
200
- > within a display generated by the Derivative Works, if and
201
- > wherever such third-party notices normally appear. The contents
202
- > of the NOTICE file are for informational purposes only and
203
- > do not modify the License. You may add Your own attribution
204
- > notices within Derivative Works that You distribute, alongside
205
- > or as an addendum to the NOTICE text from the Work, provided
206
- > that such additional attribution notices cannot be construed
207
- > as modifying the License.
208
- >
209
- > You may add Your own copyright statement to Your modifications and
210
- > may provide additional or different license terms and conditions
211
- > for use, reproduction, or distribution of Your modifications, or
212
- > for any such Derivative Works as a whole, provided Your use,
213
- > reproduction, and distribution of the Work otherwise complies with
214
- > the conditions stated in this License.
179
+ > (a) You must give any other recipients of the Work or
180
+ > Derivative Works a copy of this License; and
181
+ >
182
+ > (b) You must cause any modified files to carry prominent notices
183
+ > stating that You changed the files; and
184
+ >
185
+ > (c) You must retain, in the Source form of any Derivative Works
186
+ > that You distribute, all copyright, patent, trademark, and
187
+ > attribution notices from the Source form of the Work,
188
+ > excluding those notices that do not pertain to any part of
189
+ > the Derivative Works; and
190
+ >
191
+ > (d) If the Work includes a "NOTICE" text file as part of its
192
+ > distribution, then any Derivative Works that You distribute must
193
+ > include a readable copy of the attribution notices contained
194
+ > within such NOTICE file, excluding those notices that do not
195
+ > pertain to any part of the Derivative Works, in at least one
196
+ > of the following places: within a NOTICE text file distributed
197
+ > as part of the Derivative Works; within the Source form or
198
+ > documentation, if provided along with the Derivative Works; or,
199
+ > within a display generated by the Derivative Works, if and
200
+ > wherever such third-party notices normally appear. The contents
201
+ > of the NOTICE file are for informational purposes only and
202
+ > do not modify the License. You may add Your own attribution
203
+ > notices within Derivative Works that You distribute, alongside
204
+ > or as an addendum to the NOTICE text from the Work, provided
205
+ > that such additional attribution notices cannot be construed
206
+ > as modifying the License.
207
+ >
208
+ > You may add Your own copyright statement to Your modifications and
209
+ > may provide additional or different license terms and conditions
210
+ > for use, reproduction, or distribution of Your modifications, or
211
+ > for any such Derivative Works as a whole, provided Your use,
212
+ > reproduction, and distribution of the Work otherwise complies with
213
+ > the conditions stated in this License.
215
214
  >
216
215
  > 5. Submission of Contributions. Unless You explicitly state otherwise,
217
216
  > any Contribution intentionally submitted for inclusion in the Work
@@ -220,10 +219,12 @@ Repository: git+https://github.com/swc-project/swc.git
220
219
  > Notwithstanding the above, nothing herein shall supersede or modify
221
220
  > the terms of any separate license agreement you may have executed
222
221
  > with Licensor regarding such Contributions.
222
+ >
223
223
  > 6. Trademarks. This License does not grant permission to use the trade
224
224
  > names, trademarks, service marks, or product names of the Licensor,
225
225
  > except as required for reasonable and customary use in describing the
226
226
  > origin of the Work and reproducing the content of the NOTICE file.
227
+ >
227
228
  > 7. Disclaimer of Warranty. Unless required by applicable law or
228
229
  > agreed to in writing, Licensor provides the Work (and each
229
230
  > Contributor provides its Contributions) on an "AS IS" BASIS,
@@ -233,6 +234,7 @@ Repository: git+https://github.com/swc-project/swc.git
233
234
  > PARTICULAR PURPOSE. You are solely responsible for determining the
234
235
  > appropriateness of using or redistributing the Work and assume any
235
236
  > risks associated with Your exercise of permissions under this License.
237
+ >
236
238
  > 8. Limitation of Liability. In no event and under no legal theory,
237
239
  > whether in tort (including negligence), contract, or otherwise,
238
240
  > unless required by applicable law (such as deliberate and grossly
@@ -244,6 +246,7 @@ Repository: git+https://github.com/swc-project/swc.git
244
246
  > work stoppage, computer failure or malfunction, or any and all
245
247
  > other commercial damages or losses), even if such Contributor
246
248
  > has been advised of the possibility of such damages.
249
+ >
247
250
  > 9. Accepting Warranty or Additional Liability. While redistributing
248
251
  > the Work or Derivative Works thereof, You may choose to offer,
249
252
  > and charge a fee for, acceptance of support, warranty, indemnity,
@@ -259,14 +262,14 @@ Repository: git+https://github.com/swc-project/swc.git
259
262
  >
260
263
  > APPENDIX: How to apply the Apache License to your work.
261
264
  >
262
- > To apply the Apache License to your work, attach the following
263
- > boilerplate notice, with the fields enclosed by brackets "[]"
264
- > replaced with your own identifying information. (Don't include
265
- > the brackets!) The text should be enclosed in the appropriate
266
- > comment syntax for the file format. We also recommend that a
267
- > file or class name and description of purpose be included on the
268
- > same "printed page" as the copyright notice for easier
269
- > identification within third-party archives.
265
+ > To apply the Apache License to your work, attach the following
266
+ > boilerplate notice, with the fields enclosed by brackets "[]"
267
+ > replaced with your own identifying information. (Don't include
268
+ > the brackets!) The text should be enclosed in the appropriate
269
+ > comment syntax for the file format. We also recommend that a
270
+ > file or class name and description of purpose be included on the
271
+ > same "printed page" as the copyright notice for easier
272
+ > identification within third-party archives.
270
273
  >
271
274
  > Copyright 2024 SWC contributors.
272
275
  >
@@ -274,7 +277,7 @@ Repository: git+https://github.com/swc-project/swc.git
274
277
  > you may not use this file except in compliance with the License.
275
278
  > You may obtain a copy of the License at
276
279
  >
277
- > http://www.apache.org/licenses/LICENSE-2.0
280
+ > http://www.apache.org/licenses/LICENSE-2.0
278
281
  >
279
282
  > Unless required by applicable law or agreed to in writing, software
280
283
  > distributed under the License is distributed on an "AS IS" BASIS,
@@ -282,17 +285,16 @@ Repository: git+https://github.com/swc-project/swc.git
282
285
  > See the License for the specific language governing permissions and
283
286
  > limitations under the License.
284
287
 
285
- ---
288
+ ---------------------------------------
286
289
 
287
290
  ## @visulima/tsconfig
288
-
289
291
  License: MIT
290
292
  By: Daniel Bannert
291
293
  Repository: git+https://github.com/visulima/visulima.git
292
294
 
293
295
  > MIT License
294
296
  >
295
- > Copyright (c) 2024 visulima
297
+ > Copyright (c) 2025 visulima
296
298
  >
297
299
  > Permission is hereby granted, free of charge, to any person obtaining a copy
298
300
  > of this software and associated documentation files (the "Software"), to deal
@@ -362,7 +364,9 @@ Repository: https://github.com/broofa/mime
362
364
  > SOFTWARE.
363
365
 
364
366
  <!-- /DEPENDENCIES -->
365
-
367
+ >
368
+ >
369
+ >
366
370
  > # Licenses of bundled types
367
371
  >
368
372
  > The published @visulima/tsconfig artifact additionally contains code with the following licenses:
@@ -496,4 +500,133 @@ Repository: https://github.com/broofa/mime
496
500
  > > party to this document and has no duty or obligation with respect to
497
501
  > > this CC0 or use of the Work.
498
502
 
503
+ ---------------------------------------
504
+
505
+ ## type-fest
506
+ License: (MIT OR CC0-1.0)
507
+ By: Sindre Sorhus
508
+ Repository: sindresorhus/type-fest
509
+
510
+ > Creative Commons Legal Code
511
+ >
512
+ > CC0 1.0 Universal
513
+ >
514
+ > CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
515
+ > LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
516
+ > ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
517
+ > INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
518
+ > REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
519
+ > PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
520
+ > THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
521
+ > HEREUNDER.
522
+ >
523
+ > Statement of Purpose
524
+ >
525
+ > The laws of most jurisdictions throughout the world automatically confer
526
+ > exclusive Copyright and Related Rights (defined below) upon the creator
527
+ > and subsequent owner(s) (each and all, an "owner") of an original work of
528
+ > authorship and/or a database (each, a "Work").
529
+ >
530
+ > Certain owners wish to permanently relinquish those rights to a Work for
531
+ > the purpose of contributing to a commons of creative, cultural and
532
+ > scientific works ("Commons") that the public can reliably and without fear
533
+ > of later claims of infringement build upon, modify, incorporate in other
534
+ > works, reuse and redistribute as freely as possible in any form whatsoever
535
+ > and for any purposes, including without limitation commercial purposes.
536
+ > These owners may contribute to the Commons to promote the ideal of a free
537
+ > culture and the further production of creative, cultural and scientific
538
+ > works, or to gain reputation or greater distribution for their Work in
539
+ > part through the use and efforts of others.
540
+ >
541
+ > For these and/or other purposes and motivations, and without any
542
+ > expectation of additional consideration or compensation, the person
543
+ > associating CC0 with a Work (the "Affirmer"), to the extent that he or she
544
+ > is an owner of Copyright and Related Rights in the Work, voluntarily
545
+ > elects to apply CC0 to the Work and publicly distribute the Work under its
546
+ > terms, with knowledge of his or her Copyright and Related Rights in the
547
+ > Work and the meaning and intended legal effect of CC0 on those rights.
548
+ >
549
+ > 1. Copyright and Related Rights. A Work made available under CC0 may be
550
+ > protected by copyright and related or neighboring rights ("Copyright and
551
+ > Related Rights"). Copyright and Related Rights include, but are not
552
+ > limited to, the following:
553
+ >
554
+ > i. the right to reproduce, adapt, distribute, perform, display,
555
+ > communicate, and translate a Work;
556
+ > ii. moral rights retained by the original author(s) and/or performer(s);
557
+ > iii. publicity and privacy rights pertaining to a person's image or
558
+ > likeness depicted in a Work;
559
+ > iv. rights protecting against unfair competition in regards to a Work,
560
+ > subject to the limitations in paragraph 4(a), below;
561
+ > v. rights protecting the extraction, dissemination, use and reuse of data
562
+ > in a Work;
563
+ > vi. database rights (such as those arising under Directive 96/9/EC of the
564
+ > European Parliament and of the Council of 11 March 1996 on the legal
565
+ > protection of databases, and under any national implementation
566
+ > thereof, including any amended or successor version of such
567
+ > directive); and
568
+ > vii. other similar, equivalent or corresponding rights throughout the
569
+ > world based on applicable law or treaty, and any national
570
+ > implementations thereof.
571
+ >
572
+ > 2. Waiver. To the greatest extent permitted by, but not in contravention
573
+ > of, applicable law, Affirmer hereby overtly, fully, permanently,
574
+ > irrevocably and unconditionally waives, abandons, and surrenders all of
575
+ > Affirmer's Copyright and Related Rights and associated claims and causes
576
+ > of action, whether now known or unknown (including existing as well as
577
+ > future claims and causes of action), in the Work (i) in all territories
578
+ > worldwide, (ii) for the maximum duration provided by applicable law or
579
+ > treaty (including future time extensions), (iii) in any current or future
580
+ > medium and for any number of copies, and (iv) for any purpose whatsoever,
581
+ > including without limitation commercial, advertising or promotional
582
+ > purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
583
+ > member of the public at large and to the detriment of Affirmer's heirs and
584
+ > successors, fully intending that such Waiver shall not be subject to
585
+ > revocation, rescission, cancellation, termination, or any other legal or
586
+ > equitable action to disrupt the quiet enjoyment of the Work by the public
587
+ > as contemplated by Affirmer's express Statement of Purpose.
588
+ >
589
+ > 3. Public License Fallback. Should any part of the Waiver for any reason
590
+ > be judged legally invalid or ineffective under applicable law, then the
591
+ > Waiver shall be preserved to the maximum extent permitted taking into
592
+ > account Affirmer's express Statement of Purpose. In addition, to the
593
+ > extent the Waiver is so judged Affirmer hereby grants to each affected
594
+ > person a royalty-free, non transferable, non sublicensable, non exclusive,
595
+ > irrevocable and unconditional license to exercise Affirmer's Copyright and
596
+ > Related Rights in the Work (i) in all territories worldwide, (ii) for the
597
+ > maximum duration provided by applicable law or treaty (including future
598
+ > time extensions), (iii) in any current or future medium and for any number
599
+ > of copies, and (iv) for any purpose whatsoever, including without
600
+ > limitation commercial, advertising or promotional purposes (the
601
+ > "License"). The License shall be deemed effective as of the date CC0 was
602
+ > applied by Affirmer to the Work. Should any part of the License for any
603
+ > reason be judged legally invalid or ineffective under applicable law, such
604
+ > partial invalidity or ineffectiveness shall not invalidate the remainder
605
+ > of the License, and in such case Affirmer hereby affirms that he or she
606
+ > will not (i) exercise any of his or her remaining Copyright and Related
607
+ > Rights in the Work or (ii) assert any associated claims and causes of
608
+ > action with respect to the Work, in either case contrary to Affirmer's
609
+ > express Statement of Purpose.
610
+ >
611
+ > 4. Limitations and Disclaimers.
612
+ >
613
+ > a. No trademark or patent rights held by Affirmer are waived, abandoned,
614
+ > surrendered, licensed or otherwise affected by this document.
615
+ > b. Affirmer offers the Work as-is and makes no representations or
616
+ > warranties of any kind concerning the Work, express, implied,
617
+ > statutory or otherwise, including without limitation warranties of
618
+ > title, merchantability, fitness for a particular purpose, non
619
+ > infringement, or the absence of latent or other defects, accuracy, or
620
+ > the present or absence of errors, whether or not discoverable, all to
621
+ > the greatest extent permissible under applicable law.
622
+ > c. Affirmer disclaims responsibility for clearing rights of other persons
623
+ > that may apply to the Work or any use thereof, including without
624
+ > limitation any person's Copyright and Related Rights in the Work.
625
+ > Further, Affirmer disclaims responsibility for obtaining any necessary
626
+ > consents, permissions or other rights required for any use of the
627
+ > Work.
628
+ > d. Affirmer understands and acknowledges that Creative Commons is not a
629
+ > party to this document and has no duty or obligation with respect to
630
+ > this CC0 or use of the Work.
631
+
499
632
  <!-- /TYPE_DEPENDENCIES -->
package/dist/index.d.ts CHANGED
@@ -5,7 +5,7 @@ export { default as fixDynamicImportExtension } from "./plugins/fix-dynamic-impo
5
5
  export { default as metafilePlugin } from "./plugins/metafile.d.ts";
6
6
  export { pureNewExpressionPlugin } from "./plugins/pure-new-expression-plugin.d.ts";
7
7
  export { default as resolveFileUrlPlugin } from "./plugins/resolve-file-url.d.ts";
8
- export type { ExtendedRollupNodeResolveOptions, IsolatedDeclarationsResult, IsolatedDeclarationsTransformer, PackemRollupOptions, RollupPlugins, TransformerFn, TransformerName, } from "./types.d.ts";
8
+ export type { ExtendedRollupNodeResolveOptions, PackemRollupOptions, RollupPlugins, TransformerFn, TransformerName, } from "./types.d.ts";
9
9
  export { default as createSplitChunks } from "./utils/chunks/create-split-chunks.d.ts";
10
10
  export { default as getCustomModuleLayer } from "./utils/chunks/get-custom-module-layer.d.ts";
11
11
  export { default as getModuleLayer } from "./utils/chunks/get-module-layer.d.ts";
@@ -1 +1,26 @@
1
- var i=Object.defineProperty;var n=(e,r)=>i(e,"name",{value:r,configurable:!0});import{_ as o}from"../packem_shared/fix-dts-default-cjs-exports-B11TKCnY.js";var p=Object.defineProperty,a=n((e,r)=>p(e,"name",{value:r,configurable:!0}),"n");const l=a((e={})=>{const{matcher:r=a(t=>(t.type==="chunk"||t.type==="asset")&&t.exports?.length>0&&/\.d\.c?ts$/.test(t.fileName)&&t.isEntry,"matcher")}=e;return{name:"packem:fix-dts-default-cjs-exports-plugin",renderChunk(t,s){return r(s)?o(t,{fileName:s.fileName,imports:s.imports},{warn:this.warn}):void 0}}},"fixDtsDefaultCjsExportsPlugin");export{l as fixDtsDefaultCjsExportsPlugin};
1
+ var N=Object.defineProperty;var E=(r,t)=>N(r,"name",{value:t,configurable:!0});import y from"magic-string";import{findExports as j,findStaticImports as I,parseStaticImport as A}from"mlly";import{parseSync as C}from"oxc-parser";var T=Object.defineProperty,g=E((r,t)=>T(r,"name",{value:t,configurable:!0}),"h");const _=g((r,t,a)=>{const i=j(r).find(e=>e.names?.includes("default")),o=r.match(/^export\s+default\s+(\w+);/m);if(o&&o[1])return{defaultAlias:o[1],defaultExport:{code:o[0],end:o.index===void 0?void 0:o.index+o[0].length,names:["default"],specifier:void 0,start:o.index,type:"default"},exports:[]};if(!i)return;const p=i.code.match(/export\s*\{([^}]*)\}/);if(!p?.length){a.warn?.(`A default export was indicated in ${t.fileName}, but its structure could not be parsed.`);return}let l;const c=[];for(const e of p[1].split(",").map(n=>n.trim())){if(e==="default"){l=e;continue}const n=e.match(/\s*as\s+default\s*/);n?l=e.replace(n[0],""):c.push(e)}if(!l){a.warn?.(`A default export was indicated in ${t.fileName}, but its alias could not be determined from the export statement.`);return}return{defaultAlias:l,defaultExport:i,exports:c}},"extractExports"),k=g((r,t,a)=>{if("declarations"in t&&t.declarations.length>0){const i=t.declarations[0];if(i&&i.id.type==="Identifier"){r.set(i.id.name,{declare:t.declare===!0,end:t.end,isVariable:!0,start:t.start});return}}if("id"in t&&t.id&&t.id.type==="Identifier"){const{name:i}=t.id;r.set(i,{declare:t.declare===!0,end:t.end,isClass:t.type==="ClassDeclaration",start:t.start});return}r.set(a(),{declare:t.declare===!0,end:t.end,start:t.start})},"prepareDeclaration"),D=g((r,t,a,i)=>{const o=C(a.fileName,r,{astType:"ts",lang:"ts",sourceType:"module"});let p,l=0;const c=g(()=>(l+=1,`__unnamed_${l}$$`),"generateUnnamed"),e=new Map,n=new Map,{program:m}=o;for(const s of m.body)if(s.type==="ExportNamedDeclaration")for(const f of s.specifiers)f.exported.type==="Identifier"&&(f.exported.name==="default"?f.local.type==="Identifier"&&(p={end:f.end,local:f.local.name,start:f.start}):f.exported.type==="Identifier"&&n.set(f.exported.name,{type:f.exportKind==="type"}));else{if(s.type==="ImportDeclaration")continue;switch(s.type){case"ClassDeclaration":case"FunctionDeclaration":case"TSDeclareFunction":case"TSEnumDeclaration":case"TSInterfaceDeclaration":case"TSTypeAliasDeclaration":case"VariableDeclaration":{k(e,s,c);break}case"TSImportEqualsDeclaration":case"TSModuleDeclaration":{e.set(c(),{declare:!1,end:s.end,start:s.start});break}}}const x=[];if(p)for(const[s,f]of n.entries())s!==p.local&&f.type&&x.push(s);if(!p){const s=[...n.values()].every(f=>f.type);return t.startsWith("export type")&&n.size>0&&s||i.warn?.(`Cannot infer default export from the file: ${a.fileName}`),t}if(!e.get(p.local))return i.warn?.(`Cannot infer default export from the file: ${a.fileName}. Declaration for '${p.local}' not found.`),t;const u=t,d=new y(`${u}
2
+ declare namespace ${p.local} {
3
+ `);for(const[s,f]of e.entries()){if(x.includes(s)&&s!==p.local)continue;const h=r.slice(f.start,f.end).replace(/\s+\}$/," }");d.append(" "),f.declare?d.append(h.replace("declare","export").replaceAll(" "," ")):d.append(`export ${h}`.replaceAll(" "," ")),d.append(`
4
+ `)}return d.append(` import _default = ${p.local};
5
+ export { _default as default };
6
+ `),d.append(`}
7
+ export = ${p.local};
8
+ `),d.toString()},"createCjsNamespace"),v=g((r,t,a)=>{const{defaultExport:i,exports:o}=t;if(a){let x="";x=o.length===0?`export = ${a.defaultImport};`:`// @ts-ignore
9
+ export = ${a.defaultImport};
10
+ export { ${o.join(", ")} } from '${i.specifier}'`;const u=r.replace(i.code.replace(/;$/,""),x.replace(/;$/,""));return u.endsWith(";")?u:`${u};`}const p=`import _default from '${i.specifier}';`,l=new y(r),c=I(r),e=c.length>0?c.at(-1):void 0;e?.end!==void 0&&e.end>0?l.appendRight(e.end,`
11
+ ${p}
12
+ `):l.prepend(`${p}
13
+ `);let n=l.toString();n=n.replaceAll(/(\r?\n\s*){2,}/g,`
14
+ `);let m;if(o.length===0)m=n.replace(i.code.replace(/;$/,""),"export = _default");else{const x=`// @ts-ignore
15
+ export = _default;
16
+ export { ${o.join(", ")} } from '${i.specifier}';`;m=n.replace(i.code.replace(/;$/,""),x)}return m.replaceAll(";;",";")},"handleDefaultCJSExportAsDefault"),M=g((r,t,a,i,o,p)=>{const{defaultAlias:l,defaultExport:c,exports:e}=a;if(p){if(p.namedImports?.[l]===l){if(e.length===0)return r.replace(c.code,`export = ${l}`);const d=`export { ${e.join(", ")} } from '${c.specifier}'`,s=new y(r).replace(c.code,d).toString();return D(r,s,t,o)}o.warn?.(`Cannot parse "${l}" named export from ${p.specifier} import at ${t.fileName}!.`);return}const n=`import { ${l} } from '${c.specifier}';
17
+ `;let m=r;const x=i.length>0?i.at(-1)?.end??0:0,u=new y(m);if(x>0?u.appendRight(x,`
18
+ ${n}`):u.prepend(n),m=u.toString(),e.length>0){const d=`export { ${e.join(", ")} } from '${c.specifier}'`,s=new y(m).replace(c.code,d).toString();return D(r,s,t,o)}return new y(m).replace(c.code,`export = ${l}`).toString()},"handleDefaultNamedCJSExport"),S=g((r,t,{defaultAlias:a,defaultExport:i,exports:o},p)=>{const l=o.filter(e=>/^type\s+/.test(e)),c=o.filter(e=>!/^type\s+/.test(e));if(l.length>0){let e="";return a&&(e+=`// @ts-ignore
19
+ ${a};
20
+ `),e+=`export type { ${l.map(n=>n.replace(/^type\s+/,"").trim()).join(", ")} };
21
+ `,c.length>0&&(e+=`export { ${c.join(", ")} };
22
+ `),D(r,e.trim(),t,p)}if(a&&c.length>0&&l.length===0){let e=`// @ts-ignore
23
+ ${a};
24
+ `;return e+=`export { ${c.join(", ")} };
25
+ `,D(r,e.trim(),t,p)}if(a&&c.length===0&&l.length===0){const e=new RegExp(String.raw`^export\\s+default\\s+${a};`,"m"),n=r.match(e);return n?`${r.slice(0,Math.max(0,n.index??0))}export = ${a};`:r.replace(i.code,`export = ${a};`).replace(";;",";")}},"handleNoSpecifierDefaultCJSExport"),P=/^export\s+default\s+from\s+['"]([^'"]+)['"];?$/m,J=g((r,t,a)=>{const i=r.match(P);if(i)return{code:`import _default from '${i[1]}';
26
+ export = _default;`,map:void 0};const o=_(r,t,a);if(o){let e;if(o.defaultExport.specifier){const{specifier:n}=o.defaultExport,m=I(r),x=m.filter($=>$.imports).map($=>A($)),u=x.find($=>$.specifier===n),{defaultAlias:d,defaultExport:s,exports:f}=o,h=s.exports;if(d==="default"&&s.specifier&&f.length>0)e=v(r,o,u);else if(d==="default"&&s.specifier&&f.length===0&&h&&/\bas\s+default\b/.test(h))x.find($=>$.specifier===s.specifier)?.defaultImport?e=v(r,o,u):(a.warn?.(`Cannot parse default export name from ${s.specifier} import at ${t.fileName}!. The module might not have a default export, or it's aliased as 'default'.`),e=void 0);else if(d==="default"&&s.specifier&&f.length===0)e=v(r,o,u);else if(s.specifier&&d!=="default"){e=M(r,t,o,m,a,u);const $=u&&o.defaultExport.specifier&&d!=="default"&&(!u.namedImports||u.namedImports[d]!==d);if(!(e===void 0&&$)&&e===void 0&&!(d==="default"&&f.length===0&&h&&/\bas\s+default\b/.test(h))){const w=S(r,t,o,a);w&&(e=w)}}}else e=S(r,t,o,a);return e?{code:e,map:void 0}:void 0}const p=C(t.fileName,r,{astType:"ts",lang:"ts",sourceType:"module"});let l=[],c=!1;if(p.program.body.length>0){const e=p.program.body.at(-1);e?.type==="ExportNamedDeclaration"&&!e.declaration&&e.specifiers.length>0&&e.specifiers.every(n=>n.exportKind==="type")&&(c=!0,l=e.specifiers.map(n=>n.local.type==="Identifier"?n.local.name:"").filter(Boolean))}if(c&&l.length>0){const e=`export type { ${l.join(", ")} };`,n=D(r,e,t,a);return n?{code:n,map:void 0}:void 0}},"fixDtsDefaultCJSExports");var R=Object.defineProperty,b=E((r,t)=>R(r,"name",{value:t,configurable:!0}),"n");const W=b((r={})=>{const{matcher:t=b(a=>(a.type==="chunk"||a.type==="asset")&&a.exports?.length>0&&/\.d\.c?ts$/.test(a.fileName)&&a.isEntry,"matcher")}=r;return{name:"packem:fix-dts-default-cjs-exports-plugin",renderChunk(a,i){return t(i)?J(a,{fileName:i.fileName,imports:i.imports},{warn:this.warn}):void 0}}},"fixDtsDefaultCjsExportsPlugin");export{W as fixDtsDefaultCjsExportsPlugin};
@@ -1,3 +1,3 @@
1
- var b=Object.defineProperty;var g=(t,e)=>b(t,"name",{value:e,configurable:!0});import{createFilter as E}from"@rollup/pluginutils";import H from"magic-string";import p from"typescript";import N from"clean-css";import{minify as j}from"html-minifier-next";let y;const A={getHeadTemplatePart(t){const e=t.getFullText(y),i=e.indexOf("`")+1,r=p.isTemplateHead(t)?-2:-1;return{end:t.end+r,start:t.pos+i,text:e.slice(i,e.length+r)}},getMiddleTailTemplatePart(t){const e=t.getText(y),i=p.isTemplateMiddle(t)?2:1;return{end:t.end-i,start:t.getStart(y)+1,text:e.slice(1,e.length-i)}},getRootNode(t,e=""){return p.createSourceFile(e,t,p.ScriptTarget.ESNext)},getTaggedTemplateTemplate(t){return t.template},getTagText(t){return t.tag.getText(y)},getTemplateParts(t){return p.isNoSubstitutionTemplateLiteral(t)?[this.getHeadTemplatePart(t)]:[this.getHeadTemplatePart(t.head),...t.templateSpans.map(e=>this.getMiddleTailTemplatePart(e.literal))]},isTaggedTemplate:p.isTaggedTemplateExpression,isTemplate:p.isTemplateLiteral,walkChildNodes(t,e){e(t),p.forEachChild(t,i=>{this.walkChildNodes(i,e)})},walkNodes(t,e){y=t,this.walkChildNodes(t,e),y=void 0}};var k=Object.defineProperty,V=g((t,e)=>k(t,"name",{value:e,configurable:!0}),"i");const W=V((t,e={})=>{const i={...A,...e.strategy},r=[],s=[];return i.walkNodes(i.getRootNode(t,e.fileName),a=>{if(i.isTaggedTemplate(a)){const n=i.getTaggedTemplateTemplate(a);s.push(n),r.push({parts:i.getTemplateParts(n),tag:i.getTagText(a)})}else i.isTemplate(a)&&!s.includes(a)&&r.push({parts:i.getTemplateParts(a)})}),r},"parseLiterals");var $=Object.defineProperty,C=g((t,e)=>$(t,"name",{value:e,configurable:!0}),"f");const S={One:"1",Two:"2",Zero:"0"},F=C(t=>{const e={[S.One]:{tidySelectors:!1,transform:void 0},[S.Two]:{tidySelectors:!1,transform:void 0},[S.Zero]:{}};if(t===void 0)return e;if(typeof t=="number"){const i=t.toString();return{...e,[i]:{...e[i]}}}return t},"optimizationLevelFrom"),P=C((t,e)=>{const i=/(:.+\((.*)\))\s*\{/g;let r;for(;(r=i.exec(t))!==null;){const s=r[1],a=r[2];if(!s||!a||!/\s/.test(a))continue;const n=a.replaceAll(/\s/g,""),o=s.replace(a,n),f=e.indexOf(o);if(f===-1)continue;const u=f+o.length;e=e.slice(0,Math.max(0,f))+s+e.slice(Math.max(0,u))}return e},"fixCleanCssTidySelectors"),R={},B={caseSensitive:!0,collapseWhitespace:!0,decodeEntities:!0,minifyCSS:R,minifyJS:!0,processConditionalComments:!0,removeAttributeQuotes:!1,removeComments:!0,removeEmptyAttributes:!0,removeScriptTypeAttributes:!0,removeStyleLinkTypeAttributes:!0,useShortDoctype:!0},x=C((t={})=>{const e=F(t.level),i=typeof t.level=="object"&&t.level[1]&&t.level[1].transform;return e[S.One].transform=(r,s)=>s.startsWith("@TEMPLATE_EXPRESSION")&&!s.endsWith(";")?s=`${s};`:i?i(r,s):s,{...t,level:e}},"adjustMinifyCSSOptions"),_={combineHTMLStrings(t,e){return t.map(i=>i.text).join(e)},getPlaceholder(t){let e="@TEMPLATE_EXPRESSION";for(;t.some(i=>i.text.includes(e+"();"));)e+="_";return e+"();"},minifyCSS(t,e={}){const i=x(e),r=new N(i).minify(t);if(r.errors&&r.errors.length>0)throw new Error(r.errors.join(`
1
+ var b=Object.defineProperty;var g=(t,e)=>b(t,"name",{value:e,configurable:!0});import{createFilter as E}from"@rollup/pluginutils";import H from"magic-string";import p from"typescript";import N from"clean-css";import{minify as j}from"html-minifier-next";let y;const A={getHeadTemplatePart(t){const e=t.getFullText(y),i=e.indexOf("`")+1,r=p.isTemplateHead(t)?-2:-1;return{end:t.end+r,start:t.pos+i,text:e.slice(i,e.length+r)}},getMiddleTailTemplatePart(t){const e=t.getText(y),i=p.isTemplateMiddle(t)?2:1;return{end:t.end-i,start:t.getStart(y)+1,text:e.slice(1,e.length-i)}},getRootNode(t,e=""){return p.createSourceFile(e,t,p.ScriptTarget.ESNext)},getTaggedTemplateTemplate(t){return t.template},getTagText(t){return t.tag.getText(y)},getTemplateParts(t){return p.isNoSubstitutionTemplateLiteral(t)?[this.getHeadTemplatePart(t)]:[this.getHeadTemplatePart(t.head),...t.templateSpans.map(e=>this.getMiddleTailTemplatePart(e.literal))]},isTaggedTemplate:p.isTaggedTemplateExpression,isTemplate:p.isTemplateLiteral,walkChildNodes(t,e){e(t),p.forEachChild(t,i=>{this.walkChildNodes(i,e)})},walkNodes(t,e){y=t,this.walkChildNodes(t,e),y=void 0}};var k=Object.defineProperty,V=g((t,e)=>k(t,"name",{value:e,configurable:!0}),"i");const W=V((t,e={})=>{const i={...A,...e.strategy},r=[],s=[];return i.walkNodes(i.getRootNode(t,e.fileName),a=>{if(i.isTaggedTemplate(a)){const n=i.getTaggedTemplateTemplate(a);s.push(n),r.push({parts:i.getTemplateParts(n),tag:i.getTagText(a)})}else i.isTemplate(a)&&!s.includes(a)&&r.push({parts:i.getTemplateParts(a)})}),r},"parseLiterals");var $=Object.defineProperty,O=g((t,e)=>$(t,"name",{value:e,configurable:!0}),"f");const S={One:"1",Two:"2",Zero:"0"},F=O(t=>{const e={[S.One]:{tidySelectors:!1,transform:void 0},[S.Two]:{tidySelectors:!1,transform:void 0},[S.Zero]:{}};if(t===void 0)return e;if(typeof t=="number"){const i=t.toString();return{...e,[i]:{...e[i]}}}return t},"optimizationLevelFrom"),C=O((t,e)=>{const i=/(:.+\((.*)\))\s*\{/g;let r;for(;(r=i.exec(t))!==null;){const s=r[1],a=r[2];if(!s||!a||!/\s/.test(a))continue;const n=a.replaceAll(/\s/g,""),o=s.replace(a,n),f=e.indexOf(o);if(f===-1)continue;const u=f+o.length;e=e.slice(0,Math.max(0,f))+s+e.slice(Math.max(0,u))}return e},"fixCleanCssTidySelectors"),R={},B={caseSensitive:!0,collapseWhitespace:!0,decodeEntities:!0,minifyCSS:R,minifyJS:!0,removeAttributeQuotes:!1,removeComments:!0,removeEmptyAttributes:!0,removeScriptTypeAttributes:!0,removeStyleLinkTypeAttributes:!0,useShortDoctype:!0},x=O((t={})=>{const e=F(t.level),i=typeof t.level=="object"&&t.level[1]&&t.level[1].transform;return e[S.One].transform=(r,s)=>s.startsWith("@TEMPLATE_EXPRESSION")&&!s.endsWith(";")?s=`${s};`:i?i(r,s):s,{...t,level:e}},"adjustMinifyCSSOptions"),_={combineHTMLStrings(t,e){return t.map(i=>i.text).join(e)},getPlaceholder(t){let e="@TEMPLATE_EXPRESSION";for(;t.some(i=>i.text.includes(e+"();"));)e+="_";return e+"();"},minifyCSS(t,e={}){const i=x(e),r=new N(i).minify(t);if(r.errors&&r.errors.length>0)throw new Error(r.errors.join(`
2
2
 
3
- `));return i.level?.[S.One]?.tidySelectors&&(r.styles=P(t,r.styles)),r.styles},async minifyHTML(t,e={}){let i;e.minifyCSS?i=e.minifyCSS!==!0&&typeof e.minifyCSS!="function"?{...e.minifyCSS}:{}:i=!1;let r=!1;i&&(r=x(i));let s=await j(t,{...e,minifyCSS:r});if(e.collapseWhitespace){const a=[...s.matchAll(/<svg/g)].reverse();for(const n of a){const o=n.index,f=s.indexOf("</svg",o);if(f===-1)continue;const u=s.slice(0,Math.max(0,o));let l=s.substring(o,f);const d=s.slice(Math.max(0,f));l=l.replaceAll(/\r?\n/g,""),s=u+l+d}}return r&&r.level?.[S.One]?.tidySelectors&&(s=P(t,s)),s},splitHTMLByPlaceholder(t,e){const i=t.split(e);if(e.endsWith(";")){const r=e.slice(0,Math.max(0,e.length-1));for(let s=i.length-1;s>=0;s--){const a=i[s];a!==void 0&&i.splice(s,1,...a.split(r))}}return i}};var G=Object.defineProperty,M=g((t,e)=>G(t,"name",{value:e,configurable:!0}),"l");const I=M((t,e)=>t.generateMap({file:`${e}.map`,hires:!0,source:e}),"defaultGenerateSourceMap"),X=M(t=>{const e=t.tag&&t.tag.toLowerCase();return!!e&&(e.includes("html")||e.includes("svg"))},"defaultShouldMinify"),Z=M(t=>!!t.tag&&t.tag.toLowerCase().includes("css"),"defaultShouldMinifyCSS"),z={ensureHTMLPartsValid(t,e){if(t.length!==e.length)throw new Error("splitHTMLByPlaceholder() must return same number of strings as template parts")},ensurePlaceholderValid(t){if(typeof t!="string"||t.length===0)throw new Error("getPlaceholder() must return a non-empty string")}};async function w(t,e={}){e.minifyOptions={...B,...e.minifyOptions},e.MagicString||(e.MagicString=H),e.parseLiterals||(e.parseLiterals=W),e.shouldMinify||(e.shouldMinify=X),e.shouldMinifyCSS||(e.shouldMinifyCSS=Z),e.parseLiteralsOptions={fileName:e.fileName,...e.parseLiteralsOptions};const i=e.parseLiterals(t,e.parseLiteralsOptions),r=e.strategy||_,{shouldMinify:s,shouldMinifyCSS:a}=e;let n;e.validate!==!1&&(n=e.validate||z);const o=new e.MagicString(t);for(const l of i){const d=s(l),O=!!r.minifyCSS&&a(l);if(d||O){const v=r.getPlaceholder(l.parts);n&&n.ensurePlaceholderValid(v);const T=r.combineHTMLStrings(l.parts,v);let h;if(O){const c=(e.minifyOptions||{}).minifyCSS;if(typeof c=="function"){const m=c(T);h=typeof m=="string"?m:await m}else if(c===!1)h=T;else{const m=typeof c=="object"?c:void 0;h=await r.minifyCSS(T,m)}}else h=await r.minifyHTML(T,e.minifyOptions);const L=r.splitHTMLByPlaceholder(h,v);n&&n.ensureHTMLPartsValid(l.parts,L),l.parts.forEach((c,m)=>{c.start<c.end&&L[m]!==void 0&&o.overwrite(c.start,c.end,L[m])})}}const f=o.toString();if(t===f)return;let u;return e.generateSourceMap!==!1&&(u=(e.generateSourceMap||I)(o,e.fileName??"")),{code:f,map:u}}g(w,"minifyHTMLLiterals");M(w,"minifyHTMLLiterals");var D=Object.defineProperty,J=g((t,e)=>D(t,"name",{value:e,configurable:!0}),"o");const te=J(({exclude:t,failOnError:e=!1,include:i,logger:r,minifyHTMLLiterals:s,options:a})=>{s||(s=w);const n=E(i,t),o=a||{};return{name:"packem:minify-html-literals",async transform(f,u){if(n(u))try{return await s(f,{...o,fileName:u})}catch(l){const d=l instanceof Error?l.message:l;e?this.error(d):r.warn({message:d,prefix:"plugin:minify-html-literals"})}}}},"minifyHTMLLiteralsPlugin");export{te as default,te as minifyHTMLLiteralsPlugin};
3
+ `));return i.level?.[S.One]?.tidySelectors&&(r.styles=C(t,r.styles)),r.styles},async minifyHTML(t,e={}){let i;e.minifyCSS?i=e.minifyCSS!==!0&&typeof e.minifyCSS!="function"?{...e.minifyCSS}:{}:i=!1;let r=!1;i&&(r=x(i));let s=await j(t,{...e,minifyCSS:r});if(e.collapseWhitespace){const a=[...s.matchAll(/<svg/g)].reverse();for(const n of a){const o=n.index,f=s.indexOf("</svg",o);if(f===-1)continue;const u=s.slice(0,Math.max(0,o));let l=s.substring(o,f);const d=s.slice(Math.max(0,f));l=l.replaceAll(/\r?\n/g,""),s=u+l+d}}return r&&r.level?.[S.One]?.tidySelectors&&(s=C(t,s)),s},splitHTMLByPlaceholder(t,e){const i=t.split(e);if(e.endsWith(";")){const r=e.slice(0,Math.max(0,e.length-1));for(let s=i.length-1;s>=0;s--){const a=i[s];a!==void 0&&i.splice(s,1,...a.split(r))}}return i}};var G=Object.defineProperty,M=g((t,e)=>G(t,"name",{value:e,configurable:!0}),"l");const I=M((t,e)=>t.generateMap({file:`${e}.map`,hires:!0,source:e}),"defaultGenerateSourceMap"),X=M(t=>{const e=t.tag&&t.tag.toLowerCase();return!!e&&(e.includes("html")||e.includes("svg"))},"defaultShouldMinify"),Z=M(t=>!!t.tag&&t.tag.toLowerCase().includes("css"),"defaultShouldMinifyCSS"),z={ensureHTMLPartsValid(t,e){if(t.length!==e.length)throw new Error("splitHTMLByPlaceholder() must return same number of strings as template parts")},ensurePlaceholderValid(t){if(typeof t!="string"||t.length===0)throw new Error("getPlaceholder() must return a non-empty string")}};async function w(t,e={}){e.minifyOptions={...B,...e.minifyOptions},e.MagicString||(e.MagicString=H),e.parseLiterals||(e.parseLiterals=W),e.shouldMinify||(e.shouldMinify=X),e.shouldMinifyCSS||(e.shouldMinifyCSS=Z),e.parseLiteralsOptions={fileName:e.fileName,...e.parseLiteralsOptions};const i=e.parseLiterals(t,e.parseLiteralsOptions),r=e.strategy||_,{shouldMinify:s,shouldMinifyCSS:a}=e;let n;e.validate!==!1&&(n=e.validate||z);const o=new e.MagicString(t);for(const l of i){const d=s(l),P=!!r.minifyCSS&&a(l);if(d||P){const v=r.getPlaceholder(l.parts);n&&n.ensurePlaceholderValid(v);const T=r.combineHTMLStrings(l.parts,v);let h;if(P){const c=(e.minifyOptions||{}).minifyCSS;if(typeof c=="function"){const m=c(T);h=typeof m=="string"?m:await m}else if(c===!1)h=T;else{const m=typeof c=="object"?c:void 0;h=await r.minifyCSS(T,m)}}else h=await r.minifyHTML(T,e.minifyOptions);const L=r.splitHTMLByPlaceholder(h,v);n&&n.ensureHTMLPartsValid(l.parts,L),l.parts.forEach((c,m)=>{c.start<c.end&&L[m]!==void 0&&o.overwrite(c.start,c.end,L[m])})}}const f=o.toString();if(t===f)return;let u;return e.generateSourceMap!==!1&&(u=(e.generateSourceMap||I)(o,e.fileName??"")),{code:f,map:u}}g(w,"minifyHTMLLiterals");M(w,"minifyHTMLLiterals");var D=Object.defineProperty,J=g((t,e)=>D(t,"name",{value:e,configurable:!0}),"o");const te=J(({exclude:t,failOnError:e=!1,include:i,logger:r,minifyHTMLLiterals:s,options:a})=>{s||(s=w);const n=E(i,t),o=a||{};return{name:"packem:minify-html-literals",async transform(f,u){if(n(u))try{return await s(f,{...o,fileName:u})}catch(l){const d=l instanceof Error?l.message:l;e?this.error(d):r.warn({message:d,prefix:"plugin:minify-html-literals"})}}}},"minifyHTMLLiteralsPlugin");export{te as default,te as minifyHTMLLiteralsPlugin};
@@ -1,4 +1,3 @@
1
- export { default as isolatedDeclarationsOxcTransformer } from "./isolated-declarations-oxc-transformer.d.ts";
2
1
  export { default as oxcResolvePlugin } from "./oxc-resolve-plugin.d.ts";
3
2
  export { default as oxcTransformPlugin } from "./oxc-transformer-plugin.d.ts";
4
3
  export type { InternalOXCTransformPluginConfig, OxcResolveOptions, OXCTransformPluginConfig } from "./types.d.ts";
@@ -1 +1 @@
1
- import{default as a}from"../../packem_shared/isolatedDeclarationsOxcTransformer-C_F9Dh38.js";import{default as f}from"../../packem_shared/oxcResolvePlugin-Ccef6pyL.js";import{default as s}from"../../packem_shared/oxcTransformPlugin-BGmQroQ4.js";export{a as isolatedDeclarationsOxcTransformer,f as oxcResolvePlugin,s as oxcTransformPlugin};
1
+ import{default as r}from"../../packem_shared/oxcResolvePlugin-Ccef6pyL.js";import{default as f}from"../../packem_shared/oxcTransformPlugin-BGmQroQ4.js";export{r as oxcResolvePlugin,f as oxcTransformPlugin};
@@ -1,3 +1,2 @@
1
- export { default as isolatedDeclarationsSwcTransformer } from "./isolated-declarations-swc-transformer.d.ts";
2
1
  export { default as swcPlugin } from "./swc-plugin.d.ts";
3
2
  export type * from "./types.d.ts";
@@ -1 +1 @@
1
- import{default as e}from"../../packem_shared/isolatedDeclarationsSwcTransformer-Ch2AgtWC.js";import{default as s}from"../../packem_shared/swcPlugin-Boip4lWG.js";export{e as isolatedDeclarationsSwcTransformer,s as swcPlugin};
1
+ import{default as f}from"../../packem_shared/swcPlugin-Boip4lWG.js";export{f as swcPlugin};
@@ -1,4 +1,3 @@
1
- export { default as isolatedDeclarationsTypescriptTransformer } from "./isolated-declarations-typescript-transformer.d.ts";
2
1
  export type { PatchTypesOptions } from "./patch-typescript-types.d.ts";
3
2
  export { patchTypescriptTypes } from "./patch-typescript-types.d.ts";
4
3
  export { patchTypescriptTypes as patchTypescriptTypesPlugin } from "./patch-typescript-types.d.ts";
@@ -1 +1 @@
1
- import{default as s}from"../../packem_shared/isolatedDeclarationsTypescriptTransformer-DkuEkofo.js";import{patchTypescriptTypes as o,patchTypescriptTypes as p}from"../../packem_shared/patchTypescriptTypes-CZ4v3hr9.js";import{resolveTsconfigPathsPlugin as i}from"../../packem_shared/resolveTsconfigPathsPlugin-CEasmDpi.js";import{default as l}from"../../packem_shared/resolveTsconfigRootDirectoriesPlugin-Cwj3tqCJ.js";import{default as T}from"../../packem_shared/resolveTypescriptMjsCtsPlugin-DX9at4BX.js";export{s as isolatedDeclarationsTypescriptTransformer,o as patchTypescriptTypes,p as patchTypescriptTypesPlugin,i as resolveTsconfigPathsPlugin,l as resolveTsconfigRootDirectoriesPlugin,T as resolveTypescriptMjsCtsPlugin};
1
+ import{patchTypescriptTypes as p,patchTypescriptTypes as r}from"../../packem_shared/patchTypescriptTypes-CZ4v3hr9.js";import{resolveTsconfigPathsPlugin as o}from"../../packem_shared/resolveTsconfigPathsPlugin-CEasmDpi.js";import{default as c}from"../../packem_shared/resolveTsconfigRootDirectoriesPlugin-Cwj3tqCJ.js";import{default as l}from"../../packem_shared/resolveTypescriptMjsCtsPlugin-DX9at4BX.js";export{p as patchTypescriptTypes,r as patchTypescriptTypesPlugin,o as resolveTsconfigPathsPlugin,c as resolveTsconfigRootDirectoriesPlugin,l as resolveTypescriptMjsCtsPlugin};
package/dist/types.d.ts CHANGED
@@ -17,7 +17,6 @@ import type { DataUriPluginOptions } from "./plugins/data-uri.d.ts";
17
17
  import type { DebarrelPluginOptions } from "./plugins/debarrel.d.ts";
18
18
  import type { EsbuildPluginConfig, Options as EsbuildOptions } from "./plugins/esbuild/types.d.ts";
19
19
  import type { EsmShimCjsSyntaxOptions } from "./plugins/esm-shim-cjs-syntax.d.ts";
20
- import type { IsolatedDeclarationsOptions } from "./plugins/isolated-declarations/index.d.ts";
21
20
  import type { JSXRemoveAttributesPlugin } from "./plugins/jsx-remove-attributes.d.ts";
22
21
  import type { LicenseOptions } from "./plugins/license.d.ts";
23
22
  import type { MinifyHTMLLiteralsOptions } from "./plugins/minify-html-literals/index.d.ts";
@@ -68,12 +67,6 @@ export interface ExtendedRollupNodeResolveOptions extends RollupNodeResolveOptio
68
67
  */
69
68
  unresolvedImportBehavior?: "error" | "warn";
70
69
  }
71
- export interface IsolatedDeclarationsResult {
72
- errors: string[];
73
- map?: string;
74
- sourceText: string;
75
- }
76
- export type IsolatedDeclarationsTransformer = (code: string, id: string, sourceMap?: boolean) => Promise<IsolatedDeclarationsResult>;
77
70
  export interface PackemRollupOptions {
78
71
  alias?: RollupAliasOptions | false;
79
72
  babel?: BabelPluginConfig | false;
@@ -88,7 +81,6 @@ export interface PackemRollupOptions {
88
81
  experimental?: {
89
82
  resolve?: OxcResolveOptions | false;
90
83
  };
91
- isolatedDeclarations?: IsolatedDeclarationsOptions;
92
84
  json?: RollupJsonOptions | false;
93
85
  jsxRemoveAttributes?: JSXRemoveAttributesPlugin | false;
94
86
  license?: LicenseOptions | false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visulima/packem-rollup",
3
- "version": "1.0.0-alpha.50",
3
+ "version": "1.0.0-alpha.52",
4
4
  "description": "Rollup plugins for packem",
5
5
  "keywords": [
6
6
  "visulima",
@@ -93,10 +93,6 @@
93
93
  "types": "./dist/plugins/fix-dts-default-cjs-exports.d.ts",
94
94
  "default": "./dist/plugins/fix-dts-default-cjs-exports.js"
95
95
  },
96
- "./plugin/isolated-declarations": {
97
- "types": "./dist/plugins/isolated-declarations/index.d.ts",
98
- "default": "./dist/plugins/isolated-declarations/index.js"
99
- },
100
96
  "./plugin/jsx-remove-attributes": {
101
97
  "types": "./dist/plugins/jsx-remove-attributes.d.ts",
102
98
  "default": "./dist/plugins/jsx-remove-attributes.js"
@@ -155,20 +151,20 @@
155
151
  "@rollup/plugin-replace": "6.0.3",
156
152
  "@rollup/plugin-wasm": "6.2.2",
157
153
  "@rollup/pluginutils": "5.3.0",
158
- "@visulima/find-cache-dir": "2.0.7",
159
- "@visulima/fs": "4.1.0",
160
- "@visulima/package": "4.1.7",
161
- "@visulima/packem-share": "1.0.0-alpha.31",
162
- "@visulima/path": "2.0.5",
163
- "@visulima/rollup-plugin-dts": "1.0.0-alpha.11",
164
- "@visulima/source-map": "2.0.5",
154
+ "@visulima/find-cache-dir": "3.0.0-alpha.9",
155
+ "@visulima/fs": "5.0.0-alpha.12",
156
+ "@visulima/package": "5.0.0-alpha.11",
157
+ "@visulima/packem-share": "1.0.0-alpha.33",
158
+ "@visulima/path": "3.0.0-alpha.10",
159
+ "@visulima/rollup-plugin-dts": "1.0.0-alpha.13",
160
+ "@visulima/source-map": "3.0.0-alpha.9",
165
161
  "cjs-module-lexer": "2.2.0",
166
162
  "clean-css": "^5.3.3",
167
163
  "glob-parent": "6.0.2",
168
164
  "html-minifier-next": "6.1.2",
169
165
  "magic-string": "0.30.21",
170
166
  "mlly": "1.8.2",
171
- "oxc-parser": "0.126.0",
167
+ "oxc-parser": "0.127.0",
172
168
  "oxc-resolver": "11.19.1",
173
169
  "rollup-plugin-license": "3.7.1",
174
170
  "rollup-plugin-polyfill-node": "0.13.0",
@@ -1,26 +0,0 @@
1
- var A=Object.defineProperty;var v=(a,t)=>A(a,"name",{value:t,configurable:!0});import y from"magic-string";import{findExports as C,findStaticImports as I,parseStaticImport as N}from"mlly";import{parseSync as b}from"oxc-parser";var T=Object.defineProperty,g=v((a,t)=>T(a,"name",{value:t,configurable:!0}),"h");const _=g((a,t,n)=>{const l=C(a).find(e=>e.names?.includes("default")),r=a.match(/^export\s+default\s+(\w+);/m);if(r&&r[1])return{defaultAlias:r[1],defaultExport:{code:r[0],end:r.index===void 0?void 0:r.index+r[0].length,names:["default"],specifier:void 0,start:r.index,type:"default"},exports:[]};if(!l)return;const p=l.code.match(/export\s*\{([^}]*)\}/);if(!p?.length){n.warn?.(`A default export was indicated in ${t.fileName}, but its structure could not be parsed.`);return}let i;const c=[];for(const e of p[1].split(",").map(o=>o.trim())){if(e==="default"){i=e;continue}const o=e.match(/\s*as\s+default\s*/);o?i=e.replace(o[0],""):c.push(e)}if(!i){n.warn?.(`A default export was indicated in ${t.fileName}, but its alias could not be determined from the export statement.`);return}return{defaultAlias:i,defaultExport:l,exports:c}},"extractExports"),j=g((a,t,n)=>{if("declarations"in t&&t.declarations.length>0){const l=t.declarations[0];if(l&&l.id.type==="Identifier"){a.set(l.id.name,{declare:t.declare===!0,end:t.end,isVariable:!0,start:t.start});return}}if("id"in t&&t.id&&t.id.type==="Identifier"){const{name:l}=t.id;a.set(l,{declare:t.declare===!0,end:t.end,isClass:t.type==="ClassDeclaration",start:t.start});return}a.set(n(),{declare:t.declare===!0,end:t.end,start:t.start})},"prepareDeclaration"),E=g((a,t,n,l)=>{const r=b(n.fileName,a,{astType:"ts",lang:"ts",sourceType:"module"});let p,i=0;const c=g(()=>(i+=1,`__unnamed_${i}$$`),"generateUnnamed"),e=new Map,o=new Map,{program:m}=r;for(const s of m.body)if(s.type==="ExportNamedDeclaration")for(const d of s.specifiers)d.exported.type==="Identifier"&&(d.exported.name==="default"?d.local.type==="Identifier"&&(p={end:d.end,local:d.local.name,start:d.start}):d.exported.type==="Identifier"&&o.set(d.exported.name,{type:d.exportKind==="type"}));else{if(s.type==="ImportDeclaration")continue;switch(s.type){case"ClassDeclaration":case"FunctionDeclaration":case"TSDeclareFunction":case"TSEnumDeclaration":case"TSInterfaceDeclaration":case"TSTypeAliasDeclaration":case"VariableDeclaration":{j(e,s,c);break}case"TSImportEqualsDeclaration":case"TSModuleDeclaration":{e.set(c(),{declare:!1,end:s.end,start:s.start});break}}}const x=[];if(p)for(const[s,d]of o.entries())s!==p.local&&d.type&&x.push(s);if(!p){const s=[...o.values()].every(d=>d.type);return t.startsWith("export type")&&o.size>0&&s||l.warn?.(`Cannot infer default export from the file: ${n.fileName}`),t}if(!e.get(p.local))return l.warn?.(`Cannot infer default export from the file: ${n.fileName}. Declaration for '${p.local}' not found.`),t;const u=t,f=new y(`${u}
2
- declare namespace ${p.local} {
3
- `);for(const[s,d]of e.entries()){if(x.includes(s)&&s!==p.local)continue;const h=a.slice(d.start,d.end).replace(/\s+\}$/," }");f.append(" "),d.declare?f.append(h.replace("declare","export").replaceAll(" "," ")):f.append(`export ${h}`.replaceAll(" "," ")),f.append(`
4
- `)}return f.append(` import _default = ${p.local};
5
- export { _default as default };
6
- `),f.append(`}
7
- export = ${p.local};
8
- `),f.toString()},"createCjsNamespace"),D=g((a,t,n)=>{const{defaultExport:l,exports:r}=t;if(n){let x="";x=r.length===0?`export = ${n.defaultImport};`:`// @ts-ignore
9
- export = ${n.defaultImport};
10
- export { ${r.join(", ")} } from '${l.specifier}'`;const u=a.replace(l.code.replace(/;$/,""),x.replace(/;$/,""));return u.endsWith(";")?u:`${u};`}const p=`import _default from '${l.specifier}';`,i=new y(a),c=I(a),e=c.length>0?c.at(-1):void 0;e?.end!==void 0&&e.end>0?i.appendRight(e.end,`
11
- ${p}
12
- `):i.prepend(`${p}
13
- `);let o=i.toString();o=o.replaceAll(/(\r?\n\s*){2,}/g,`
14
- `);let m;if(r.length===0)m=o.replace(l.code.replace(/;$/,""),"export = _default");else{const x=`// @ts-ignore
15
- export = _default;
16
- export { ${r.join(", ")} } from '${l.specifier}';`;m=o.replace(l.code.replace(/;$/,""),x)}return m.replaceAll(";;",";")},"handleDefaultCJSExportAsDefault"),M=g((a,t,n,l,r,p)=>{const{defaultAlias:i,defaultExport:c,exports:e}=n;if(p){if(p.namedImports?.[i]===i){if(e.length===0)return a.replace(c.code,`export = ${i}`);const f=`export { ${e.join(", ")} } from '${c.specifier}'`,s=new y(a).replace(c.code,f).toString();return E(a,s,t,r)}r.warn?.(`Cannot parse "${i}" named export from ${p.specifier} import at ${t.fileName}!.`);return}const o=`import { ${i} } from '${c.specifier}';
17
- `;let m=a;const x=l.length>0?l.at(-1)?.end??0:0,u=new y(m);if(x>0?u.appendRight(x,`
18
- ${o}`):u.prepend(o),m=u.toString(),e.length>0){const f=`export { ${e.join(", ")} } from '${c.specifier}'`,s=new y(m).replace(c.code,f).toString();return E(a,s,t,r)}return new y(m).replace(c.code,`export = ${i}`).toString()},"handleDefaultNamedCJSExport"),w=g((a,t,{defaultAlias:n,defaultExport:l,exports:r},p)=>{const i=r.filter(e=>/^type\s+/.test(e)),c=r.filter(e=>!/^type\s+/.test(e));if(i.length>0){let e="";return n&&(e+=`// @ts-ignore
19
- ${n};
20
- `),e+=`export type { ${i.map(o=>o.replace(/^type\s+/,"").trim()).join(", ")} };
21
- `,c.length>0&&(e+=`export { ${c.join(", ")} };
22
- `),E(a,e.trim(),t,p)}if(n&&c.length>0&&i.length===0){let e=`// @ts-ignore
23
- ${n};
24
- `;return e+=`export { ${c.join(", ")} };
25
- `,E(a,e.trim(),t,p)}if(n&&c.length===0&&i.length===0){const e=new RegExp(String.raw`^export\\s+default\\s+${n};`,"m"),o=a.match(e);return o?`${a.slice(0,Math.max(0,o.index??0))}export = ${n};`:a.replace(l.code,`export = ${n};`).replace(";;",";")}},"handleNoSpecifierDefaultCJSExport"),J=/^export\s+default\s+from\s+['"]([^'"]+)['"];?$/m,O=g((a,t,n)=>{const l=a.match(J);if(l)return{code:`import _default from '${l[1]}';
26
- export = _default;`,map:void 0};const r=_(a,t,n);if(r){let e;if(r.defaultExport.specifier){const{specifier:o}=r.defaultExport,m=I(a),x=m.filter($=>$.imports).map($=>N($)),u=x.find($=>$.specifier===o),{defaultAlias:f,defaultExport:s,exports:d}=r,h=s.exports;if(f==="default"&&s.specifier&&d.length>0)e=D(a,r,u);else if(f==="default"&&s.specifier&&d.length===0&&h&&/\bas\s+default\b/.test(h))x.find($=>$.specifier===s.specifier)?.defaultImport?e=D(a,r,u):(n.warn?.(`Cannot parse default export name from ${s.specifier} import at ${t.fileName}!. The module might not have a default export, or it's aliased as 'default'.`),e=void 0);else if(f==="default"&&s.specifier&&d.length===0)e=D(a,r,u);else if(s.specifier&&f!=="default"){e=M(a,t,r,m,n,u);const $=u&&r.defaultExport.specifier&&f!=="default"&&(!u.namedImports||u.namedImports[f]!==f);if(!(e===void 0&&$)&&e===void 0&&!(f==="default"&&d.length===0&&h&&/\bas\s+default\b/.test(h))){const S=w(a,t,r,n);S&&(e=S)}}}else e=w(a,t,r,n);return e?{code:e,map:void 0}:void 0}const p=b(t.fileName,a,{astType:"ts",lang:"ts",sourceType:"module"});let i=[],c=!1;if(p.program.body.length>0){const e=p.program.body.at(-1);e?.type==="ExportNamedDeclaration"&&!e.declaration&&e.specifiers.length>0&&e.specifiers.every(o=>o.exportKind==="type")&&(c=!0,i=e.specifiers.map(o=>o.local.type==="Identifier"?o.local.name:"").filter(Boolean))}if(c&&i.length>0){const e=`export type { ${i.join(", ")} };`,o=E(a,e,t,n);return o?{code:o,map:void 0}:void 0}},"fixDtsDefaultCJSExports");export{O as _};
@@ -1 +0,0 @@
1
- var m=Object.defineProperty;var o=(e,r)=>m(e,"name",{value:r,configurable:!0});import{isolatedDeclarationSync as n}from"oxc-transform";var i=Object.defineProperty,p=o((e,r)=>i(e,"name",{value:r,configurable:!0}),"r");const d=p((e,r,s,t)=>{const a=n(e,r,{...t,sourcemap:s});return{errors:a.errors?.map(c=>c.message)??[],map:a.map?.mappings,sourceText:a.code}},"isolatedDeclarationsOxcTransformer");export{d as default};
@@ -1 +0,0 @@
1
- var n=Object.defineProperty;var a=(e,r)=>n(e,"name",{value:r,configurable:!0});import{transform as p}from"@swc/core";var c=Object.defineProperty,i=a((e,r)=>c(e,"name",{value:r,configurable:!0}),"e");const l=i(async(e,r,s)=>{try{const t=await p(r,{filename:e,jsc:{experimental:{emitIsolatedDts:!0},parser:{syntax:"typescript",tsx:!1}},sourceMaps:s}),o=JSON.parse(t.output);return{errors:[],map:t.map?JSON.parse(t.map).mappings:void 0,sourceText:o.__swc_isolated_declarations__}}catch(t){return{errors:[t.toString()],sourceText:""}}},"isolatedDeclarationsSwcTransformer");export{l as default};
@@ -1,3 +0,0 @@
1
- var m=Object.defineProperty;var l=(e,t)=>m(e,"name",{value:t,configurable:!0});import{transpileDeclaration as f,formatDiagnostics as D,sys as s}from"typescript";var y=Object.defineProperty,r=l((e,t)=>y(e,"name",{value:t,configurable:!0}),"s");const C=r(e=>{const t=e.split(`
2
- `);return t.at(-1)?.startsWith("//# sourceMappingURL=")?t.slice(0,-1).join(`
3
- `):e},"stripMapUrl"),L=r(async(e,t,u,n)=>{const o={declarationMap:u,...n?.compilerOptions};let{diagnostics:c,outputText:i,sourceMapText:a}=f(t,{fileName:e,reportDiagnostics:!0,...n,compilerOptions:o});o.declarationMap&&(i=C(i));const g=c?.length?[D(c,{getCanonicalFileName:r(p=>s.useCaseSensitiveFileNames?p:p.toLowerCase(),"getCanonicalFileName"),getCurrentDirectory:r(()=>s.getCurrentDirectory(),"getCurrentDirectory"),getNewLine:r(()=>s.newLine,"getNewLine")})]:[];return a&&(a=JSON.parse(a).mappings),{errors:g,map:a,sourceText:i}},"isolatedDeclarationsTypescriptTransformer");export{L as default};
@@ -1,8 +0,0 @@
1
- import type { FilterPattern } from "@rollup/pluginutils";
2
- import type { BuildContext } from "@visulima/packem-share/types";
3
- import type { Plugin } from "rollup";
4
- export type IsolatedDeclarationsOptions = {
5
- exclude?: FilterPattern;
6
- ignoreErrors?: boolean;
7
- };
8
- export declare const isolatedDeclarationsPlugin: <T extends Record<string, any>>(sourceDirectory: string, context: BuildContext<T>) => Plugin;
@@ -1,3 +0,0 @@
1
- var z=Object.defineProperty;var v=(t,e)=>z(t,"name",{value:e,configurable:!0});import{createFilter as J}from"@rollup/pluginutils";import{readFile as K}from"@visulima/fs";import{EXCLUDE_REGEXP as q,ENDING_REGEX as W}from"@visulima/packem-share/constants";import{getDtsExtension as B}from"@visulima/packem-share/utils";import{dirname as M,sep as O,toNamespacedPath as k,extname as A,isAbsolute as H,relative as T,join as I,basename as U}from"@visulima/path";import{parseSync as Q}from"oxc-parser";import{_ as V}from"../../packem_shared/fix-dts-default-cjs-exports-B11TKCnY.js";var Y=Object.defineProperty,Z=v((t,e)=>Y(t,"name",{value:e,configurable:!0}),"e");const R=/^([\w-]+):/,S=Z(t=>{if(!t||typeof t!="string")throw new Error("Invalid key: Key must be a non-empty string.");const e=[],p=R.exec(t);p&&(e.push(p[1]),t=t.replace(R,""));const s=t.split("/");for(const n of s)(n.includes("*")||n)&&e.push(n);return e},"splitTsconfigPathKey");var ee=Object.defineProperty,te=v((t,e)=>ee(t,"name",{value:e,configurable:!0}),"h");const re=te((t,e)=>{const p=t.replace(/^\.\//,""),s=e.replace(/^\.\//,"");if(s.startsWith(p))return t+s.slice(p.length);if(t.endsWith(e))return t;const n=S(t),g=S(e);let m=n.length-1,f=g.length-1;for(;m>=0&&f>=0&&n[m]===g[f];)m--,f--;let r=n.slice(0,m).join("/");const c=g.slice(f).join("/");return(!r.startsWith(".")||r==="")&&(r=r?`./${r}`:"."),r+(c?`/${c}`:"")},"extendString");var ie=Object.defineProperty,oe=v((t,e)=>ie(t,"name",{value:e,configurable:!0}),"s");const ae=oe((...t)=>{if(t.length===0)return"";if(t.length===1)return M(t[0]).split(O).join("/");t=t.map(n=>k(n).split(O).join("/"));const[e,...p]=t;let s=e.split("/");for(const n of p){const g=n.split("/",s.length);let m=0;for(const f of g)if(f===s[m])m+=1;else{s=s.slice(0,m);break}s=s.slice(0,m)}return s.length<=1&&s[0]===""?`/${s[0]}`:s.join("/")},"lowestCommonAncestor");var se=Object.defineProperty,j=v((t,e)=>se(t,"name",{value:e,configurable:!0}),"g");const G=j((t,e)=>`${t}
2
- //# sourceMappingURL=${U(e)}.map
3
- `,"appendMapUrl"),L=j((t,e,p,s)=>{let n=e;return!A(n)&&s&&(n=`${n}${s}`),JSON.stringify({file:U(p),mappings:t,names:[],sourceRoot:"",sources:[T(M(p),n)],version:3})},"generateDtsMap"),E=j(t=>O==="/"?t:t.split(O).join("/"),"toPosix"),ge=j((t,e)=>{const p=J(/\.(?:[mc]?ts|[jt]sx?)$/,e.options.rollup.isolatedDeclarations?.exclude||q),s=E(t);let n=Object.create(null);const g=j((r,c)=>{n[r.replace(W,"")]={...c,ext:A(r)}},"addOutput");let m=[];e.tsconfig?.config.compilerOptions&&(m=Object.entries(e.tsconfig.config.compilerOptions.paths??{}).map(([r])=>r.endsWith("*")?new RegExp(`^${r.replace("*","(.*)")}$`):new RegExp(`^${r}$`)));async function f(r,c){if(!p(c))return;e.logger.debug({message:`Processing file: ${c}`,prefix:"packem:isolated-declarations"});let h;try{h=Q(c,r).program}catch(a){e.logger.debug({message:a.message,prefix:"packem:isolated-declarations"})}if(h){const a=h.body.filter(i=>(i.type==="ImportDeclaration"||i.type==="ExportAllDeclaration"||i.type==="ExportNamedDeclaration")&&i.source);for await(const i of a){if(A(i.source.value)!=="")continue;const o=await this.resolve(i.source.value,c);if(!(!o||o.external)&&(o.id.endsWith(".ts")||o.id.endsWith(".cts")||o.id.endsWith(".mts")||o.id.endsWith(".tsx")||o.id.endsWith(".ctsx")||o.id.endsWith(".mtsx"))){const x=E(o.id).replace(`${s}/`,"");let y=i.source.value;m.some(b=>b.test(i.source.value))&&!i.source.value.startsWith(".")&&(y=`./${i.source.value}`);const $=re(y,x);r=r.replaceAll(`from "${i.source.value}"`,`from "${$}"`),r=r.replaceAll(`from '${i.source.value}'`,`from '${$}'`)}}}const{errors:w,map:D,sourceText:l}=await e.options.isolatedDeclarationTransformer(c,r,e.options.sourcemap,e.tsconfig?.config?.compilerOptions);if(w.length>0){if(e.options.rollup.isolatedDeclarations.ignoreErrors){this.warn(w[0]);return}return this.error(w[0])}if(!l){this.warn(`No source text generated for ${c}`);return}if(g(c,{map:D,source:l}),!h)return;const u=h.body.filter(a=>!("source"in a)||!a.source?!1:"importKind"in a&&a.importKind==="type"||"exportKind"in a&&a.exportKind==="type"?!0:a.type==="ImportDeclaration"?a.specifiers&&a.specifiers.every(i=>i.type==="ImportSpecifier"&&i.importKind==="type"):a.type==="ExportNamedDeclaration"&&a.specifiers&&a.specifiers.every(i=>i.exportKind==="type"));for await(const a of u){if(!a.source)continue;const i=await this.resolve(a.source.value,c);if(!i)return;const o=i.id;if(p(o)&&!n[o.replace(W,"")])try{const x=await K(o);await f.call(this,x,o)}catch{}}}return v(f,"E"),j(f,"transform"),{buildStart(){n=Object.create(null)},name:"packem:isolated-declarations",async renderStart(r,{input:c}){const h=ae(...Array.isArray(c)?c:Object.values(c));e.logger.debug({message:`Input base:${h}`,prefix:"packem:isolated-declarations"});const w=Array.isArray(c)?c:Object.values(c);for await(const l of w)if(p(l)&&!n[l.replace(W,"")])try{const u=await K(l);await f.call(this,u,l)}catch{}typeof r.entryFileNames=="function"&&(r.entryFileNames=r.entryFileNames({name:r.name}));const D=r.entryFileNames.replace(/\.(.)?[jt]sx?$/,(l,u)=>`.d.${u||""}ts`);for await(let[l,{ext:u,map:a,source:i}]of Object.entries(n)){let o;const x=l;if(H(l)){if(!E(l).startsWith(s)){e.logger.debug({message:`Skipping file outside sourceDirectory: ${l}`,prefix:"packem:isolated-declarations"});continue}o=E(T(t,l))}else o=E(l).replace(`${s}/`,"");if(o.startsWith("/")&&(o=o.slice(1)),e.options.rollup.cjsInterop&&r.format==="cjs"){const d=V(i,{fileName:o,imports:[]},{warn:this.warn});d&&(i=d.code)}const y=i.includes("from '")?"'":'"',$=o+u;if((e.options.declaration===!0||e.options.declaration==="compatible")&&r.format==="cjs"){e.logger.debug({message:`Emit compatible dts file: ${o}`,prefix:"packem:isolated-declarations"});const d=D.replace("[name]",k(o)).replace(".cts",".ts");let N=i;e.options.sourcemap&&a&&(N=G(N.trim(),d),this.emitFile({fileName:`${d}.map`,originalFileName:$,source:L(a,x,I(r.dir,d),u),type:"asset"})),this.emitFile({fileName:d,originalFileName:$,source:N.replaceAll(/(from\s)['|"]((.*)\..+|['|"].*)['|"];?/g,(P,F,_,C)=>`${F+y+(C||_)}.d.ts${y};`),type:"asset"})}e.logger.debug({message:`Emit dts file: ${o}`,prefix:"packem:isolated-declarations"});const b=D.replace("[name]",k(o));e.options.sourcemap&&a&&(i=G(i.trim(),b),this.emitFile({fileName:`${b}.map`,originalFileName:$,source:L(a,x,I(r.dir,b),u),type:"asset"}));const X=B(e,r.format==="cjs"?"cjs":"esm");this.emitFile({fileName:b,originalFileName:$,source:i.replaceAll(/(from\s)['|"]((.*)\..+|['|"].*)['|"];?/g,(d,N,P,F)=>`${N+y+(F||P)}.${X}${y};`),type:"asset"})}},transform:f}},"isolatedDeclarationsPlugin");export{ge as isolatedDeclarationsPlugin};
@@ -1,2 +0,0 @@
1
- declare const extendString: (baseString: string, referenceString: string) => string;
2
- export default extendString;
@@ -1,2 +0,0 @@
1
- declare const lowestCommonAncestor: (...filepaths: string[]) => string;
2
- export default lowestCommonAncestor;
@@ -1,2 +0,0 @@
1
- declare const splitTsconfigPathKey: (key: string) => string[];
2
- export default splitTsconfigPathKey;
@@ -1,4 +0,0 @@
1
- import type { IsolatedDeclarationsOptions } from "oxc-transform";
2
- import type { IsolatedDeclarationsResult } from "../../types.d.ts";
3
- declare const isolatedDeclarationsOxcTransformer: (id: string, code: string, sourceMap?: boolean, transformOptions?: Omit<IsolatedDeclarationsOptions, "sourcemap">) => IsolatedDeclarationsResult;
4
- export default isolatedDeclarationsOxcTransformer;
@@ -1,3 +0,0 @@
1
- import type { IsolatedDeclarationsResult } from "../../types.d.ts";
2
- declare const isolatedDeclarationsSwcTransformer: (id: string, code: string, sourceMap?: boolean) => Promise<IsolatedDeclarationsResult>;
3
- export default isolatedDeclarationsSwcTransformer;
@@ -1,4 +0,0 @@
1
- import type { TranspileOptions } from "typescript";
2
- import type { IsolatedDeclarationsResult } from "../../types.d.ts";
3
- declare const isolatedDeclarationsTypescriptTransformer: (id: string, code: string, sourceMap?: boolean, transformOptions?: TranspileOptions) => Promise<IsolatedDeclarationsResult>;
4
- export default isolatedDeclarationsTypescriptTransformer;