@@ -82,7 +82,6 @@ const endInlineScript = stringToPrecomputedChunk('</script>');
8282
8383const startScriptSrc = stringToPrecomputedChunk ( '<script src="' ) ;
8484const startModuleSrc = stringToPrecomputedChunk ( '<script type="module" src="' ) ;
85- const scriptIntegirty = stringToPrecomputedChunk ( '" integrity="' ) ;
8685const endAsyncScript = stringToPrecomputedChunk ( '" async=""></script>' ) ;
8786
8887/**
@@ -105,17 +104,13 @@ const scriptRegex = /(<\/|<)(s)(cript)/gi;
105104const scriptReplacer = ( match , prefix , s , suffix ) =>
106105 `${ prefix } ${ s === 's' ? '\\u0073' : '\\u0053' } ${ suffix } ` ;
107106
108- export type BootstrapScriptDescriptor = {
109- src : string ,
110- integrity ?: string ,
111- } ;
112107// Allows us to keep track of what we've already written so we can refer back to it.
113108export function createResponseState (
114109 identifierPrefix : string | void ,
115110 nonce : string | void ,
116111 bootstrapScriptContent : string | void ,
117- bootstrapScripts : $ReadOnlyArray < string | BootstrapScriptDescriptor > | void ,
118- bootstrapModules : $ReadOnlyArray < string | BootstrapScriptDescriptor > | void ,
112+ bootstrapScripts : Array < string > | void ,
113+ bootstrapModules : Array < string > | void ,
119114) : ResponseState {
120115 const idPrefix = identifierPrefix === undefined ? '' : identifierPrefix ;
121116 const inlineScriptWithNonce =
@@ -134,42 +129,20 @@ export function createResponseState(
134129 }
135130 if ( bootstrapScripts !== undefined ) {
136131 for ( let i = 0 ; i < bootstrapScripts . length ; i ++ ) {
137- const scriptConfig = bootstrapScripts [ i ] ;
138- const src =
139- typeof scriptConfig === 'string' ? scriptConfig : scriptConfig . src ;
140- const integrity =
141- typeof scriptConfig === 'string' ? undefined : scriptConfig . integrity ;
142132 bootstrapChunks . push (
143133 startScriptSrc ,
144- stringToChunk ( escapeTextForBrowser ( src ) ) ,
134+ stringToChunk ( escapeTextForBrowser ( bootstrapScripts [ i ] ) ) ,
135+ endAsyncScript ,
145136 ) ;
146- if ( integrity ) {
147- bootstrapChunks . push (
148- scriptIntegirty ,
149- stringToChunk ( escapeTextForBrowser ( integrity ) ) ,
150- ) ;
151- }
152- bootstrapChunks . push ( endAsyncScript ) ;
153137 }
154138 }
155139 if ( bootstrapModules !== undefined ) {
156140 for ( let i = 0 ; i < bootstrapModules . length ; i ++ ) {
157- const scriptConfig = bootstrapModules [ i ] ;
158- const src =
159- typeof scriptConfig === 'string' ? scriptConfig : scriptConfig . src ;
160- const integrity =
161- typeof scriptConfig === 'string' ? undefined : scriptConfig . integrity ;
162141 bootstrapChunks . push (
163142 startModuleSrc ,
164- stringToChunk ( escapeTextForBrowser ( src ) ) ,
143+ stringToChunk ( escapeTextForBrowser ( bootstrapModules [ i ] ) ) ,
144+ endAsyncScript ,
165145 ) ;
166- if ( integrity ) {
167- bootstrapChunks . push (
168- scriptIntegirty ,
169- stringToChunk ( escapeTextForBrowser ( integrity ) ) ,
170- ) ;
171- }
172- bootstrapChunks . push ( endAsyncScript ) ;
173146 }
174147 }
175148 return {
0 commit comments