@modern-js/app-tools 1.21.5 → 2.0.0-beta.1
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 +319 -51
- package/dist/js/modern/analyze/constants.js +1 -0
- package/dist/js/modern/analyze/generateCode.js +126 -32
- package/dist/js/modern/analyze/getBundleEntry.js +7 -14
- package/dist/js/modern/analyze/getClientRoutes/getRoutes.js +173 -0
- package/dist/js/modern/analyze/{getClientRoutes.js → getClientRoutes/getRoutesLegacy.js} +13 -58
- package/dist/js/modern/analyze/getClientRoutes/index.js +2 -0
- package/dist/js/modern/analyze/getClientRoutes/utils.js +18 -0
- package/dist/js/modern/analyze/getFileSystemEntry.js +27 -21
- package/dist/js/modern/analyze/getHtmlTemplate.js +2 -9
- package/dist/js/modern/analyze/getServerRoutes.js +15 -32
- package/dist/js/modern/analyze/index.js +81 -23
- package/dist/js/modern/analyze/isDefaultExportFunction.js +0 -4
- package/dist/js/modern/analyze/makeLegalIdentifier.js +0 -2
- package/dist/js/modern/analyze/nestedRoutes.js +102 -0
- package/dist/js/modern/analyze/templates.js +151 -12
- package/dist/js/modern/analyze/utils.js +2 -8
- package/dist/js/modern/builder/builderPlugins/compatModern.js +208 -0
- package/dist/js/modern/builder/createHtmlConfig.js +58 -0
- package/dist/js/modern/builder/createOutputConfig.js +70 -0
- package/dist/js/modern/builder/createSourceConfig.js +74 -0
- package/dist/js/modern/builder/createToolsConfig.js +87 -0
- package/dist/js/modern/builder/index.js +108 -0
- package/dist/js/modern/builder/share.js +44 -0
- package/dist/js/modern/builder/webpackPlugins/htmlAsyncChunkPlugin.js +29 -0
- package/dist/js/modern/builder/webpackPlugins/htmlBottomTemplate.js +33 -0
- package/dist/js/modern/builder/webpackPlugins/routerPlugin.js +97 -0
- package/dist/js/modern/commands/build.js +16 -110
- package/dist/js/modern/commands/dev.js +12 -28
- package/dist/js/modern/commands/inspect.js +8 -66
- package/dist/js/modern/commands/start.js +2 -3
- package/dist/js/modern/index.js +17 -16
- package/dist/js/modern/locale/en.js +0 -1
- package/dist/js/modern/locale/zh.js +0 -1
- package/dist/js/modern/utils/commands.js +5 -0
- package/dist/js/modern/utils/config.js +1 -12
- package/dist/js/modern/utils/createServer.js +12 -1
- package/dist/js/modern/utils/getSpecifiedEntries.js +0 -6
- package/dist/js/modern/utils/printInstructions.js +3 -2
- package/dist/js/modern/utils/routes.js +0 -2
- package/dist/js/node/analyze/constants.js +3 -1
- package/dist/js/node/analyze/generateCode.js +123 -47
- package/dist/js/node/analyze/getBundleEntry.js +7 -20
- package/dist/js/node/analyze/getClientRoutes/getRoutes.js +181 -0
- package/dist/js/node/analyze/{getClientRoutes.js → getClientRoutes/getRoutesLegacy.js} +19 -78
- package/dist/js/node/analyze/getClientRoutes/index.js +19 -0
- package/dist/js/node/analyze/getClientRoutes/utils.js +28 -0
- package/dist/js/node/analyze/getFileSystemEntry.js +26 -28
- package/dist/js/node/analyze/getHtmlTemplate.js +2 -23
- package/dist/js/node/analyze/getServerRoutes.js +14 -40
- package/dist/js/node/analyze/index.js +81 -33
- package/dist/js/node/analyze/isDefaultExportFunction.js +0 -12
- package/dist/js/node/analyze/makeLegalIdentifier.js +0 -4
- package/dist/js/node/analyze/nestedRoutes.js +111 -0
- package/dist/js/node/analyze/templates.js +153 -21
- package/dist/js/node/analyze/utils.js +4 -20
- package/dist/js/node/builder/builderPlugins/compatModern.js +216 -0
- package/dist/js/node/builder/createHtmlConfig.js +68 -0
- package/dist/js/node/builder/createOutputConfig.js +76 -0
- package/dist/js/node/builder/createSourceConfig.js +82 -0
- package/dist/js/node/builder/createToolsConfig.js +94 -0
- package/dist/js/node/builder/index.js +117 -0
- package/dist/js/node/builder/share.js +51 -0
- package/dist/js/node/builder/webpackPlugins/htmlAsyncChunkPlugin.js +36 -0
- package/dist/js/node/builder/webpackPlugins/htmlBottomTemplate.js +40 -0
- package/dist/js/node/builder/webpackPlugins/routerPlugin.js +105 -0
- package/dist/js/node/commands/build.js +14 -121
- package/dist/js/node/commands/deploy.js +0 -2
- package/dist/js/node/commands/dev.js +10 -44
- package/dist/js/node/commands/index.js +0 -6
- package/dist/js/node/commands/inspect.js +10 -90
- package/dist/js/node/commands/start.js +2 -11
- package/dist/js/node/exports/server.js +0 -1
- package/dist/js/node/hooks.js +0 -2
- package/dist/js/node/index.js +22 -32
- package/dist/js/node/locale/en.js +0 -1
- package/dist/js/node/locale/index.js +0 -4
- package/dist/js/node/locale/zh.js +0 -1
- package/dist/js/node/utils/commands.js +12 -0
- package/dist/js/node/utils/config.js +1 -25
- package/dist/js/node/utils/createServer.js +15 -11
- package/dist/js/node/utils/getSpecifiedEntries.js +0 -9
- package/dist/js/node/utils/language.js +0 -2
- package/dist/js/node/utils/printInstructions.js +3 -6
- package/dist/js/node/utils/routes.js +0 -5
- package/dist/js/treeshaking/analyze/constants.js +16 -0
- package/dist/js/treeshaking/analyze/generateCode.js +369 -0
- package/dist/js/treeshaking/analyze/getBundleEntry.js +69 -0
- package/dist/js/treeshaking/analyze/getClientRoutes/getRoutes.js +184 -0
- package/dist/js/treeshaking/analyze/getClientRoutes/getRoutesLegacy.js +185 -0
- package/dist/js/treeshaking/analyze/getClientRoutes/index.js +2 -0
- package/dist/js/treeshaking/analyze/getClientRoutes/utils.js +24 -0
- package/dist/js/treeshaking/analyze/getFileSystemEntry.js +96 -0
- package/dist/js/treeshaking/analyze/getHtmlTemplate.js +129 -0
- package/dist/js/treeshaking/analyze/getServerRoutes.js +157 -0
- package/dist/js/treeshaking/analyze/index.js +334 -0
- package/dist/js/treeshaking/analyze/isDefaultExportFunction.js +28 -0
- package/dist/js/treeshaking/analyze/makeLegalIdentifier.js +16 -0
- package/dist/js/treeshaking/analyze/nestedRoutes.js +165 -0
- package/dist/js/treeshaking/analyze/templates.js +170 -0
- package/dist/js/treeshaking/analyze/utils.js +88 -0
- package/dist/js/treeshaking/builder/builderPlugins/compatModern.js +212 -0
- package/dist/js/treeshaking/builder/createHtmlConfig.js +59 -0
- package/dist/js/treeshaking/builder/createOutputConfig.js +70 -0
- package/dist/js/treeshaking/builder/createSourceConfig.js +88 -0
- package/dist/js/treeshaking/builder/createToolsConfig.js +85 -0
- package/dist/js/treeshaking/builder/index.js +161 -0
- package/dist/js/treeshaking/builder/share.js +46 -0
- package/dist/js/treeshaking/builder/webpackPlugins/htmlAsyncChunkPlugin.js +46 -0
- package/dist/js/treeshaking/builder/webpackPlugins/htmlBottomTemplate.js +41 -0
- package/dist/js/treeshaking/builder/webpackPlugins/routerPlugin.js +121 -0
- package/dist/js/treeshaking/commands/build.js +83 -0
- package/dist/js/treeshaking/commands/deploy.js +26 -0
- package/dist/js/treeshaking/commands/dev.js +124 -0
- package/dist/js/treeshaking/commands/index.js +3 -0
- package/dist/js/treeshaking/commands/inspect.js +29 -0
- package/dist/js/treeshaking/commands/start.js +69 -0
- package/dist/js/treeshaking/exports/server.js +1 -0
- package/dist/js/treeshaking/hooks.js +21 -0
- package/dist/js/treeshaking/index.js +267 -0
- package/dist/js/treeshaking/locale/en.js +34 -0
- package/dist/js/treeshaking/locale/index.js +9 -0
- package/dist/js/treeshaking/locale/zh.js +34 -0
- package/dist/js/treeshaking/utils/commands.js +5 -0
- package/dist/js/treeshaking/utils/config.js +124 -0
- package/dist/js/treeshaking/utils/createServer.js +73 -0
- package/dist/js/treeshaking/utils/getSpecifiedEntries.js +58 -0
- package/dist/js/treeshaking/utils/language.js +5 -0
- package/dist/js/treeshaking/utils/printInstructions.js +30 -0
- package/dist/js/treeshaking/utils/routes.js +29 -0
- package/dist/js/treeshaking/utils/types.js +0 -0
- package/dist/types/analyze/constants.d.ts +1 -0
- package/dist/types/analyze/generateCode.d.ts +1 -1
- package/dist/types/analyze/{getClientRoutes.d.ts → getClientRoutes/getRoutes.d.ts} +2 -7
- package/dist/types/analyze/getClientRoutes/getRoutesLegacy.d.ts +15 -0
- package/dist/types/analyze/getClientRoutes/index.d.ts +2 -0
- package/dist/types/analyze/getClientRoutes/utils.d.ts +5 -0
- package/dist/types/analyze/index.d.ts +4 -5
- package/dist/types/analyze/nestedRoutes.d.ts +5 -0
- package/dist/types/analyze/templates.d.ts +19 -3
- package/dist/types/analyze/utils.d.ts +2 -1
- package/dist/types/builder/builderPlugins/compatModern.d.ts +13 -0
- package/dist/types/builder/createHtmlConfig.d.ts +6 -0
- package/dist/types/builder/createOutputConfig.d.ts +3 -0
- package/dist/types/builder/createSourceConfig.d.ts +5 -0
- package/dist/types/builder/createToolsConfig.d.ts +13 -0
- package/dist/types/builder/index.d.ts +15 -0
- package/dist/types/builder/share.d.ts +26 -0
- package/dist/types/builder/webpackPlugins/htmlAsyncChunkPlugin.d.ts +8 -0
- package/dist/types/builder/webpackPlugins/htmlBottomTemplate.d.ts +10 -0
- package/dist/types/builder/webpackPlugins/routerPlugin.d.ts +10 -0
- package/dist/types/commands/build.d.ts +2 -1
- package/dist/types/commands/deploy.d.ts +2 -1
- package/dist/types/commands/dev.d.ts +2 -1
- package/dist/types/commands/inspect.d.ts +2 -6
- package/dist/types/commands/start.d.ts +2 -1
- package/dist/types/hooks.d.ts +15 -10
- package/dist/types/index.d.ts +4 -4
- package/dist/types/locale/en.d.ts +0 -1
- package/dist/types/locale/index.d.ts +0 -2
- package/dist/types/locale/zh.d.ts +0 -1
- package/dist/types/utils/commands.d.ts +1 -0
- package/dist/types/utils/config.d.ts +0 -1
- package/dist/types/utils/createServer.d.ts +8 -1
- package/dist/types/utils/printInstructions.d.ts +3 -2
- package/dist/types/utils/types.d.ts +2 -3
- package/package.json +25 -42
- package/dist/js/modern/utils/createCompiler.js +0 -61
- package/dist/js/node/utils/createCompiler.js +0 -81
- package/dist/types/utils/createCompiler.d.ts +0 -13
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import { findExists } from '@modern-js/utils';
|
|
3
|
+
export function createHtmlConfig(normalizedConfig, appContext) {
|
|
4
|
+
var _normalizedConfig$out = normalizedConfig.output,
|
|
5
|
+
disableHtmlFolder = _normalizedConfig$out.disableHtmlFolder,
|
|
6
|
+
favicon = _normalizedConfig$out.favicon,
|
|
7
|
+
faviconByEntries = _normalizedConfig$out.faviconByEntries,
|
|
8
|
+
inject = _normalizedConfig$out.inject,
|
|
9
|
+
injectByEntries = _normalizedConfig$out.injectByEntries,
|
|
10
|
+
meta = _normalizedConfig$out.meta,
|
|
11
|
+
metaByEntries = _normalizedConfig$out.metaByEntries,
|
|
12
|
+
mountId = _normalizedConfig$out.mountId,
|
|
13
|
+
title = _normalizedConfig$out.title,
|
|
14
|
+
titleByEntries = _normalizedConfig$out.titleByEntries,
|
|
15
|
+
scriptExt = _normalizedConfig$out.scriptExt,
|
|
16
|
+
templateParameters = _normalizedConfig$out.templateParameters,
|
|
17
|
+
templateParametersByEntries = _normalizedConfig$out.templateParametersByEntries;
|
|
18
|
+
var configDir = normalizedConfig.source.configDir;
|
|
19
|
+
|
|
20
|
+
// transform Modernjs `output.scriptExt` to Builder `html.crossorigin` configuration
|
|
21
|
+
var builderCrossorigin = createBuilderCrossorigin(scriptExt);
|
|
22
|
+
var builderAppIcon = createBuilderAppIcon(configDir, appContext);
|
|
23
|
+
var builderFavicon = createBuilderFavicon(favicon, configDir, appContext);
|
|
24
|
+
return {
|
|
25
|
+
appIcon: builderAppIcon,
|
|
26
|
+
disableHtmlFolder: disableHtmlFolder,
|
|
27
|
+
favicon: builderFavicon,
|
|
28
|
+
faviconByEntries: faviconByEntries,
|
|
29
|
+
inject: inject,
|
|
30
|
+
injectByEntries: injectByEntries,
|
|
31
|
+
meta: meta,
|
|
32
|
+
metaByEntries: metaByEntries,
|
|
33
|
+
mountId: mountId,
|
|
34
|
+
title: title,
|
|
35
|
+
titleByEntries: titleByEntries,
|
|
36
|
+
crossorigin: builderCrossorigin,
|
|
37
|
+
templateByEntries: appContext.htmlTemplates,
|
|
38
|
+
templateParameters: templateParameters,
|
|
39
|
+
templateParametersByEntries: templateParametersByEntries
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
var ICON_EXTENSIONS = ['png', 'jpg', 'jpeg', 'svg', 'ico'];
|
|
43
|
+
export function createBuilderAppIcon(configDir, appContext) {
|
|
44
|
+
var appIcon = findExists(ICON_EXTENSIONS.map(function (ext) {
|
|
45
|
+
return path.resolve(appContext.appDirectory, configDir, "icon.".concat(ext));
|
|
46
|
+
}));
|
|
47
|
+
return typeof appIcon === 'string' ? appIcon : undefined;
|
|
48
|
+
}
|
|
49
|
+
export function createBuilderCrossorigin(scriptExt) {
|
|
50
|
+
var _scriptExtCustomConfi;
|
|
51
|
+
var scriptExtCustomConfig = scriptExt === null || scriptExt === void 0 ? void 0 : scriptExt.custom;
|
|
52
|
+
return scriptExtCustomConfig !== null && scriptExtCustomConfig !== void 0 && (_scriptExtCustomConfi = scriptExtCustomConfig.test) !== null && _scriptExtCustomConfi !== void 0 && _scriptExtCustomConfi.test('.js') && (scriptExtCustomConfig === null || scriptExtCustomConfig === void 0 ? void 0 : scriptExtCustomConfig.attribute) === 'crossorigin' ? scriptExtCustomConfig.value : undefined;
|
|
53
|
+
}
|
|
54
|
+
export function createBuilderFavicon(favicon, configDir, appContext) {
|
|
55
|
+
var defaultFavicon = findExists(ICON_EXTENSIONS.map(function (ext) {
|
|
56
|
+
return path.resolve(appContext.appDirectory, configDir, "favicon.".concat(ext));
|
|
57
|
+
}));
|
|
58
|
+
return favicon || defaultFavicon || undefined;
|
|
59
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
|
+
import { createCopyPattern } from "./share";
|
|
3
|
+
export function createOutputConfig(normalizedConfig, appContext) {
|
|
4
|
+
// TODO: add `externals` options in Modern.
|
|
5
|
+
|
|
6
|
+
var _normalizedConfig$out = normalizedConfig.output,
|
|
7
|
+
assetPrefix = _normalizedConfig$out.assetPrefix,
|
|
8
|
+
copy = _normalizedConfig$out.copy,
|
|
9
|
+
cssModuleLocalIdentName = _normalizedConfig$out.cssModuleLocalIdentName,
|
|
10
|
+
cssPath = _normalizedConfig$out.cssPath,
|
|
11
|
+
jsPath = _normalizedConfig$out.jsPath,
|
|
12
|
+
htmlPath = _normalizedConfig$out.htmlPath,
|
|
13
|
+
mediaPath = _normalizedConfig$out.mediaPath,
|
|
14
|
+
path = _normalizedConfig$out.path,
|
|
15
|
+
disableInlineRuntimeChunk = _normalizedConfig$out.disableInlineRuntimeChunk,
|
|
16
|
+
disableMinimize = _normalizedConfig$out.disableMinimize,
|
|
17
|
+
disableSourceMap = _normalizedConfig$out.disableSourceMap,
|
|
18
|
+
disableTsChecker = _normalizedConfig$out.disableTsChecker,
|
|
19
|
+
enableCssModuleTSDeclaration = _normalizedConfig$out.enableCssModuleTSDeclaration,
|
|
20
|
+
enableInlineScripts = _normalizedConfig$out.enableInlineScripts,
|
|
21
|
+
enableInlineStyles = _normalizedConfig$out.enableInlineStyles,
|
|
22
|
+
polyfill = _normalizedConfig$out.polyfill,
|
|
23
|
+
dataUriLimit = _normalizedConfig$out.dataUriLimit,
|
|
24
|
+
disableAssetsCache = _normalizedConfig$out.disableAssetsCache,
|
|
25
|
+
enableLatestDecorators = _normalizedConfig$out.enableLatestDecorators,
|
|
26
|
+
disableCssModuleExtension = _normalizedConfig$out.disableCssModuleExtension;
|
|
27
|
+
var defaultCopyPattern = createCopyPattern(appContext, normalizedConfig, 'upload');
|
|
28
|
+
var builderCopy = copy ? [].concat(_toConsumableArray(copy), [defaultCopyPattern]) : [defaultCopyPattern];
|
|
29
|
+
return {
|
|
30
|
+
assetPrefix: assetPrefix,
|
|
31
|
+
copy: builderCopy,
|
|
32
|
+
distPath: {
|
|
33
|
+
root: path,
|
|
34
|
+
css: cssPath,
|
|
35
|
+
js: jsPath,
|
|
36
|
+
html: htmlPath,
|
|
37
|
+
// `@modern-js/webpack` output all media files to `dist/media` by default
|
|
38
|
+
svg: mediaPath || 'media',
|
|
39
|
+
image: mediaPath || 'media',
|
|
40
|
+
font: mediaPath || 'media',
|
|
41
|
+
media: mediaPath || 'media'
|
|
42
|
+
},
|
|
43
|
+
dataUriLimit: {
|
|
44
|
+
svg: dataUriLimit,
|
|
45
|
+
image: dataUriLimit,
|
|
46
|
+
font: dataUriLimit,
|
|
47
|
+
media: dataUriLimit
|
|
48
|
+
},
|
|
49
|
+
disableCssModuleExtension: disableCssModuleExtension,
|
|
50
|
+
disableInlineRuntimeChunk: disableInlineRuntimeChunk,
|
|
51
|
+
disableMinimize: disableMinimize,
|
|
52
|
+
disableSourceMap: disableSourceMap,
|
|
53
|
+
disableTsChecker: disableTsChecker,
|
|
54
|
+
enableCssModuleTSDeclaration: enableCssModuleTSDeclaration,
|
|
55
|
+
enableInlineScripts: enableInlineScripts,
|
|
56
|
+
enableInlineStyles: enableInlineStyles,
|
|
57
|
+
polyfill: polyfill,
|
|
58
|
+
// We need to do this in the app-tools prepare hook because some files will be generated into the dist directory in the analyze process
|
|
59
|
+
cleanDistPath: false,
|
|
60
|
+
disableFilenameHash: disableAssetsCache,
|
|
61
|
+
enableLatestDecorators: enableLatestDecorators,
|
|
62
|
+
filename: {
|
|
63
|
+
css: cssModuleLocalIdentName
|
|
64
|
+
},
|
|
65
|
+
// `@modern-js/webpack` used to generate asset manifest by default
|
|
66
|
+
enableAssetManifest: true,
|
|
67
|
+
// compatible the modern-js with fallback behavior
|
|
68
|
+
enableAssetFallback: true
|
|
69
|
+
};
|
|
70
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
|
+
import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
|
|
3
|
+
import { dirname, isAbsolute, posix, sep } from 'path';
|
|
4
|
+
import { globby, mergeAlias, findMonorepoRoot, isModernjsMonorepo } from '@modern-js/utils';
|
|
5
|
+
export function createSourceConfig(normalizedConfig, appContext) {
|
|
6
|
+
var _normalizedConfig$sou = normalizedConfig.source,
|
|
7
|
+
alias = _normalizedConfig$sou.alias,
|
|
8
|
+
envVars = _normalizedConfig$sou.envVars,
|
|
9
|
+
globalVars = _normalizedConfig$sou.globalVars,
|
|
10
|
+
include = _normalizedConfig$sou.include,
|
|
11
|
+
moduleScopes = _normalizedConfig$sou.moduleScopes,
|
|
12
|
+
preEntry = _normalizedConfig$sou.preEntry;
|
|
13
|
+
var builderGlobalVars = globalVars || {};
|
|
14
|
+
var _iterator = _createForOfIteratorHelper(envVars || []),
|
|
15
|
+
_step;
|
|
16
|
+
try {
|
|
17
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
18
|
+
var envVar = _step.value;
|
|
19
|
+
var envVarValue = process.env[envVar];
|
|
20
|
+
envVarValue && (builderGlobalVars["process.env.".concat(envVar)] = envVarValue);
|
|
21
|
+
}
|
|
22
|
+
} catch (err) {
|
|
23
|
+
_iterator.e(err);
|
|
24
|
+
} finally {
|
|
25
|
+
_iterator.f();
|
|
26
|
+
}
|
|
27
|
+
var builderModuleScope = createBuilderModuleScope(moduleScopes);
|
|
28
|
+
var builderInclude = createBuilderInclude(include, appContext);
|
|
29
|
+
return {
|
|
30
|
+
alias: mergeAlias(alias),
|
|
31
|
+
moduleScopes: builderModuleScope,
|
|
32
|
+
globalVars: builderGlobalVars,
|
|
33
|
+
include: builderInclude,
|
|
34
|
+
preEntry: preEntry,
|
|
35
|
+
// ensure resolve.extensions same as before
|
|
36
|
+
resolveExtensionPrefix: '.web'
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
export function createBuilderInclude(include, appContext) {
|
|
40
|
+
var defaultInclude = [appContext.internalDirectory];
|
|
41
|
+
var transformInclude = (include || []).map(function (include) {
|
|
42
|
+
if (typeof include === 'string') {
|
|
43
|
+
if (isAbsolute(include)) {
|
|
44
|
+
return include;
|
|
45
|
+
}
|
|
46
|
+
return new RegExp(include);
|
|
47
|
+
}
|
|
48
|
+
return include;
|
|
49
|
+
}).concat(defaultInclude); // concat default Include
|
|
50
|
+
|
|
51
|
+
var root = findMonorepoRoot(appContext.appDirectory);
|
|
52
|
+
if (!root) {
|
|
53
|
+
return transformInclude;
|
|
54
|
+
}
|
|
55
|
+
var modernjsMonorepo = isModernjsMonorepo(root);
|
|
56
|
+
if (modernjsMonorepo) {
|
|
57
|
+
var paths = globby.sync(posix.join(root, 'features', '**', 'package.json'), {
|
|
58
|
+
ignore: ['**/node_modules/**/*']
|
|
59
|
+
}).map(function (pathname) {
|
|
60
|
+
return dirname(pathname) + sep;
|
|
61
|
+
});
|
|
62
|
+
return [].concat(_toConsumableArray(paths), _toConsumableArray(transformInclude));
|
|
63
|
+
}
|
|
64
|
+
return transformInclude;
|
|
65
|
+
}
|
|
66
|
+
export function createBuilderModuleScope(moduleScopes) {
|
|
67
|
+
if (moduleScopes) {
|
|
68
|
+
var builderModuleScope = [];
|
|
69
|
+
var DEFAULT_SCOPES = ['./src', './shared', /node_modules/];
|
|
70
|
+
if (Array.isArray(moduleScopes)) {
|
|
71
|
+
if (isPrimitiveScope(moduleScopes)) {
|
|
72
|
+
builderModuleScope = DEFAULT_SCOPES.concat(moduleScopes);
|
|
73
|
+
} else {
|
|
74
|
+
builderModuleScope = [DEFAULT_SCOPES].concat(_toConsumableArray(moduleScopes));
|
|
75
|
+
}
|
|
76
|
+
} else {
|
|
77
|
+
builderModuleScope = [DEFAULT_SCOPES, moduleScopes];
|
|
78
|
+
}
|
|
79
|
+
return builderModuleScope;
|
|
80
|
+
} else {
|
|
81
|
+
return undefined;
|
|
82
|
+
}
|
|
83
|
+
function isPrimitiveScope(items) {
|
|
84
|
+
return items.every(function (item) {
|
|
85
|
+
return typeof item === 'string' || Object.prototype.toString.call(item) === '[object RegExp]';
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
2
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
4
|
+
import { applyOptionsChain } from '@modern-js/utils';
|
|
5
|
+
export function createToolsConfig(normalizedConfig) {
|
|
6
|
+
var _normalizedConfig$out = normalizedConfig.output,
|
|
7
|
+
disableCssExtract = _normalizedConfig$out.disableCssExtract,
|
|
8
|
+
enableTsLoader = _normalizedConfig$out.enableTsLoader;
|
|
9
|
+
var _normalizedConfig$too = normalizedConfig.tools,
|
|
10
|
+
autoprefixer = _normalizedConfig$too.autoprefixer,
|
|
11
|
+
babel = _normalizedConfig$too.babel,
|
|
12
|
+
minifyCss = _normalizedConfig$too.minifyCss,
|
|
13
|
+
terser = _normalizedConfig$too.terser,
|
|
14
|
+
webpack = _normalizedConfig$too.webpack,
|
|
15
|
+
webpackChain = _normalizedConfig$too.webpackChain,
|
|
16
|
+
tsLoader = _normalizedConfig$too.tsLoader,
|
|
17
|
+
styledComponents = _normalizedConfig$too.styledComponents,
|
|
18
|
+
sass = _normalizedConfig$too.sass,
|
|
19
|
+
postcss = _normalizedConfig$too.postcss,
|
|
20
|
+
less = _normalizedConfig$too.less,
|
|
21
|
+
htmlPlugin = _normalizedConfig$too.htmlPlugin,
|
|
22
|
+
lodash = _normalizedConfig$too.lodash;
|
|
23
|
+
var builderTsLoader = createBuilderTsLoader(tsLoader, enableTsLoader);
|
|
24
|
+
var builderTsChecker = createBuilderTsChecker(normalizedConfig.output);
|
|
25
|
+
return {
|
|
26
|
+
tsChecker: builderTsChecker,
|
|
27
|
+
styleLoader: disableCssExtract ? {} : undefined,
|
|
28
|
+
cssExtract: disableCssExtract ? false : undefined,
|
|
29
|
+
autoprefixer: autoprefixer,
|
|
30
|
+
babel: babel,
|
|
31
|
+
minifyCss: minifyCss,
|
|
32
|
+
terser: terser,
|
|
33
|
+
webpack: webpack,
|
|
34
|
+
webpackChain: webpackChain,
|
|
35
|
+
tsLoader: builderTsLoader,
|
|
36
|
+
styledComponents: styledComponents,
|
|
37
|
+
sass: sass,
|
|
38
|
+
postcss: postcss,
|
|
39
|
+
less: less,
|
|
40
|
+
// can't remove comment in html minify.
|
|
41
|
+
// some html template insert by using those comments.
|
|
42
|
+
htmlPlugin: [function (config) {
|
|
43
|
+
return _objectSpread(_objectSpread({}, config), {}, {
|
|
44
|
+
minify: _typeof(config.minify) === 'object' ? _objectSpread(_objectSpread({}, config.minify), {}, {
|
|
45
|
+
removeComments: false
|
|
46
|
+
}) : config.minify
|
|
47
|
+
});
|
|
48
|
+
}].concat(_toConsumableArray(Array.isArray(htmlPlugin) ? htmlPlugin : htmlPlugin ? [htmlPlugin] : []))
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
function createBuilderTsLoader(tsLoader, enableTsLoader) {
|
|
52
|
+
var useTsLoader = Boolean(enableTsLoader);
|
|
53
|
+
if (!useTsLoader) {
|
|
54
|
+
return undefined;
|
|
55
|
+
}
|
|
56
|
+
var defaultTsLoader = {
|
|
57
|
+
compilerOptions: {
|
|
58
|
+
target: 'es5',
|
|
59
|
+
module: 'ESNext'
|
|
60
|
+
},
|
|
61
|
+
transpileOnly: false,
|
|
62
|
+
allowTsInNodeModules: true
|
|
63
|
+
};
|
|
64
|
+
return function (_, utils) {
|
|
65
|
+
return applyOptionsChain(defaultTsLoader, tsLoader, utils);
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
export function createBuilderTsChecker(output) {
|
|
69
|
+
if (output.enableTsLoader) {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
var defaultTsChecker = {
|
|
73
|
+
issue: {
|
|
74
|
+
include: [{
|
|
75
|
+
file: '**/src/**/*'
|
|
76
|
+
}],
|
|
77
|
+
exclude: [{
|
|
78
|
+
file: '**/*.(spec|test).ts'
|
|
79
|
+
}, {
|
|
80
|
+
file: '**/node_modules/**/*'
|
|
81
|
+
}]
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
return defaultTsChecker;
|
|
85
|
+
}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
|
2
|
+
import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
|
|
3
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
4
|
+
import { createBuilder } from '@modern-js/builder';
|
|
5
|
+
import { builderWebpackProvider } from '@modern-js/builder-webpack-provider';
|
|
6
|
+
import { applyOptionsChain, isUseSSRBundle } from '@modern-js/utils';
|
|
7
|
+
import { PluginCompatModern } from "./builderPlugins/compatModern";
|
|
8
|
+
import { createHtmlConfig } from "./createHtmlConfig";
|
|
9
|
+
import { createOutputConfig } from "./createOutputConfig";
|
|
10
|
+
import { createSourceConfig } from "./createSourceConfig";
|
|
11
|
+
import { createToolsConfig } from "./createToolsConfig";
|
|
12
|
+
function getBuilderTargets(normalizedConfig) {
|
|
13
|
+
var targets = ['web'];
|
|
14
|
+
if (normalizedConfig.output.enableModernMode && !targets.includes('modern-web')) {
|
|
15
|
+
targets.push('modern-web');
|
|
16
|
+
}
|
|
17
|
+
if (isUseSSRBundle(normalizedConfig)) {
|
|
18
|
+
targets.push('node');
|
|
19
|
+
}
|
|
20
|
+
return targets;
|
|
21
|
+
}
|
|
22
|
+
export function createBuilderForEdenX(_x) {
|
|
23
|
+
return _createBuilderForEdenX.apply(this, arguments);
|
|
24
|
+
}
|
|
25
|
+
function _createBuilderForEdenX() {
|
|
26
|
+
_createBuilderForEdenX = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
|
|
27
|
+
var normalizedConfig, appContext, compatPluginConfig, builderConfig, webpackProvider, target, builderOptions, builder;
|
|
28
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
29
|
+
while (1) {
|
|
30
|
+
switch (_context.prev = _context.next) {
|
|
31
|
+
case 0:
|
|
32
|
+
normalizedConfig = _ref.normalizedConfig, appContext = _ref.appContext, compatPluginConfig = _ref.compatPluginConfig;
|
|
33
|
+
builderConfig = createBuilderProviderConfig(normalizedConfig, appContext); // create webpack provider
|
|
34
|
+
webpackProvider = builderWebpackProvider({
|
|
35
|
+
builderConfig: builderConfig
|
|
36
|
+
});
|
|
37
|
+
target = getBuilderTargets(normalizedConfig);
|
|
38
|
+
builderOptions = createBuilderOptions(target, appContext);
|
|
39
|
+
_context.next = 7;
|
|
40
|
+
return createBuilder(webpackProvider, builderOptions);
|
|
41
|
+
case 7:
|
|
42
|
+
builder = _context.sent;
|
|
43
|
+
_context.next = 10;
|
|
44
|
+
return applyBuilderPlugins(builder, normalizedConfig, appContext, compatPluginConfig);
|
|
45
|
+
case 10:
|
|
46
|
+
return _context.abrupt("return", builder);
|
|
47
|
+
case 11:
|
|
48
|
+
case "end":
|
|
49
|
+
return _context.stop();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}, _callee);
|
|
53
|
+
}));
|
|
54
|
+
return _createBuilderForEdenX.apply(this, arguments);
|
|
55
|
+
}
|
|
56
|
+
function createBuilderProviderConfig(normalizedConfig, appContext) {
|
|
57
|
+
var source = createSourceConfig(normalizedConfig, appContext);
|
|
58
|
+
var html = createHtmlConfig(normalizedConfig, appContext);
|
|
59
|
+
var output = createOutputConfig(normalizedConfig, appContext);
|
|
60
|
+
var tools = createToolsConfig(normalizedConfig);
|
|
61
|
+
return {
|
|
62
|
+
source: source,
|
|
63
|
+
html: html,
|
|
64
|
+
output: output,
|
|
65
|
+
tools: tools,
|
|
66
|
+
dev: {
|
|
67
|
+
https: normalizedConfig.dev.https,
|
|
68
|
+
assetPrefix: normalizedConfig.dev.assetPrefix
|
|
69
|
+
},
|
|
70
|
+
performance: {
|
|
71
|
+
// `@modern-js/webpack` used to remove moment locale by default
|
|
72
|
+
removeMomentLocale: true
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
export function createBuilderOptions(target, appContext) {
|
|
77
|
+
// create entries
|
|
78
|
+
|
|
79
|
+
var entries = {};
|
|
80
|
+
var _appContext$entrypoin = appContext.entrypoints,
|
|
81
|
+
entrypoints = _appContext$entrypoin === void 0 ? [] : _appContext$entrypoin,
|
|
82
|
+
checkedEntries = appContext.checkedEntries;
|
|
83
|
+
var _iterator = _createForOfIteratorHelper(entrypoints),
|
|
84
|
+
_step;
|
|
85
|
+
try {
|
|
86
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
87
|
+
var _step$value = _step.value,
|
|
88
|
+
entryName = _step$value.entryName,
|
|
89
|
+
entry = _step$value.entry;
|
|
90
|
+
if (checkedEntries && !checkedEntries.includes(entryName)) {
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
if (entryName in entries) {
|
|
94
|
+
entries[entryName].push(entry);
|
|
95
|
+
} else {
|
|
96
|
+
entries[entryName] = [entry];
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
} catch (err) {
|
|
100
|
+
_iterator.e(err);
|
|
101
|
+
} finally {
|
|
102
|
+
_iterator.f();
|
|
103
|
+
}
|
|
104
|
+
return {
|
|
105
|
+
cwd: appContext.appDirectory,
|
|
106
|
+
target: target,
|
|
107
|
+
configPath: appContext.configFile || undefined,
|
|
108
|
+
entry: entries,
|
|
109
|
+
framework: appContext.metaName
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* register builder Plugin by condition
|
|
115
|
+
*/
|
|
116
|
+
function applyBuilderPlugins(_x2, _x3, _x4, _x5) {
|
|
117
|
+
return _applyBuilderPlugins.apply(this, arguments);
|
|
118
|
+
}
|
|
119
|
+
function _applyBuilderPlugins() {
|
|
120
|
+
_applyBuilderPlugins = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(builder, normalizedConfig, appContext, compatPluginConfig) {
|
|
121
|
+
var _yield$import, PluginNodePolyfill, esbuildOptions, _yield$import2, PluginEsbuild;
|
|
122
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
123
|
+
while (1) {
|
|
124
|
+
switch (_context2.prev = _context2.next) {
|
|
125
|
+
case 0:
|
|
126
|
+
if (normalizedConfig.output.disableNodePolyfill) {
|
|
127
|
+
_context2.next = 6;
|
|
128
|
+
break;
|
|
129
|
+
}
|
|
130
|
+
_context2.next = 3;
|
|
131
|
+
return import('@modern-js/builder-plugin-node-polyfill');
|
|
132
|
+
case 3:
|
|
133
|
+
_yield$import = _context2.sent;
|
|
134
|
+
PluginNodePolyfill = _yield$import.PluginNodePolyfill;
|
|
135
|
+
builder.addPlugins([PluginNodePolyfill()]);
|
|
136
|
+
case 6:
|
|
137
|
+
if (!normalizedConfig.tools.esbuild) {
|
|
138
|
+
_context2.next = 13;
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
141
|
+
esbuildOptions = normalizedConfig.tools.esbuild;
|
|
142
|
+
_context2.next = 10;
|
|
143
|
+
return import('@modern-js/builder-plugin-esbuild');
|
|
144
|
+
case 10:
|
|
145
|
+
_yield$import2 = _context2.sent;
|
|
146
|
+
PluginEsbuild = _yield$import2.PluginEsbuild;
|
|
147
|
+
builder.addPlugins([PluginEsbuild({
|
|
148
|
+
loader: false,
|
|
149
|
+
minimize: applyOptionsChain({}, esbuildOptions)
|
|
150
|
+
})]);
|
|
151
|
+
case 13:
|
|
152
|
+
builder.addPlugins([PluginCompatModern(appContext, normalizedConfig, compatPluginConfig)]);
|
|
153
|
+
case 14:
|
|
154
|
+
case "end":
|
|
155
|
+
return _context2.stop();
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}, _callee2);
|
|
159
|
+
}));
|
|
160
|
+
return _applyBuilderPlugins.apply(this, arguments);
|
|
161
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import { template as lodashTemplate } from '@modern-js/utils/lodash';
|
|
3
|
+
import { removeTailSlash } from '@modern-js/utils';
|
|
4
|
+
export function createCopyPattern(appContext, config, patternsType, chain) {
|
|
5
|
+
var configDir = path.resolve(appContext.appDirectory, config.source.configDir);
|
|
6
|
+
var uploadDir = path.posix.join(configDir.replace(/\\/g, '/'), 'upload');
|
|
7
|
+
var publicDir = path.posix.join(configDir.replace(/\\/g, '/'), 'public');
|
|
8
|
+
var minifiedJsRexExp = /\.min\.js/;
|
|
9
|
+
var info = function info(file) {
|
|
10
|
+
return {
|
|
11
|
+
// If the file name ends with `.min.js`, we assume it's a compressed file.
|
|
12
|
+
// So we don't want copy-webpack-plugin to minify it.
|
|
13
|
+
// ref: https://github.com/webpack-contrib/copy-webpack-plugin#info
|
|
14
|
+
minimized: minifiedJsRexExp.test(file.sourceFilename)
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
if (patternsType === 'public') {
|
|
18
|
+
if (!chain) {
|
|
19
|
+
throw new Error("expect get a webpackChain, but receive 'undefined'");
|
|
20
|
+
}
|
|
21
|
+
return {
|
|
22
|
+
info: info,
|
|
23
|
+
from: '**/*',
|
|
24
|
+
to: 'public',
|
|
25
|
+
context: publicDir,
|
|
26
|
+
noErrorOnMissing: true,
|
|
27
|
+
// eslint-disable-next-line node/prefer-global/buffer
|
|
28
|
+
transform: function transform(content, absoluteFrom) {
|
|
29
|
+
if (!/\.html?$/.test(absoluteFrom)) {
|
|
30
|
+
return content;
|
|
31
|
+
}
|
|
32
|
+
return lodashTemplate(content.toString('utf8'))({
|
|
33
|
+
assetPrefix: removeTailSlash(chain.output.get('publicPath'))
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
} else {
|
|
38
|
+
return {
|
|
39
|
+
info: info,
|
|
40
|
+
from: '**/*',
|
|
41
|
+
to: 'upload',
|
|
42
|
+
context: uploadDir,
|
|
43
|
+
noErrorOnMissing: true
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
|
|
2
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
3
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
4
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
5
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
6
|
+
export var HtmlAsyncChunkPlugin = /*#__PURE__*/function () {
|
|
7
|
+
function HtmlAsyncChunkPlugin(htmlWebpackPlugin) {
|
|
8
|
+
_classCallCheck(this, HtmlAsyncChunkPlugin);
|
|
9
|
+
_defineProperty(this, "name", void 0);
|
|
10
|
+
_defineProperty(this, "htmlWebpackPlugin", void 0);
|
|
11
|
+
this.name = 'HtmlAsyncChunkPlugin';
|
|
12
|
+
this.htmlWebpackPlugin = htmlWebpackPlugin;
|
|
13
|
+
}
|
|
14
|
+
_createClass(HtmlAsyncChunkPlugin, [{
|
|
15
|
+
key: "apply",
|
|
16
|
+
value: function apply(compiler) {
|
|
17
|
+
var _this = this;
|
|
18
|
+
compiler.hooks.compilation.tap(this.name, function (compilation) {
|
|
19
|
+
var hooks = _this.htmlWebpackPlugin.getHooks(compilation);
|
|
20
|
+
hooks.alterAssetTagGroups.tap(_this.name, function (assets) {
|
|
21
|
+
var tags = [].concat(_toConsumableArray(assets.headTags), _toConsumableArray(assets.bodyTags));
|
|
22
|
+
var _iterator = _createForOfIteratorHelper(tags),
|
|
23
|
+
_step;
|
|
24
|
+
try {
|
|
25
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
26
|
+
var tag = _step.value;
|
|
27
|
+
if (tag.tagName === 'script') {
|
|
28
|
+
var attributes = tag.attributes;
|
|
29
|
+
if (attributes && attributes.defer === true) {
|
|
30
|
+
attributes.async = true;
|
|
31
|
+
delete attributes.defer;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
} catch (err) {
|
|
36
|
+
_iterator.e(err);
|
|
37
|
+
} finally {
|
|
38
|
+
_iterator.f();
|
|
39
|
+
}
|
|
40
|
+
return assets;
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}]);
|
|
45
|
+
return HtmlAsyncChunkPlugin;
|
|
46
|
+
}();
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
4
|
+
export var BottomTemplatePlugin = /*#__PURE__*/function () {
|
|
5
|
+
function BottomTemplatePlugin(htmlWebpackPlugin) {
|
|
6
|
+
_classCallCheck(this, BottomTemplatePlugin);
|
|
7
|
+
_defineProperty(this, "htmlWebpackPlugin", void 0);
|
|
8
|
+
_defineProperty(this, "bottomTemplateReg", /<!--<\?-\s*bottomTemplate\s*\?>-->/);
|
|
9
|
+
_defineProperty(this, "bodyRegExp", /(<\/\s*body\s*>)/i);
|
|
10
|
+
_defineProperty(this, "name", void 0);
|
|
11
|
+
this.htmlWebpackPlugin = htmlWebpackPlugin;
|
|
12
|
+
this.name = 'bottom-template';
|
|
13
|
+
}
|
|
14
|
+
_createClass(BottomTemplatePlugin, [{
|
|
15
|
+
key: "apply",
|
|
16
|
+
value: function apply(compiler) {
|
|
17
|
+
var _this = this;
|
|
18
|
+
compiler.hooks.compilation.tap(this.name, function (compilation) {
|
|
19
|
+
_this.htmlWebpackPlugin.getHooks(compilation).beforeEmit.tap(_this.name, function (data) {
|
|
20
|
+
var _data$plugin$options;
|
|
21
|
+
if (!((_data$plugin$options = data.plugin.options) !== null && _data$plugin$options !== void 0 && _data$plugin$options.__internal__)) {
|
|
22
|
+
return data;
|
|
23
|
+
}
|
|
24
|
+
// 含有 <!--<?- bottomTemplate ?>--> 占位符时才需要注入 bottom.html
|
|
25
|
+
if (_this.bottomTemplateReg.test(data.html)) {
|
|
26
|
+
// 清空占位符
|
|
27
|
+
data.html = data.html.replace(_this.bottomTemplateReg, '');
|
|
28
|
+
var bottomTemplate = data.plugin.options.bottomTemplate;
|
|
29
|
+
if (bottomTemplate) {
|
|
30
|
+
data.html = data.html.replace(_this.bodyRegExp, function (match) {
|
|
31
|
+
return "\n".concat(bottomTemplate, "\n").concat(match);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return data;
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
}]);
|
|
40
|
+
return BottomTemplatePlugin;
|
|
41
|
+
}();
|