generated from withstudiocms/project-template
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add pathe to fix path issues on windows and add astro-integration keyword * Add changeset * Virtualize globals.css import * Remove integration from docs --- Co-authored-by: Adam Matthiesen <30383579+Adammatthiesen@users.noreply.github.com> Co-authored-by: itisgriff <152933301+itisgriff@users.noreply.github.com>
- Loading branch information
1 parent
eb2abac
commit 6b0b58f
Showing
9 changed files
with
87 additions
and
6 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,5 @@ | ||
--- | ||
"@studiocms/ui": minor | ||
--- | ||
|
||
Add pathe as a dependency to deal with path issues on Windows |
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 |
---|---|---|
|
@@ -18,6 +18,7 @@ | |
"louisescher", | ||
"Matthiesen", | ||
"onest", | ||
"pathe", | ||
"socialproof", | ||
"studiocms", | ||
"Thum", | ||
|
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
37 changes: 37 additions & 0 deletions
37
packages/studiocms_ui/src/utils/virtual-module-plugin-builder.ts
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,37 @@ | ||
import type { AstroConfig } from 'astro'; | ||
|
||
type VitePlugin = Required<AstroConfig['vite']>['plugins'][number]; | ||
|
||
/** | ||
* Builds a Vite plugin that creates a virtual module. | ||
* | ||
* @param moduleId - The ID of the virtual module. | ||
* @param name - The name of the plugin. | ||
* @param moduleContent - The content of the virtual module. | ||
* @returns A Vite plugin that resolves and loads the virtual module. | ||
*/ | ||
export function viteVirtualModulePluginBuilder( | ||
moduleId: string, | ||
name: string, | ||
moduleContent: string | ||
) { | ||
return function modulePlugin(): VitePlugin { | ||
const resolvedVirtualModuleId = `\0${moduleId}`; // Prefix with \0 to avoid conflicts | ||
|
||
return { | ||
name, | ||
resolveId(id) { | ||
if (id === moduleId) { | ||
return resolvedVirtualModuleId; | ||
} | ||
return; | ||
}, | ||
load(id) { | ||
if (id === resolvedVirtualModuleId) { | ||
return moduleContent; | ||
} | ||
return; | ||
}, | ||
}; | ||
}; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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