-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Build to a single file * Updates based on initial code review * Adds a changeset * Use the default export for cjs module * Await generatePages * Prevent timing from causing module to not import * Fix shared CSS * Properly handle windows ids * Dont shadow * Fix ts errors * Remove console.log
- Loading branch information
Showing
25 changed files
with
428 additions
and
188 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'astro': patch | ||
'@astrojs/node': patch | ||
--- | ||
|
||
Improves the build by building to a single file for rendering |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { InputOptions } from 'rollup'; | ||
|
||
function fromEntries<V>(entries: [string, V][]) { | ||
const obj: Record<string, V> = {}; | ||
for (const [k, v] of entries) { | ||
obj[k] = v; | ||
} | ||
return obj; | ||
} | ||
|
||
export function addRollupInput(inputOptions: InputOptions, newInputs: string[]): InputOptions { | ||
// Add input module ids to existing input option, whether it's a string, array or object | ||
// this way you can use multiple html plugins all adding their own inputs | ||
if (!inputOptions.input) { | ||
return { ...inputOptions, input: newInputs }; | ||
} | ||
|
||
if (typeof inputOptions.input === 'string') { | ||
return { | ||
...inputOptions, | ||
input: [inputOptions.input, ...newInputs], | ||
}; | ||
} | ||
|
||
if (Array.isArray(inputOptions.input)) { | ||
return { | ||
...inputOptions, | ||
input: [...inputOptions.input, ...newInputs], | ||
}; | ||
} | ||
|
||
if (typeof inputOptions.input === 'object') { | ||
return { | ||
...inputOptions, | ||
input: { | ||
...inputOptions.input, | ||
...fromEntries(newInputs.map((i) => [i.split('/').slice(-1)[0].split('.')[0], i])), | ||
}, | ||
}; | ||
} | ||
|
||
throw new Error(`Unknown rollup input type. Supported inputs are string, array and object.`); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.