This repository was archived by the owner on Jul 6, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 7 files changed +22
-14
lines changed Expand file tree Collapse file tree 7 files changed +22
-14
lines changed Original file line number Diff line number Diff line change @@ -76,7 +76,9 @@ export class Bundler {
76
76
}
77
77
} )
78
78
79
- await this . bundlePolyfillChunck ( )
79
+ if ( this . #app. config . buildTarget !== 'esnext' ) {
80
+ await this . bundlePolyfillChunck ( )
81
+ }
80
82
await this . bundleChunk (
81
83
'deps' ,
82
84
Array . from ( remoteEntries ) ,
@@ -203,11 +205,12 @@ export class Bundler {
203
205
private async bundlePolyfillChunck ( ) {
204
206
const alephPkgUri = getAlephPkgUri ( )
205
207
const { buildTarget } = this . #app. config
206
- const hash = computeHash ( buildTarget + Deno . version . deno + VERSION )
208
+ const polyfillTarget = 'es' + ( parseInt ( buildTarget . slice ( 2 ) ) + 1 )
209
+ const hash = computeHash ( polyfillTarget + '/[email protected] /' + VERSION )
207
210
const bundleFilename = `polyfill.bundle.${ hash . slice ( 0 , hashShort ) } .js`
208
211
const bundleFilePath = join ( this . #app. buildDir , bundleFilename )
209
212
if ( ! existsFileSync ( bundleFilePath ) ) {
210
- const rawPolyfillFile = `${ alephPkgUri } /bundler/polyfills/${ buildTarget } /mod.ts`
213
+ const rawPolyfillFile = `${ alephPkgUri } /bundler/polyfills/${ polyfillTarget } /mod.ts`
211
214
await this . build ( rawPolyfillFile , bundleFilePath )
212
215
}
213
216
this . #bundledFiles. set ( 'polyfill' , bundleFilename )
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
1
import flatShim from 'https://esm.sh/array.prototype.flat/shim'
2
- import flatmapShim from 'https://esm.sh/array.prototype.flatmap/shim'
2
+ import flatMapShim from 'https://esm.sh/array.prototype.flatmap/shim'
3
3
import descriptionShim from 'https://esm.sh/symbol.prototype.description/shim'
4
- import fromentriesShim from 'https://esm.sh/object.fromentries/shim'
4
+ import fromEntriesShim from 'https://esm.sh/object.fromentries/shim'
5
+ import trimStartShim from 'https://esm.sh/string.prototype.trimstart/shim'
6
+ import trimEndShim from 'https://esm.sh/string.prototype.trimend/shim'
7
+
5
8
import '../es2020/mod.ts'
6
9
7
10
flatShim ( )
8
- flatmapShim ( )
11
+ flatMapShim ( )
9
12
descriptionShim ( )
10
- fromentriesShim ( )
13
+ fromEntriesShim ( )
14
+ trimStartShim ( )
15
+ trimEndShim ( )
Original file line number Diff line number Diff line change 1
1
import matchallShim from 'https://esm.sh/string.prototype.matchall/shim'
2
2
import globalthisShim from 'https://esm.sh/globalthis/shim'
3
3
import allsettledShim from 'https://esm.sh/promise.allsettled/shim'
4
+ import '../es2021/mod.ts'
4
5
5
6
matchallShim ( )
6
7
globalthisShim ( )
Original file line number Diff line number Diff line change
1
+ import replaceAllShim from 'https://esm.sh/string.prototype.replaceall/shim'
2
+
3
+ replaceAllShim ( )
Original file line number Diff line number Diff line change @@ -222,14 +222,15 @@ function isFramework(v: any): v is 'react' {
222
222
}
223
223
}
224
224
225
- function isBuildTarget ( v : any ) : v is 'es2015' | 'es2016' | 'es2017' | 'es2018' | 'es2019' | 'es2020' {
225
+ function isBuildTarget ( v : any ) : v is 'es2015' | 'es2016' | 'es2017' | 'es2018' | 'es2019' | 'es2020' | 'esnext' {
226
226
switch ( v ) {
227
227
case 'es2015' :
228
228
case 'es2016' :
229
229
case 'es2017' :
230
230
case 'es2018' :
231
231
case 'es2019' :
232
232
case 'es2020' :
233
+ case 'esnext' :
233
234
return true
234
235
default :
235
236
return false
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ export type ServerPlugin = {
51
51
52
52
export type PostCSSPlugin = string | [ string , any ] | Plugin | PluginCreator < any >
53
53
54
- export type BuildTarget = 'es2015' | 'es2016' | 'es2017' | 'es2018' | 'es2019' | 'es2020'
54
+ export type BuildTarget = 'es2015' | 'es2016' | 'es2017' | 'es2018' | 'es2019' | 'es2020' | 'esnext'
55
55
56
56
export type BrowserTarget = {
57
57
name : 'chrome' | 'edge' | 'firefox' | 'ios' | 'Safari'
You can’t perform that action at this time.
0 commit comments