Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/mako/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ export async function build(params: BuildParams) {
params.config.postcss = true;

params.config.plugins.push(
// @ts-ignore
new PostcssPlugin({
...params,
resolveAlias,
Expand All @@ -119,6 +120,7 @@ export async function build(params: BuildParams) {

// built-in less-loader
params.config.plugins.push(
// @ts-ignore
new LessPlugin({
...params,
resolveAlias,
Expand All @@ -132,6 +134,7 @@ export async function build(params: BuildParams) {
};

params.config.plugins.push(
// @ts-ignore
new SassPlugin({
...params,
resolveAlias,
Expand Down
8 changes: 7 additions & 1 deletion packages/mako/src/plugins/less/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import path from 'path';
import url from 'url';
import { BuildParams } from '../../';
import * as binding from '../../../binding';
import { PluginContext } from '../../binding';
import { RunLoadersOptions, createParallelLoader } from '../../runLoaders';

export interface LessLoaderOpts {
Expand Down Expand Up @@ -40,6 +41,7 @@ export class LessPlugin implements binding.JsHooks {
extOpts: RunLoadersOptions;
lessOptions: LessLoaderOpts;
moduleGraph: Map<string, LessModule> = new Map();
__isPatched = true;

constructor(params: BuildParams & { resolveAlias: Record<string, string> }) {
this.name = 'less';
Expand All @@ -57,9 +59,12 @@ export class LessPlugin implements binding.JsHooks {
};
}

// @ts-ignore
load: (
_ctx: PluginContext,
filePath: string,
) => Promise<{ content: string; type: 'css' } | undefined> = async (
_ctx: PluginContext,
filePath: string,
) => {
if (!isTargetFile(filePath)) {
Expand Down Expand Up @@ -142,7 +147,8 @@ export class LessPlugin implements binding.JsHooks {
};
};

beforeRebuild = async (paths: string[]) => {
// @ts-ignore
beforeRebuild = async (_ctx: {}, paths: string[]) => {
const result = new Set<string>();

paths.forEach((filePath) => {
Expand Down
3 changes: 3 additions & 0 deletions packages/mako/src/plugins/postcss/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export class PostcssPlugin implements binding.JsHooks {
params: BuildParams & { resolveAlias: Record<string, string> };
extOpts: RunLoadersOptions;
parallelLoader: ReturnType<typeof createParallelLoader> | undefined;
__isPatched = true;

constructor(params: BuildParams & { resolveAlias: Record<string, string> }) {
this.name = 'postcss';
Expand All @@ -19,7 +20,9 @@ export class PostcssPlugin implements binding.JsHooks {
};
}

// @ts-ignore
transform = async (
_ctx: binding.PluginContext,
content: string,
filename: string,
): Promise<{ content: string; type: 'css' | 'js' } | void> => {
Expand Down
7 changes: 6 additions & 1 deletion packages/mako/src/plugins/sass/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export class SassPlugin implements binding.JsHooks {
sassOptions: Options<'async'>;
extOpts: RunLoadersOptions;
moduleGraph: Map<string, SassModule> = new Map();
__isPatched = true;

constructor(params: BuildParams & { resolveAlias: Record<string, string> }) {
this.name = 'sass';
Expand All @@ -29,9 +30,12 @@ export class SassPlugin implements binding.JsHooks {
this.sassOptions = params.config?.sass || {};
}

// @ts-ignore
load: (
_ctx: binding.PluginContext,
filePath: string,
) => Promise<{ content: string; type: 'css' } | undefined> = async (
_ctx: binding.PluginContext,
filePath: string,
) => {
if (!isTargetFile(filePath)) {
Expand Down Expand Up @@ -111,7 +115,8 @@ export class SassPlugin implements binding.JsHooks {
};
};

beforeRebuild = async (paths: string[]) => {
// @ts-ignore
beforeRebuild = async (_ctx: {}, paths: string[]) => {
const result = new Set<string>();

paths.forEach((filePath) => {
Expand Down
Loading