Skip to content

Commit f71defe

Browse files
refactor: modules dir.
1 parent e75dc3b commit f71defe

11 files changed

Lines changed: 19 additions & 13 deletions

scripts/build-prepare.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { cp, mkdir, readFile, rm, writeFile } from 'node:fs/promises'
22
import { dirname, resolve } from 'node:path'
33
import { fileURLToPath } from 'node:url'
4-
import { cdnImportSpecs } from '../src/cdn.js'
4+
import { cdnImportSpecs } from '../src/modules/cdn.js'
55

66
const validPrimaryCdns = new Set(['importMap', 'esm', 'jspmGa'])
77

@@ -49,12 +49,14 @@ const createProdImportsModule = async () => {
4949
]
5050

5151
if (specifiers.length === 0) {
52-
throw new Error('No importMap specifiers found in src/cdn.js (cdnImportSpecs).')
52+
throw new Error(
53+
'No importMap specifiers found in src/modules/cdn.js (cdnImportSpecs).',
54+
)
5355
}
5456

5557
const lines = [
5658
'/*',
57-
' * Generated by scripts/build-prepare.js from src/cdn.js (cdnImportSpecs).',
59+
' * Generated by scripts/build-prepare.js from src/modules/cdn.js (cdnImportSpecs).',
5860
' * JSPM links this module to trace top-level production imports.',
5961
' */',
6062
...specifiers.map(specifier => `import '${specifier}'`),

src/app.js

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
import { cdnImports, getTypeScriptLibUrls, importFromCdnWithFallback } from './cdn.js'
2-
import { createCodeMirrorEditor } from './editor-codemirror.js'
3-
import { defaultCss, defaultJsx } from './defaults.js'
4-
import { createDiagnosticsUiController } from './diagnostics-ui.js'
5-
import { createLayoutThemeController } from './layout-theme.js'
6-
import { createPreviewBackgroundController } from './preview-background.js'
7-
import { createRenderRuntimeController } from './render-runtime.js'
8-
import { createTypeDiagnosticsController } from './type-diagnostics.js'
1+
import {
2+
cdnImports,
3+
getTypeScriptLibUrls,
4+
importFromCdnWithFallback,
5+
} from './modules/cdn.js'
6+
import { createCodeMirrorEditor } from './modules/editor-codemirror.js'
7+
import { defaultCss, defaultJsx } from './modules/defaults.js'
8+
import { createDiagnosticsUiController } from './modules/diagnostics-ui.js'
9+
import { createLayoutThemeController } from './modules/layout-theme.js'
10+
import { createPreviewBackgroundController } from './modules/preview-background.js'
11+
import { createRenderRuntimeController } from './modules/render-runtime.js'
12+
import { createTypeDiagnosticsController } from './modules/type-diagnostics.js'
913

1014
const statusNode = document.getElementById('status')
1115
const appGrid = document.querySelector('.app-grid')

src/bootstrap.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { getPrimaryCdnImportUrls } from './cdn.js'
1+
import { getPrimaryCdnImportUrls } from './modules/cdn.js'
22

33
/*
44
* Preload only the modules needed for the initial render path.
55
* - Included: core runtime + React runtime modules used immediately.
66
* - Excluded: optional style compilers (sass/less/lightningCssWasm), which stay lazy.
7-
* Keep this list aligned with cdnImports keys in cdn.js.
7+
* Keep this list aligned with cdnImports keys in modules/cdn.js.
88
*/
99
const preloadImportKeys = [
1010
'cssBrowser',
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)