|
1 |
| -import { extname, join } from 'https://deno.land/[email protected]/path/mod.ts' |
| 1 | +import { join } from 'https://deno.land/[email protected]/path/mod.ts' |
2 | 2 | import { esbuild, esmLoader } from '../bundler/esbuild.ts'
|
3 |
| -import { toLocalPath, computeHash } from '../server/helper.ts' |
4 | 3 | import { existsFile } from '../shared/fs.ts'
|
5 | 4 | import log, { Measure } from '../shared/log.ts'
|
6 | 5 | import util from '../shared/util.ts'
|
7 |
| -import type { Aleph, LoadInput, LoadOutput, Plugin, PostCSSPlugin } from '../types.d.ts' |
| 6 | +import type { Aleph, LoadInput, LoadOutput, PostCSSPlugin } from '../types.d.ts' |
8 | 7 |
|
9 |
| -const test = /\.(css|pcss|postcss)$/i |
10 | 8 | const postcssVersion = '8.3.6'
|
11 |
| -const postcssModulesVersion = '4.1.3' |
| 9 | +const postcssModulesVersion = '4.2.2' |
12 | 10 | const productionOnlyPostcssPlugins = ['autoprefixer']
|
13 | 11 | const isModulesPluginName = (v: any): v is string => (typeof v === 'string' && /^postcss\-modules(@|$)/i.test(v.trim()))
|
14 | 12 |
|
@@ -144,8 +142,6 @@ export const cssLoader = async ({ specifier, data }: LoadInput, aleph: Aleph): P
|
144 | 142 | }
|
145 | 143 | }
|
146 | 144 |
|
147 |
| -export const isCSS = (specifier: string): boolean => test.test(specifier) |
148 |
| - |
149 | 145 | async function initPostCSS(plugins: PostCSSPlugin[], isDev: boolean) {
|
150 | 146 | const postPlugins = await Promise.all(plugins.filter(p => {
|
151 | 147 | if (isDev) {
|
@@ -179,16 +175,7 @@ async function initPostCSS(plugins: PostCSSPlugin[], isDev: boolean) {
|
179 | 175 | }
|
180 | 176 |
|
181 | 177 | async function importPostcssPluginByName(name: string) {
|
182 |
| - const url = `https://esm.sh/${name}?deps=postcss@${postcssVersion}&no-check` |
| 178 | + const url = `https://esm.sh/${name}?deps=postcss@${postcssVersion}&bundle&no-check` |
183 | 179 | const { default: Plugin } = await import(url)
|
184 | 180 | return Plugin
|
185 | 181 | }
|
186 |
| - |
187 |
| -export default (): Plugin => { |
188 |
| - return { |
189 |
| - name: 'css-loader', |
190 |
| - setup: aleph => { |
191 |
| - aleph.onResolve(test, () => ({ acceptHMR: true })) |
192 |
| - } |
193 |
| - } |
194 |
| -} |
0 commit comments