@@ -2,15 +2,16 @@ import { extname, join } from 'https://deno.land/
[email protected] /path/mod.ts'
2
2
import { esbuild } from '../bundler/esbuild.ts'
3
3
import { toLocalPath , computeHash } from '../server/helper.ts'
4
4
import { existsFile } from '../shared/fs.ts'
5
- import util from '../shared/util.ts'
6
5
import { Measure } from '../shared/log.ts'
6
+ import util from '../shared/util.ts'
7
7
import type { ModuleLoader , Plugin , PostCSSPlugin } from '../types.ts'
8
8
9
9
const postcssVersion = '8.3.5'
10
10
const postcssModulesVersion = '4.1.3'
11
11
const productionOnlyPostcssPlugins = [ 'autoprefixer' ]
12
12
const isModulesPluginName = ( v : any ) : v is string => ( typeof v === 'string' && / ^ p o s t c s s \- m o d u l e s ( @ | $ ) / i. test ( v . trim ( ) ) )
13
13
14
+ /** the builtin css loader */
14
15
export const builtinCSSLoader : Readonly < ModuleLoader > = {
15
16
test : / \. ( c s s | p c s s | p o s t c s s ) $ / i,
16
17
acceptHMR : true ,
@@ -139,19 +140,11 @@ export const builtinCSSLoader: Readonly<ModuleLoader> = {
139
140
}
140
141
}
141
142
142
- /** checks whether the loader is builtin css loader */
143
+ /** check whether the loader is the builtin css loader */
143
144
export function isBuiltinCSSLoader ( loader : ModuleLoader ) : boolean {
144
145
return loader === builtinCSSLoader
145
146
}
146
147
147
-
148
- export default ( ) : Plugin => {
149
- return {
150
- name : 'css-loader' ,
151
- setup : ( aleph ) => aleph . addModuleLoader ( builtinCSSLoader )
152
- }
153
- }
154
-
155
148
async function initPostCSS ( plugins : PostCSSPlugin [ ] , isDev : boolean ) {
156
149
const pluginObjects = await Promise . all ( plugins . filter ( p => {
157
150
if ( isDev ) {
@@ -195,3 +188,10 @@ async function importPostcssPluginByName(name: string) {
195
188
const { default : Plugin } = await import ( url )
196
189
return Plugin
197
190
}
191
+
192
+ export default ( ) : Plugin => {
193
+ return {
194
+ name : 'css-loader' ,
195
+ setup : ( aleph ) => aleph . addModuleLoader ( builtinCSSLoader )
196
+ }
197
+ }
0 commit comments