Skip to content

Commit

Permalink
feat: support to compile with mako (#2150)
Browse files Browse the repository at this point in the history
* feat: support to compile with mako (#2123)

* feat: mako finish

* fix: techStacks miss

* fix: lint

* fix: test

* fix: disable mako for test

* fix: watch-parent use null-loader

* fix: path

* chore: remove hashAnchor

* fix: remove mako for ci

* feat: update umi version

* fix: reset lock

* build: release 2.4.0-alpha.1

* fix: page frontmatter lost from route meta (#2129)

* fix: merge route.metas to metas

* chore: change value

* build: release 2.3.5

* fix: nav title cannot work in singe 2-level directory (#2116)

* fix: page frontmatter (#2130)

* build: release 2.3.6

* refactor: getMetaByRouteId return metainfo for all routes (#2134)

* refactor: getMetaByRouteId return metainfo for all routes

* fix: frontmatter is an object

* fix: 分号

* fix: prefer color

* fix: prefer color

* build: release 2.4.0-alpha.2

* chore: hooks to plugins

* chore: init mako error demo

* fix: post-loader for dumi-raw

* chore: change config

* chore: add empty line

* chore(deps): update umi version

* fix: dumi compiler before mako

---------

Co-authored-by: Zhou Bill <735051883@qq.com>
Co-authored-by: andybuibui <917655399@qq.com>

* fix: tpl error

---------

Co-authored-by: Zhou Bill <735051883@qq.com>
Co-authored-by: andybuibui <917655399@qq.com>
  • Loading branch information
3 people authored Jun 27, 2024
1 parent 85f5e11 commit ff258a6
Show file tree
Hide file tree
Showing 27 changed files with 4,110 additions and 1,156 deletions.
5 changes: 4 additions & 1 deletion .dumirc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { version } from './package.json';

export default defineConfig({
html2sketch: {},
mako: {},
favicons: [
'https://gw.alipayobjects.com/zos/bmw-prod/d3e3eb39-1cd7-4aa5-827c-877deced6b7e/lalxt4g3_w256_h256.png',
],
Expand All @@ -24,7 +25,9 @@ Powered by self`,
github: 'https://github.com/umijs/dumi',
},
},
...(process.env.NODE_ENV === 'development' ? {} : { ssr: {} }),
...(process.env.NODE_ENV === 'development'
? {}
: { ssr: { builder: 'mako' } }),
analytics: {
ga_v2: 'G-GX2S89BMXB',
},
Expand Down
1 change: 1 addition & 0 deletions .stylelintrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"extends": "@umijs/lint/dist/config/stylelint",
"ignoreFiles": ["**/heti.less"],
"rules": {
"function-no-unknown": null,
"color-function-notation": "legacy"
Expand Down
67 changes: 67 additions & 0 deletions compiled/loader-runner/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/// <reference types="node" />

export declare interface ExtendedLoaderContext {
context: string | null;
loaderIndex: number;
loaders: Loader[];
resourcePath: string | undefined;
resourceQuery: string | undefined;
async: (() => (() => void) | undefined) | null;
callback: (() => void) | null;
cacheable: (flag: boolean) => void;
dependency: (file: string) => void;
addDependency: (file: string) => void;
addContextDependency: (context: string) => void;
getDependencies: () => string[];
getContextDependencies: () => string[];
clearDependencies: () => void;
resource: string;
request: string;
remainingRequest: string;
currentRequest: string;
previousRequest: string;
query: {
[key: string]: any;
} | string;
data: any;
}

export declare function getContext(resource: string): string;

export declare interface Loader {
path: string;
query: string;
request: string;
options: any;
normal: null | ((request: string) => string);
pitch: null | ((request: string) => string);
raw: string;
data: any;
pitchExecuted: boolean;
normalExecuted: boolean;
}

export declare interface RunLoaderOption {
resource: string;
loaders: any[];
context: any;
readResource: (
filename: string,
callback: (err: NodeJS.ErrnoException | null, data: Buffer | null) => void,
) => void;
}

export declare interface RunLoaderResult {
result?: Array<Buffer | null> | undefined;
resourceBuffer?: Buffer | null | undefined;
cacheable: boolean;
fileDependencies: string[];
contextDependencies: string[];
}

export declare function runLoaders(
options: RunLoaderOption,
callback: (err: NodeJS.ErrnoException | null, result: RunLoaderResult) => any,
): void;

export { }
Loading

0 comments on commit ff258a6

Please sign in to comment.