@modern-js/core 2.0.0-beta.0 → 2.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +128 -0
- package/dist/bin.js +1 -4
- package/dist/config/createLoadedConfig.d.ts +6 -0
- package/dist/config/createLoadedConfig.js +35 -0
- package/dist/config/createResolvedConfig.d.ts +3 -0
- package/dist/config/createResolvedConfig.js +92 -0
- package/dist/config/index.d.ts +2 -17
- package/dist/config/index.js +2 -136
- package/dist/context.d.ts +5 -9
- package/dist/index.d.ts +12 -14
- package/dist/index.js +30 -58
- package/dist/loadPlugins.d.ts +2 -12
- package/dist/loadPlugins.js +12 -5
- package/dist/manager.d.ts +80 -64
- package/dist/manager.js +11 -5
- package/dist/schema/patchSchema.d.ts +19 -0
- package/dist/{config/schema/index.js → schema/patchSchema.js} +8 -45
- package/dist/schema/source.d.ts +9 -0
- package/dist/schema/source.js +10 -0
- package/dist/schema/testing.d.ts +13 -0
- package/dist/schema/testing.js +11 -0
- package/dist/schema/traverseSchema.d.ts +2 -0
- package/dist/schema/traverseSchema.js +20 -0
- package/dist/types/config/index.d.ts +41 -0
- package/dist/{config/types → types/config}/index.js +0 -0
- package/dist/types/config/testing.d.ts +15 -0
- package/dist/{config/types/electron.js → types/config/testing.js} +0 -0
- package/dist/types/context.d.ts +26 -0
- package/dist/{config/types/less.js → types/context.js} +0 -0
- package/dist/types/hooks.d.ts +26 -0
- package/dist/{config/types/postcss.js → types/hooks.js} +0 -0
- package/dist/types/index.d.ts +10 -1
- package/dist/types/index.js +5 -1
- package/dist/types/plugin.d.ts +26 -0
- package/dist/{config/types/sass.js → types/plugin.js} +0 -0
- package/dist/types/pluginAPI.d.ts +18 -0
- package/dist/{config/types/ssg.js → types/pluginAPI.js} +0 -0
- package/dist/utils/mergeConfig.d.ts +2 -0
- package/dist/{config → utils}/mergeConfig.js +1 -8
- package/dist/utils/repeatKeyWarning.d.ts +2 -2
- package/dist/utils/repeatKeyWarning.js +2 -2
- package/package.json +17 -10
- package/compiled/v8-compile-cache/index.d.ts +0 -1
- package/compiled/v8-compile-cache/index.js +0 -1
- package/compiled/v8-compile-cache/license +0 -21
- package/compiled/v8-compile-cache/package.json +0 -1
- package/dist/config/defaults.d.ts +0 -29
- package/dist/config/defaults.js +0 -110
- package/dist/config/mergeConfig.d.ts +0 -32
- package/dist/config/schema/deploy.d.ts +0 -16
- package/dist/config/schema/deploy.js +0 -16
- package/dist/config/schema/index.d.ts +0 -499
- package/dist/config/schema/output.d.ts +0 -146
- package/dist/config/schema/output.js +0 -68
- package/dist/config/schema/server.d.ts +0 -194
- package/dist/config/schema/server.js +0 -111
- package/dist/config/schema/source.d.ts +0 -64
- package/dist/config/schema/source.js +0 -38
- package/dist/config/schema/tools.d.ts +0 -51
- package/dist/config/schema/tools.js +0 -24
- package/dist/config/types/electron.d.ts +0 -13
- package/dist/config/types/index.d.ts +0 -260
- package/dist/config/types/less.d.ts +0 -12
- package/dist/config/types/postcss.d.ts +0 -28
- package/dist/config/types/sass.d.ts +0 -10
- package/dist/config/types/ssg.d.ts +0 -15
- package/dist/config/types/test.d.ts +0 -14
- package/dist/config/types/test.js +0 -2
- package/dist/config/types/ts-loader.d.ts +0 -23
- package/dist/config/types/ts-loader.js +0 -2
- package/dist/initWatcher.d.ts +0 -3
- package/dist/initWatcher.js +0 -66
- package/dist/pluginAPI.d.ts +0 -13
- package/dist/pluginAPI.js +0 -16
- package/dist/types/cli.d.ts +0 -59
- package/dist/types/cli.js +0 -2
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Entrypoint, InternalPlugins, ServerRoute, HtmlTemplates } from '@modern-js/types';
|
|
2
|
+
import { BuilderInstance } from '@modern-js/builder-shared';
|
|
3
|
+
export interface IAppContext {
|
|
4
|
+
metaName: string;
|
|
5
|
+
appDirectory: string;
|
|
6
|
+
configFile: string | false;
|
|
7
|
+
serverConfigFile: string;
|
|
8
|
+
serverInternalPlugins: InternalPlugins;
|
|
9
|
+
ip?: string;
|
|
10
|
+
port?: number;
|
|
11
|
+
distDirectory: string;
|
|
12
|
+
packageName: string;
|
|
13
|
+
srcDirectory: string;
|
|
14
|
+
sharedDirectory: string;
|
|
15
|
+
nodeModulesDirectory: string;
|
|
16
|
+
internalDirectory: string;
|
|
17
|
+
plugins: any[];
|
|
18
|
+
entrypoints: Entrypoint[];
|
|
19
|
+
checkedEntries: string[];
|
|
20
|
+
serverRoutes: ServerRoute[];
|
|
21
|
+
htmlTemplates: HtmlTemplates;
|
|
22
|
+
apiOnly: boolean;
|
|
23
|
+
internalDirAlias: string;
|
|
24
|
+
internalSrcAlias: string;
|
|
25
|
+
builder?: BuilderInstance;
|
|
26
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ParallelWorkflow, AsyncWaterfall, AsyncWorkflow, ToRunners, ToThreads } from '@modern-js/plugin';
|
|
2
|
+
import type { Command } from '@modern-js/utils';
|
|
3
|
+
import type { UserConfig, NormalizedConfig } from './config';
|
|
4
|
+
export declare type BaseHooks<Extends extends {
|
|
5
|
+
hooks?: ExtendHooks;
|
|
6
|
+
userConfig?: ExtendUserConfig;
|
|
7
|
+
normalizedConfig?: ExtendNormalizedConfig;
|
|
8
|
+
}, ExtendHooks extends {} = {}, ExtendUserConfig extends Record<string, any> = {}, ExtendNormalizedConfig extends Record<string, any> = {}> = {
|
|
9
|
+
config: ParallelWorkflow<void, UserConfig<Extends>>;
|
|
10
|
+
resolvedConfig: AsyncWaterfall<{
|
|
11
|
+
resolved: NormalizedConfig<Extends>;
|
|
12
|
+
}>;
|
|
13
|
+
validateSchema: ParallelWorkflow<void>;
|
|
14
|
+
prepare: AsyncWorkflow<void, void>;
|
|
15
|
+
commands: AsyncWorkflow<{
|
|
16
|
+
program: Command;
|
|
17
|
+
}, void>;
|
|
18
|
+
beforeExit: AsyncWorkflow<void, void>;
|
|
19
|
+
addRuntimeExports: AsyncWaterfall<void>;
|
|
20
|
+
};
|
|
21
|
+
export declare type CliHooksRunner<Extends extends {
|
|
22
|
+
hooks?: ExtendHooks;
|
|
23
|
+
userConfig?: ExtendUserConfig;
|
|
24
|
+
normalizedConfig?: ExtendNormalizedConfig;
|
|
25
|
+
} = {}, ExtendHooks extends {} = {}, ExtendUserConfig extends Record<string, any> = {}, ExtendNormalizedConfig extends Record<string, any> = {}> = ToRunners<BaseHooks<Extends> & Extends['hooks']>;
|
|
26
|
+
export declare type CliHookCallbacks = ToThreads<BaseHooks<{}>>;
|
|
File without changes
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
import type { JSONSchemaType } from '@modern-js/utils/ajv/json-schema';
|
|
2
|
+
export * from './plugin';
|
|
3
|
+
export * from './config';
|
|
4
|
+
export * from './pluginAPI';
|
|
5
|
+
export * from './hooks';
|
|
6
|
+
export * from './context';
|
|
7
|
+
export interface PluginValidateSchema {
|
|
8
|
+
target: string;
|
|
9
|
+
schema: JSONSchemaType<any>;
|
|
10
|
+
}
|
package/dist/types/index.js
CHANGED
|
@@ -14,4 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./
|
|
17
|
+
__exportStar(require("./plugin"), exports);
|
|
18
|
+
__exportStar(require("./config"), exports);
|
|
19
|
+
__exportStar(require("./pluginAPI"), exports);
|
|
20
|
+
__exportStar(require("./hooks"), exports);
|
|
21
|
+
__exportStar(require("./context"), exports);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { AsyncSetup, PluginOptions } from '@modern-js/plugin';
|
|
2
|
+
import { BaseHooks } from './hooks';
|
|
3
|
+
import { BasePluginAPI } from './pluginAPI';
|
|
4
|
+
export type { InternalPlugins } from '@modern-js/types';
|
|
5
|
+
/** Plugin options of a cli plugin. */
|
|
6
|
+
export declare type CliPlugin<Extends extends {
|
|
7
|
+
hooks?: ExtendHooks;
|
|
8
|
+
userConfig?: ExtendUserConfig;
|
|
9
|
+
normalizedConfig?: ExtendNormalizedConfig;
|
|
10
|
+
} = {}, ExtendHooks extends Record<string, any> = {}, ExtendUserConfig extends Record<string, any> = {}, ExtendNormalizedConfig extends Record<string, any> = {}> = PluginOptions<BaseHooks<Extends>, AsyncSetup<BaseHooks<Extends> & Extends['hooks'], BasePluginAPI<Extends>>, Extends['hooks'], BaseHooks<Extends> | BaseHooks<{}>, AsyncSetup<BaseHooks<Extends> & Extends['hooks'], BasePluginAPI<Extends>> | AsyncSetup<BaseHooks<{}>, BasePluginAPI<{}>>>;
|
|
11
|
+
export declare type PluginItem = string | [string, any];
|
|
12
|
+
/**
|
|
13
|
+
* @deprecated
|
|
14
|
+
* Using NewPluginConfig instead.
|
|
15
|
+
*/
|
|
16
|
+
export declare type OldPluginConfig = Array<PluginItem>;
|
|
17
|
+
export declare type NewPluginConfig<PluginTypes extends {
|
|
18
|
+
hooks?: Record<string, any>;
|
|
19
|
+
userConfig?: Record<string, any>;
|
|
20
|
+
normalizedConfig?: Record<string, any>;
|
|
21
|
+
}> = CliPlugin<PluginTypes>[];
|
|
22
|
+
export declare type PluginConfig<PluginTypes extends {
|
|
23
|
+
hooks?: Record<string, any>;
|
|
24
|
+
userConfig?: Record<string, any>;
|
|
25
|
+
normalizedConfig?: Record<string, any>;
|
|
26
|
+
} = {}> = OldPluginConfig | NewPluginConfig<PluginTypes>;
|
|
File without changes
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { CommonAPI } from '@modern-js/plugin';
|
|
2
|
+
import type { setAppContext, useAppContext, useResolvedConfigContext, useConfigContext } from '../context';
|
|
3
|
+
import { BaseHooks } from './hooks';
|
|
4
|
+
export declare type BasePluginAPI<Extends extends {
|
|
5
|
+
hooks?: ExtendHooks;
|
|
6
|
+
userConfig?: ExtendUserConfig;
|
|
7
|
+
normalizedConfig?: ExtendNormalizedConfig;
|
|
8
|
+
}, ExtendHooks extends {} = {}, ExtendUserConfig extends Record<string, any> = {}, ExtendNormalizedConfig extends Record<string, any> = {}> = {
|
|
9
|
+
setAppContext: typeof setAppContext;
|
|
10
|
+
useAppContext: typeof useAppContext;
|
|
11
|
+
useConfigContext: typeof useConfigContext<Extends>;
|
|
12
|
+
useResolvedConfigContext: typeof useResolvedConfigContext<Extends>;
|
|
13
|
+
};
|
|
14
|
+
/** all apis for cli plugin */
|
|
15
|
+
export declare type PluginAPI<Extends extends {
|
|
16
|
+
hooks?: ExtendHooks;
|
|
17
|
+
userConfig?: ExtendUserConfig;
|
|
18
|
+
} = {}, ExtendHooks extends {} = {}, ExtendUserConfig extends Record<string, any> = {}> = BasePluginAPI<Extends> & CommonAPI<BaseHooks<Extends> & Extends['hooks']>;
|
|
File without changes
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { UserConfig, NormalizedConfig } from '../types';
|
|
2
|
+
export declare const mergeConfig: <ExtendConfig extends Record<string, any>>(configs: (UserConfig<ExtendConfig, {}, {}, {}> | NormalizedConfig<ExtendConfig, {}, {}, {}>)[]) => NormalizedConfig<ExtendConfig, {}, {}, {}>;
|
|
@@ -2,13 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.mergeConfig = void 0;
|
|
4
4
|
const lodash_1 = require("@modern-js/utils/lodash");
|
|
5
|
-
const utils_1 = require("@modern-js/utils");
|
|
6
|
-
/**
|
|
7
|
-
* merge configuration from modern.config.js and plugins.
|
|
8
|
-
*
|
|
9
|
-
* @param configs - Configuration from modern.config.ts or plugin's config hook.
|
|
10
|
-
* @returns - normalized user config.
|
|
11
|
-
*/
|
|
12
5
|
const mergeConfig = (configs) => (0, lodash_1.mergeWith)({}, ...configs, (target, source, key) => {
|
|
13
6
|
// Do not use the following merge logic for source.designSystem and tools.tailwind(css)
|
|
14
7
|
if (key === 'designSystem' ||
|
|
@@ -25,7 +18,7 @@ const mergeConfig = (configs) => (0, lodash_1.mergeWith)({}, ...configs, (target
|
|
|
25
18
|
return source !== undefined ? [...target, source] : target;
|
|
26
19
|
}
|
|
27
20
|
}
|
|
28
|
-
else if ((0,
|
|
21
|
+
else if ((0, lodash_1.isFunction)(target) || (0, lodash_1.isFunction)(source)) {
|
|
29
22
|
if (source === undefined) {
|
|
30
23
|
return target;
|
|
31
24
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { UserConfig } from '../
|
|
1
|
+
import { UserConfig } from '../types';
|
|
2
2
|
export declare const deepGet: (obj: any, key: string) => any;
|
|
3
|
-
export declare const repeatKeyWarning: (schema: any, jsConfig: UserConfig, pkgConfig: UserConfig) => void;
|
|
3
|
+
export declare const repeatKeyWarning: <E extends Record<string, any>>(schema: any, jsConfig: UserConfig<E, {}, {}, {}>, pkgConfig: UserConfig<E, {}, {}, {}>) => void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.repeatKeyWarning = exports.deepGet = void 0;
|
|
4
|
-
const
|
|
4
|
+
const traverseSchema_1 = require("../schema/traverseSchema");
|
|
5
5
|
const deepGet = (obj, key) => {
|
|
6
6
|
for (const p of key.split('.')) {
|
|
7
7
|
// eslint-disable-next-line no-param-reassign
|
|
@@ -11,7 +11,7 @@ const deepGet = (obj, key) => {
|
|
|
11
11
|
};
|
|
12
12
|
exports.deepGet = deepGet;
|
|
13
13
|
const repeatKeyWarning = (schema, jsConfig, pkgConfig) => {
|
|
14
|
-
const keys = (0,
|
|
14
|
+
const keys = (0, traverseSchema_1.traverseSchema)(schema);
|
|
15
15
|
for (const key of keys) {
|
|
16
16
|
if ((0, exports.deepGet)(jsConfig, key) !== undefined &&
|
|
17
17
|
(0, exports.deepGet)(pkgConfig, key) !== undefined) {
|
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"modern",
|
|
11
11
|
"modern.js"
|
|
12
12
|
],
|
|
13
|
-
"version": "2.0.0-beta.
|
|
13
|
+
"version": "2.0.0-beta.2",
|
|
14
14
|
"jsnext:source": "./src/index.ts",
|
|
15
15
|
"types": "./dist/index.d.ts",
|
|
16
16
|
"main": "./dist/index.js",
|
|
@@ -28,26 +28,28 @@
|
|
|
28
28
|
"./bin": {
|
|
29
29
|
"jsnext:source": "./src/bin.ts",
|
|
30
30
|
"default": "./dist/bin.js"
|
|
31
|
+
},
|
|
32
|
+
"./types": {
|
|
33
|
+
"default": "./dist/types/index.js"
|
|
31
34
|
}
|
|
32
35
|
},
|
|
33
36
|
"typesVersions": {
|
|
34
37
|
"*": {
|
|
35
38
|
"config": [
|
|
36
39
|
"./dist/config/types/index.d.ts"
|
|
40
|
+
],
|
|
41
|
+
"types": [
|
|
42
|
+
"./dist/types/index.d.ts"
|
|
37
43
|
]
|
|
38
44
|
}
|
|
39
45
|
},
|
|
40
46
|
"dependencies": {
|
|
41
|
-
"@modern-js/node-bundle-require": "2.0.0-beta.
|
|
42
|
-
"@modern-js/plugin": "2.0.0-beta.
|
|
43
|
-
"@modern-js/utils": "2.0.0-beta.
|
|
47
|
+
"@modern-js/node-bundle-require": "2.0.0-beta.2",
|
|
48
|
+
"@modern-js/plugin": "2.0.0-beta.2",
|
|
49
|
+
"@modern-js/utils": "2.0.0-beta.2"
|
|
44
50
|
},
|
|
45
51
|
"devDependencies": {
|
|
46
52
|
"@jest/types": "^27.0.6",
|
|
47
|
-
"@modern-js/babel-preset-app": "2.0.0-beta.0",
|
|
48
|
-
"@modern-js/types": "2.0.0-beta.0",
|
|
49
|
-
"@scripts/build": "2.0.0-beta.0",
|
|
50
|
-
"@scripts/jest-config": "2.0.0-beta.0",
|
|
51
53
|
"@types/babel__code-frame": "^7.0.3",
|
|
52
54
|
"@types/babel__core": "^7.1.16",
|
|
53
55
|
"@types/jest": "^27",
|
|
@@ -62,7 +64,12 @@
|
|
|
62
64
|
"sass": "^1.45.0",
|
|
63
65
|
"terser-webpack-plugin": "^5.1.4",
|
|
64
66
|
"typescript": "^4",
|
|
65
|
-
"webpack": "^5.74.0"
|
|
67
|
+
"webpack": "^5.74.0",
|
|
68
|
+
"@modern-js/builder-shared": "2.0.0-beta.2",
|
|
69
|
+
"@modern-js/babel-preset-app": "2.0.0-beta.2",
|
|
70
|
+
"@modern-js/types": "2.0.0-beta.2",
|
|
71
|
+
"@scripts/build": "2.0.0-beta.2",
|
|
72
|
+
"@scripts/jest-config": "2.0.0-beta.2"
|
|
66
73
|
},
|
|
67
74
|
"sideEffects": false,
|
|
68
75
|
"publishConfig": {
|
|
@@ -70,7 +77,7 @@
|
|
|
70
77
|
"access": "public"
|
|
71
78
|
},
|
|
72
79
|
"scripts": {
|
|
73
|
-
"new": "modern new",
|
|
80
|
+
"new": "modern-lib new",
|
|
74
81
|
"build": "tsc",
|
|
75
82
|
"dev": "tsc --watch",
|
|
76
83
|
"test": "jest"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export = any;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(()=>{"use strict";var e={737:(e,t,r)=>{const s=r(188);const i=r(113);const o=r(147);const a=r(17);const c=r(144);const n=r(37);const l=Object.prototype.hasOwnProperty;class FileSystemBlobStore{constructor(e,t){const r=t?slashEscape(t+"."):"";this._blobFilename=a.join(e,r+"BLOB");this._mapFilename=a.join(e,r+"MAP");this._lockFilename=a.join(e,r+"LOCK");this._directory=e;this._load()}has(e,t){if(l.call(this._memoryBlobs,e)){return this._invalidationKeys[e]===t}else if(l.call(this._storedMap,e)){return this._storedMap[e][0]===t}return false}get(e,t){if(l.call(this._memoryBlobs,e)){if(this._invalidationKeys[e]===t){return this._memoryBlobs[e]}}else if(l.call(this._storedMap,e)){const r=this._storedMap[e];if(r[0]===t){return this._storedBlob.slice(r[1],r[2])}}}set(e,t,r){this._invalidationKeys[e]=t;this._memoryBlobs[e]=r;this._dirty=true}delete(e){if(l.call(this._memoryBlobs,e)){this._dirty=true;delete this._memoryBlobs[e]}if(l.call(this._invalidationKeys,e)){this._dirty=true;delete this._invalidationKeys[e]}if(l.call(this._storedMap,e)){this._dirty=true;delete this._storedMap[e]}}isDirty(){return this._dirty}save(){const e=this._getDump();const t=Buffer.concat(e[0]);const r=JSON.stringify(e[1]);try{mkdirpSync(this._directory);o.writeFileSync(this._lockFilename,"LOCK",{flag:"wx"})}catch(e){return false}try{o.writeFileSync(this._blobFilename,t);o.writeFileSync(this._mapFilename,r)}finally{o.unlinkSync(this._lockFilename)}return true}_load(){try{this._storedBlob=o.readFileSync(this._blobFilename);this._storedMap=JSON.parse(o.readFileSync(this._mapFilename))}catch(e){this._storedBlob=Buffer.alloc(0);this._storedMap={}}this._dirty=false;this._memoryBlobs={};this._invalidationKeys={}}_getDump(){const e=[];const t={};let r=0;function push(s,i,o){e.push(o);t[s]=[i,r,r+o.length];r+=o.length}for(const e of Object.keys(this._memoryBlobs)){const t=this._memoryBlobs[e];const r=this._invalidationKeys[e];push(e,r,t)}for(const e of Object.keys(this._storedMap)){if(l.call(t,e))continue;const r=this._storedMap[e];const s=this._storedBlob.slice(r[1],r[2]);push(e,r[0],s)}return[e,t]}}class NativeCompileCache{constructor(){this._cacheStore=null;this._previousModuleCompile=null}setCacheStore(e){this._cacheStore=e}install(){const e=this;const t=typeof require.resolve.paths==="function";this._previousModuleCompile=s.prototype._compile;s.prototype._compile=function(r,i){const o=this;function require(e){return o.require(e)}function resolve(e,t){return s._resolveFilename(e,o,false,t)}require.resolve=resolve;if(t){resolve.paths=function paths(e){return s._resolveLookupPaths(e,o,true)}}require.main=process.mainModule;require.extensions=s._extensions;require.cache=s._cache;const c=a.dirname(i);const n=e._moduleCompile(i,r);const l=[o.exports,require,o,i,c,process,global,Buffer];return n.apply(o.exports,l)}}uninstall(){s.prototype._compile=this._previousModuleCompile}_moduleCompile(e,t){var r=t.length;if(r>=2){if(t.charCodeAt(0)===35&&t.charCodeAt(1)===33/*!*/){if(r===2){t=""}else{var o=2;for(;o<r;++o){var a=t.charCodeAt(o);if(a===10||a===13)break}if(o===r){t=""}else{t=t.slice(o)}}}}var n=s.wrap(t);var l=i.createHash("sha1").update(t,"utf8").digest("hex");var h=this._cacheStore.get(e,l);var p=new c.Script(n,{filename:e,lineOffset:0,displayErrors:true,cachedData:h,produceCachedData:true});if(p.cachedDataProduced){this._cacheStore.set(e,l,p.cachedData)}else if(p.cachedDataRejected){this._cacheStore.delete(e)}var u=p.runInThisContext({filename:e,lineOffset:0,columnOffset:0,displayErrors:true});return u}}function mkdirpSync(e){_mkdirpSync(a.resolve(e),511)}function _mkdirpSync(e,t){try{o.mkdirSync(e,t)}catch(t){if(t.code==="ENOENT"){_mkdirpSync(a.dirname(e));_mkdirpSync(e)}else{try{const r=o.statSync(e);if(!r.isDirectory()){throw t}}catch(e){throw t}}}}function slashEscape(e){const t={"\\":"zB",":":"zC","/":"zS","\0":"z0",z:"zZ"};const r=/[\\:/\x00z]/g;return e.replace(r,(e=>t[e]))}function supportsCachedData(){const e=new c.Script('""',{produceCachedData:true});return e.cachedDataProduced===true}function getCacheDir(){const e=process.env.V8_COMPILE_CACHE_CACHE_DIR;if(e){return e}const t=typeof process.getuid==="function"?"v8-compile-cache-"+process.getuid():"v8-compile-cache";const r=typeof process.versions.v8==="string"?process.versions.v8:typeof process.versions.chakracore==="string"?"chakracore-"+process.versions.chakracore:"node-"+process.version;const s=a.join(n.tmpdir(),t,r);return s}function getMainName(){const e=require.main&&typeof require.main.filename==="string"?require.main.filename:process.cwd();return e}if(!process.env.DISABLE_V8_COMPILE_CACHE&&supportsCachedData()){const e=getCacheDir();const t=getMainName();const r=new FileSystemBlobStore(e,t);const s=new NativeCompileCache;s.setCacheStore(r);s.install();process.once("exit",(()=>{if(r.isDirty()){r.save()}s.uninstall()}))}e.exports.__TEST__={FileSystemBlobStore:FileSystemBlobStore,NativeCompileCache:NativeCompileCache,mkdirpSync:mkdirpSync,slashEscape:slashEscape,supportsCachedData:supportsCachedData,getCacheDir:getCacheDir,getMainName:getMainName}},113:e=>{e.exports=require("crypto")},147:e=>{e.exports=require("fs")},188:e=>{e.exports=require("module")},37:e=>{e.exports=require("os")},17:e=>{e.exports=require("path")},144:e=>{e.exports=require("vm")}};var t={};function __nccwpck_require__(r){var s=t[r];if(s!==undefined){return s.exports}var i=t[r]={exports:{}};var o=true;try{e[r](i,i.exports,__nccwpck_require__);o=false}finally{if(o)delete t[r]}return i.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var r=__nccwpck_require__(737);module.exports=r})();
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
The MIT License (MIT)
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2019 Andres Suarez
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"name":"v8-compile-cache","author":"Andres Suarez <zertosh@gmail.com>","version":"2.3.0","license":"MIT","types":"index.d.ts"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { IAppContext } from '@modern-js/types';
|
|
2
|
-
import { OutputConfig, ServerConfig, SourceConfig } from '.';
|
|
3
|
-
export declare const getDefaultConfig: (appContext?: IAppContext) => {
|
|
4
|
-
source: SourceConfig;
|
|
5
|
-
output: OutputConfig;
|
|
6
|
-
server: ServerConfig;
|
|
7
|
-
dev: {
|
|
8
|
-
assetPrefix: boolean;
|
|
9
|
-
https: boolean;
|
|
10
|
-
};
|
|
11
|
-
deploy: {
|
|
12
|
-
domain: string;
|
|
13
|
-
domainByEntries: undefined;
|
|
14
|
-
};
|
|
15
|
-
tools: {
|
|
16
|
-
webpack: undefined;
|
|
17
|
-
babel: undefined;
|
|
18
|
-
postcss: undefined;
|
|
19
|
-
autoprefixer: undefined;
|
|
20
|
-
lodash: undefined;
|
|
21
|
-
devServer: undefined;
|
|
22
|
-
tsLoader: undefined;
|
|
23
|
-
terser: undefined;
|
|
24
|
-
minifyCss: undefined;
|
|
25
|
-
};
|
|
26
|
-
plugins: never[];
|
|
27
|
-
runtime: {};
|
|
28
|
-
runtimeByEntries: {};
|
|
29
|
-
};
|
package/dist/config/defaults.js
DELETED
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getDefaultConfig = void 0;
|
|
4
|
-
const getDefaultConfig = (appContext) => {
|
|
5
|
-
const defaultAlias = appContext
|
|
6
|
-
? {
|
|
7
|
-
[appContext.internalDirAlias]: appContext.internalDirectory,
|
|
8
|
-
[appContext.internalSrcAlias]: appContext.srcDirectory,
|
|
9
|
-
'@': appContext.srcDirectory,
|
|
10
|
-
'@shared': appContext.sharedDirectory,
|
|
11
|
-
}
|
|
12
|
-
: {};
|
|
13
|
-
const sourceDefaults = {
|
|
14
|
-
entries: undefined,
|
|
15
|
-
enableAsyncEntry: false,
|
|
16
|
-
disableDefaultEntries: false,
|
|
17
|
-
entriesDir: './src',
|
|
18
|
-
configDir: './config',
|
|
19
|
-
apiDir: './api',
|
|
20
|
-
envVars: [],
|
|
21
|
-
globalVars: undefined,
|
|
22
|
-
alias: defaultAlias,
|
|
23
|
-
moduleScopes: undefined,
|
|
24
|
-
include: [],
|
|
25
|
-
};
|
|
26
|
-
const outputDefaults = {
|
|
27
|
-
assetPrefix: '/',
|
|
28
|
-
htmlPath: 'html',
|
|
29
|
-
jsPath: 'static/js',
|
|
30
|
-
cssPath: 'static/css',
|
|
31
|
-
mediaPath: 'static/media',
|
|
32
|
-
path: 'dist',
|
|
33
|
-
title: '',
|
|
34
|
-
titleByEntries: undefined,
|
|
35
|
-
meta: {
|
|
36
|
-
charset: { charset: 'utf-8' },
|
|
37
|
-
viewport: 'width=device-width, initial-scale=1.0, shrink-to-fit=no, viewport-fit=cover, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no',
|
|
38
|
-
'http-equiv': { 'http-equiv': 'x-ua-compatible', content: 'ie=edge' },
|
|
39
|
-
renderer: 'webkit',
|
|
40
|
-
layoutmode: 'standard',
|
|
41
|
-
imagemode: 'force',
|
|
42
|
-
'wap-font-scale': 'no',
|
|
43
|
-
'format-detection': 'telephone=no',
|
|
44
|
-
},
|
|
45
|
-
metaByEntries: undefined,
|
|
46
|
-
inject: 'head',
|
|
47
|
-
injectByEntries: undefined,
|
|
48
|
-
mountId: 'root',
|
|
49
|
-
favicon: '',
|
|
50
|
-
faviconByEntries: undefined,
|
|
51
|
-
copy: undefined,
|
|
52
|
-
scriptExt: undefined,
|
|
53
|
-
disableHtmlFolder: false,
|
|
54
|
-
disableCssModuleExtension: false,
|
|
55
|
-
disableCssExtract: false,
|
|
56
|
-
enableCssModuleTSDeclaration: false,
|
|
57
|
-
disableMinimize: false,
|
|
58
|
-
enableInlineStyles: false,
|
|
59
|
-
enableInlineScripts: false,
|
|
60
|
-
disableSourceMap: false,
|
|
61
|
-
disableInlineRuntimeChunk: false,
|
|
62
|
-
disableAssetsCache: false,
|
|
63
|
-
enableLatestDecorators: false,
|
|
64
|
-
polyfill: 'entry',
|
|
65
|
-
dataUriLimit: 10000,
|
|
66
|
-
templateParameters: {},
|
|
67
|
-
templateParametersByEntries: undefined,
|
|
68
|
-
cssModuleLocalIdentName: undefined,
|
|
69
|
-
enableModernMode: false,
|
|
70
|
-
federation: undefined,
|
|
71
|
-
disableNodePolyfill: false,
|
|
72
|
-
enableTsLoader: false,
|
|
73
|
-
};
|
|
74
|
-
const serverDefaults = {
|
|
75
|
-
routes: undefined,
|
|
76
|
-
publicRoutes: undefined,
|
|
77
|
-
ssr: undefined,
|
|
78
|
-
ssrByEntries: undefined,
|
|
79
|
-
baseUrl: '/',
|
|
80
|
-
port: 8080,
|
|
81
|
-
};
|
|
82
|
-
const devDefaults = { assetPrefix: false, https: false };
|
|
83
|
-
const deployDefaults = {
|
|
84
|
-
domain: '',
|
|
85
|
-
domainByEntries: undefined,
|
|
86
|
-
};
|
|
87
|
-
const toolsDefaults = {
|
|
88
|
-
webpack: undefined,
|
|
89
|
-
babel: undefined,
|
|
90
|
-
postcss: undefined,
|
|
91
|
-
autoprefixer: undefined,
|
|
92
|
-
lodash: undefined,
|
|
93
|
-
devServer: undefined,
|
|
94
|
-
tsLoader: undefined,
|
|
95
|
-
terser: undefined,
|
|
96
|
-
minifyCss: undefined,
|
|
97
|
-
};
|
|
98
|
-
return {
|
|
99
|
-
source: sourceDefaults,
|
|
100
|
-
output: outputDefaults,
|
|
101
|
-
server: serverDefaults,
|
|
102
|
-
dev: devDefaults,
|
|
103
|
-
deploy: deployDefaults,
|
|
104
|
-
tools: toolsDefaults,
|
|
105
|
-
plugins: [],
|
|
106
|
-
runtime: {},
|
|
107
|
-
runtimeByEntries: {},
|
|
108
|
-
};
|
|
109
|
-
};
|
|
110
|
-
exports.getDefaultConfig = getDefaultConfig;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { UserConfig, SourceConfig, ToolsConfig } from '.';
|
|
2
|
-
export interface NormalizedSourceConfig extends Omit<SourceConfig, 'alias' | 'moduleScopes'> {
|
|
3
|
-
alias: SourceConfig['alias'] | Array<NonNullable<SourceConfig['alias']>>;
|
|
4
|
-
moduleScopes: SourceConfig['moduleScopes'] | Array<SourceConfig['moduleScopes']>;
|
|
5
|
-
}
|
|
6
|
-
export interface NormalizedToolsConfig extends Omit<ToolsConfig, 'webpack' | 'webpackChain' | 'babel' | 'postcss' | 'autoprefixer' | 'lodash' | 'tsLoader' | 'terser' | 'minifyCss' | 'esbuild' | 'styledComponents'> {
|
|
7
|
-
webpack: ToolsConfig['webpack'] | Array<NonNullable<ToolsConfig['webpack']>>;
|
|
8
|
-
webpackChain: ToolsConfig['webpackChain'] | Array<NonNullable<ToolsConfig['webpackChain']>>;
|
|
9
|
-
babel: ToolsConfig['babel'] | Array<NonNullable<ToolsConfig['babel']>>;
|
|
10
|
-
postcss: ToolsConfig['postcss'] | Array<NonNullable<ToolsConfig['postcss']>>;
|
|
11
|
-
styledComponents: ToolsConfig['styledComponents'] | Array<NonNullable<ToolsConfig['styledComponents']>>;
|
|
12
|
-
autoprefixer: ToolsConfig['autoprefixer'] | Array<NonNullable<ToolsConfig['autoprefixer']>>;
|
|
13
|
-
lodash: ToolsConfig['lodash'] | Array<ToolsConfig['lodash']>;
|
|
14
|
-
tsLoader: ToolsConfig['tsLoader'] | Array<NonNullable<ToolsConfig['tsLoader']>>;
|
|
15
|
-
terser: ToolsConfig['terser'] | Array<NonNullable<ToolsConfig['terser']>>;
|
|
16
|
-
minifyCss: ToolsConfig['minifyCss'] | Array<NonNullable<ToolsConfig['minifyCss']>>;
|
|
17
|
-
esbuild: ToolsConfig['esbuild'] | Array<NonNullable<ToolsConfig['esbuild']>>;
|
|
18
|
-
htmlPlugin: ToolsConfig['htmlPlugin'] | Array<NonNullable<ToolsConfig['htmlPlugin']>>;
|
|
19
|
-
}
|
|
20
|
-
export interface NormalizedConfig extends Omit<Required<UserConfig>, 'source' | 'tools'> {
|
|
21
|
-
source: NormalizedSourceConfig;
|
|
22
|
-
tools: NormalizedToolsConfig;
|
|
23
|
-
cliOptions?: Record<string, any>;
|
|
24
|
-
_raw: UserConfig;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* merge configuration from modern.config.js and plugins.
|
|
28
|
-
*
|
|
29
|
-
* @param configs - Configuration from modern.config.ts or plugin's config hook.
|
|
30
|
-
* @returns - normalized user config.
|
|
31
|
-
*/
|
|
32
|
-
export declare const mergeConfig: (configs: Array<UserConfig | NormalizedConfig>) => NormalizedConfig;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.deploy = void 0;
|
|
4
|
-
const utils_1 = require("@modern-js/utils");
|
|
5
|
-
exports.deploy = {
|
|
6
|
-
type: 'object',
|
|
7
|
-
properties: {
|
|
8
|
-
domain: { type: ['array', 'string'] },
|
|
9
|
-
domainByEntries: {
|
|
10
|
-
type: 'object',
|
|
11
|
-
patternProperties: {
|
|
12
|
-
[utils_1.ENTRY_NAME_PATTERN]: { type: ['array', 'string'] },
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
};
|