@@ -152,45 +152,19 @@ export async function loadImportMap(workingDir: string): Promise<ImportMap> {
152
152
}
153
153
}
154
154
155
- // update import map for alephjs dev env
156
- const DEV_PORT = Deno . env . get ( 'ALEPH_DEV_PORT' )
157
- if ( DEV_PORT ) {
158
- const alephPkgUri = getAlephPkgUri ( )
159
- const imports = {
160
- 'aleph/' : `${ alephPkgUri } /` ,
161
- 'framework' : `${ alephPkgUri } /framework/core/mod.ts` ,
162
- 'framework/react' : `${ alephPkgUri } /framework/react/mod.ts` ,
163
- 'react' : `https://esm.sh/react@${ defaultReactVersion } ` ,
164
- 'react-dom' : `https://esm.sh/react-dom@${ defaultReactVersion } ` ,
165
- 'react-dom/server' : `https://esm.sh/react-dom@${ defaultReactVersion } /server` ,
166
- }
167
- Object . assign ( importMap . imports , imports )
168
- }
169
-
170
155
return importMap
171
156
}
172
157
173
- async function loadPostCSSConfig ( workingDir : string ) : Promise < { plugins : PostCSSPlugin [ ] } > {
174
- for ( const name of Array . from ( [ 'ts' , 'js' , 'json' ] ) . map ( ext => `postcss.config.${ ext } ` ) ) {
175
- const p = join ( workingDir , name )
176
- if ( existsFileSync ( p ) ) {
177
- let config : any = null
178
- if ( name . endsWith ( '.json' ) ) {
179
- config = JSON . parse ( await Deno . readTextFile ( p ) )
180
- } else {
181
- const mod = await import ( 'file://' + p )
182
- config = mod . default
183
- if ( util . isFunction ( config ) ) {
184
- config = await config ( )
185
- }
186
- }
187
- if ( isPostcssConfig ( config ) ) {
188
- return config
189
- }
190
- }
158
+ export function defaultImports ( reactVersion : string ) : Record < string , string > {
159
+ const alephPkgUri = getAlephPkgUri ( )
160
+ return {
161
+ 'aleph/' : `${ alephPkgUri } /` ,
162
+ 'framework' : `${ alephPkgUri } /framework/core/mod.ts` ,
163
+ 'framework/react' : `${ alephPkgUri } /framework/react/mod.ts` ,
164
+ 'react' : `https://esm.sh/react@${ reactVersion } ` ,
165
+ 'react-dom' : `https://esm.sh/react-dom@${ reactVersion } ` ,
166
+ 'react-dom/server' : `https://esm.sh/react-dom@${ reactVersion } /server` ,
191
167
}
192
-
193
- return { plugins : [ 'autoprefixer' ] }
194
168
}
195
169
196
170
function isFramework ( v : any ) : v is 'react' {
0 commit comments