mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-04 20:17:09 +00:00
feat(bundler): map generator export to globalThis.generator
This commit is contained in:
1 parent
c38c21dea1
commit
aa67d7ddcf
2 files changed
+6
-1
No files matched your search
@@ -156,6 +156,7 @@ func TestBundle_RegistersNamedExportsOnGlobalThis(t *testing.T) {
|
||||
spec := `
|
||||
export const properties = "PROPS_MARKER";
|
||||
export const actionsRoot = "ACTIONS_MARKER";
|
||||
export const generator = "GENERATOR_MARKER";
|
||||
export const setup = "SETUP_MARKER";
|
||||
`
|
||||
if err := os.WriteFile(specPath, []byte(spec), 0o600); err != nil {
|
||||
@@ -166,7 +167,7 @@ func TestBundle_RegistersNamedExportsOnGlobalThis(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
body := string(result.JavaScript)
|
||||
for _, marker := range []string{"PROPS_MARKER", "ACTIONS_MARKER", "SETUP_MARKER"} {
|
||||
for _, marker := range []string{"PROPS_MARKER", "ACTIONS_MARKER", "GENERATOR_MARKER", "SETUP_MARKER"} {
|
||||
if !strings.Contains(body, marker) {
|
||||
t.Errorf("named export %q not registered in bundle:\n%s", marker, body)
|
||||
}
|
||||
@@ -174,6 +175,9 @@ func TestBundle_RegistersNamedExportsOnGlobalThis(t *testing.T) {
|
||||
if !strings.Contains(body, "globalThis.actions") {
|
||||
t.Errorf("trailer should assign globalThis.actions:\n%s", body)
|
||||
}
|
||||
if !strings.Contains(body, "globalThis.generator") {
|
||||
t.Errorf("trailer should assign globalThis.generator:\n%s", body)
|
||||
}
|
||||
}
|
||||
|
||||
func TestBundle_RegistersWithoutSetupExport(t *testing.T) {
|
||||
|
||||
Reference in new issue
Block a user