@arkxio/ark-dev-utils 0.1.1 → 0.1.3

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.
@@ -568,15 +568,21 @@
568
568
  return assetItem;
569
569
  }
570
570
 
571
+ // 注意:这个变量需要在每次编译时重置
572
+ // 不在这里维护,而是通过 options 传递
571
573
  let custScriptIdx = 0;
572
574
 
575
+ function resetScriptIdx() {
576
+ custScriptIdx = 0;
577
+ }
578
+
573
579
  /**
574
580
  * @param {HTMLScriptElement | HTMLStyleElement} childDom
575
581
  * @param {string} fileType
576
582
  * @param {IInnerFillAssetListOptions} options
577
583
  */
578
584
  async function writeInnerText(childDom, fileType, options) {
579
- const { homePage, buildDirFullPath } = options;
585
+ const { homePage, buildDirFullPath, compilation, customAssets = [] } = options;
580
586
  const innerText = getInnerText(childDom);
581
587
  if (!innerText) return '';
582
588
 
@@ -586,7 +592,24 @@
586
592
  const fileAbsolutePath = `${buildDirFullPath}/${scriptName}`;
587
593
  const fileWebPath = `${slash.noEnd(homePage)}/${scriptName}`;
588
594
 
589
- await writeFile(fileAbsolutePath, innerText);
595
+ // 在开发模式下,使用 compilation.emitAsset 确保文件能被 dev server 访问
596
+ if (compilation && compilation.emitAsset) {
597
+ const { sources } = compilation.compiler.webpack;
598
+ compilation.emitAsset(
599
+ scriptName,
600
+ new sources.RawSource(innerText)
601
+ );
602
+ verbose(`emit asset ${scriptName} via webpack compilation`);
603
+ } else {
604
+ // 生产模式或没有 compilation 对象时,直接写入文件系统
605
+ await writeFile(fileAbsolutePath, innerText);
606
+ }
607
+
608
+ // 将自定义资产信息保存到 customAssets 数组,供后续使用
609
+ if (customAssets) {
610
+ customAssets.push({ scriptName, fileWebPath, content: innerText });
611
+ }
612
+
590
613
  verbose(`write done, the web file will be ${fileWebPath} later`);
591
614
  return fileWebPath;
592
615
  }
@@ -965,11 +988,22 @@
965
988
  verbose('[begin] write memory ark meta ' + metaFilename);
966
989
 
967
990
  const metaContent = JSON.stringify(arkMeta, null, 2);
968
- // 写入 webpack 内存文件系统
969
- userExtractOptions.compilation.assets[metaFilename] = {
970
- source: () => metaContent,
971
- size: () => metaContent.length
972
- };
991
+ const compilation = userExtractOptions.compilation;
992
+
993
+ // Webpack 5 正确的 API:使用 emitAsset
994
+ if (compilation.emitAsset) {
995
+ const { sources } = compilation.compiler.webpack;
996
+ compilation.emitAsset(
997
+ metaFilename,
998
+ new sources.RawSource(metaContent)
999
+ );
1000
+ } else {
1001
+ // Webpack 4 兼容
1002
+ compilation.assets[metaFilename] = {
1003
+ source: () => metaContent,
1004
+ size: () => metaContent.length
1005
+ };
1006
+ }
973
1007
  verbose('[finish] write memory ark meta ' + metaFilename);
974
1008
  }else if (writeMetaJsonToDist) {
975
1009
  // 生产模式:写入物理文件
@@ -1119,8 +1153,8 @@
1119
1153
  '@arkxio/ark-micro-core': 'ArkMicroCore',
1120
1154
  '@arkxio/ark-lib-proxy': 'ArkLibProxy',
1121
1155
  '@arkxio/ark-micro': 'ArkMicro',
1122
- 'echarts': 'echarts',
1123
- 'tinymce': 'tinymce'
1156
+ // 'echarts': 'echarts',
1157
+ // 'tinymce': 'tinymce'
1124
1158
  // "loadjs": { //将vue依赖 "外部化",不打包进组件库
1125
1159
  // root: 'loadjs',
1126
1160
  // commonjs: 'loadjs',
@@ -1141,6 +1175,11 @@
1141
1175
  compiler.context;
1142
1176
  const useExtractOptions = this.metaOptions;
1143
1177
 
1178
+ // 在每次编译开始时重置脚本索引计数器,确保文件名一致性
1179
+ compiler.hooks.thisCompilation.tap('ArkResetScriptIdx', () => {
1180
+ resetScriptIdx();
1181
+ });
1182
+
1144
1183
  compiler.hooks.thisCompilation.tap('ArkDynamicCdnChunkLoaderPlugin', (compilation) => {
1145
1184
  compilation.hooks.processAssets.tap(
1146
1185
  {
@@ -1212,25 +1251,18 @@
1212
1251
  });
1213
1252
 
1214
1253
  compiler.hooks.emit.tapPromise('ArkMetaJsonGeneratorPlugin', async (compilation) => {
1215
- const assets = compilation.assets;
1216
- const outputPath = compilation.options.output.publicPath;
1217
- const jsFiles = [];
1218
- Object.keys(assets).forEach((assetName) => {
1219
- if (assetName.endsWith('.js')) {
1220
- console.log('Final JS file:', assetName);
1221
- if (assetName.indexOf('js/app.') !== -1) {
1222
- jsFiles.push(outputPath + assetName);
1223
- }
1224
- }
1225
- });
1226
-
1227
1254
  // 注入环境判断脚本
1228
1255
  const isDev = process.env.NODE_ENV === 'development';
1256
+
1257
+ // 创建 customAssets 数组用于收集自定义资产(如从 HTML 内联 script 提取的代码)
1258
+ const customAssets = [];
1259
+
1229
1260
  await extractArkMetaJson({
1230
1261
  ...useExtractOptions,
1231
- chunkJsFiles: jsFiles,
1262
+ // chunkJsFiles 将从 HTML 中的内联 script 提取,不需要在这里传递
1232
1263
  isDev: isDev,
1233
- compilation: compilation
1264
+ compilation: compilation,
1265
+ customAssets: customAssets
1234
1266
  });
1235
1267
 
1236
1268
  return Promise.resolve();
@@ -568,15 +568,21 @@
568
568
  return assetItem;
569
569
  }
570
570
 
571
+ // 注意:这个变量需要在每次编译时重置
572
+ // 不在这里维护,而是通过 options 传递
571
573
  let custScriptIdx = 0;
572
574
 
575
+ function resetScriptIdx() {
576
+ custScriptIdx = 0;
577
+ }
578
+
573
579
  /**
574
580
  * @param {HTMLScriptElement | HTMLStyleElement} childDom
575
581
  * @param {string} fileType
576
582
  * @param {IInnerFillAssetListOptions} options
577
583
  */
578
584
  async function writeInnerText(childDom, fileType, options) {
579
- const { homePage, buildDirFullPath } = options;
585
+ const { homePage, buildDirFullPath, compilation, customAssets = [] } = options;
580
586
  const innerText = getInnerText(childDom);
581
587
  if (!innerText) return '';
582
588
 
@@ -586,7 +592,24 @@
586
592
  const fileAbsolutePath = `${buildDirFullPath}/${scriptName}`;
587
593
  const fileWebPath = `${slash.noEnd(homePage)}/${scriptName}`;
588
594
 
589
- await writeFile(fileAbsolutePath, innerText);
595
+ // 在开发模式下,使用 compilation.emitAsset 确保文件能被 dev server 访问
596
+ if (compilation && compilation.emitAsset) {
597
+ const { sources } = compilation.compiler.webpack;
598
+ compilation.emitAsset(
599
+ scriptName,
600
+ new sources.RawSource(innerText)
601
+ );
602
+ verbose(`emit asset ${scriptName} via webpack compilation`);
603
+ } else {
604
+ // 生产模式或没有 compilation 对象时,直接写入文件系统
605
+ await writeFile(fileAbsolutePath, innerText);
606
+ }
607
+
608
+ // 将自定义资产信息保存到 customAssets 数组,供后续使用
609
+ if (customAssets) {
610
+ customAssets.push({ scriptName, fileWebPath, content: innerText });
611
+ }
612
+
590
613
  verbose(`write done, the web file will be ${fileWebPath} later`);
591
614
  return fileWebPath;
592
615
  }
@@ -965,11 +988,22 @@
965
988
  verbose('[begin] write memory ark meta ' + metaFilename);
966
989
 
967
990
  const metaContent = JSON.stringify(arkMeta, null, 2);
968
- // 写入 webpack 内存文件系统
969
- userExtractOptions.compilation.assets[metaFilename] = {
970
- source: () => metaContent,
971
- size: () => metaContent.length
972
- };
991
+ const compilation = userExtractOptions.compilation;
992
+
993
+ // Webpack 5 正确的 API:使用 emitAsset
994
+ if (compilation.emitAsset) {
995
+ const { sources } = compilation.compiler.webpack;
996
+ compilation.emitAsset(
997
+ metaFilename,
998
+ new sources.RawSource(metaContent)
999
+ );
1000
+ } else {
1001
+ // Webpack 4 兼容
1002
+ compilation.assets[metaFilename] = {
1003
+ source: () => metaContent,
1004
+ size: () => metaContent.length
1005
+ };
1006
+ }
973
1007
  verbose('[finish] write memory ark meta ' + metaFilename);
974
1008
  }else if (writeMetaJsonToDist) {
975
1009
  // 生产模式:写入物理文件
@@ -1119,8 +1153,8 @@
1119
1153
  '@arkxio/ark-micro-core': 'ArkMicroCore',
1120
1154
  '@arkxio/ark-lib-proxy': 'ArkLibProxy',
1121
1155
  '@arkxio/ark-micro': 'ArkMicro',
1122
- 'echarts': 'echarts',
1123
- 'tinymce': 'tinymce'
1156
+ // 'echarts': 'echarts',
1157
+ // 'tinymce': 'tinymce'
1124
1158
  // "loadjs": { //将vue依赖 "外部化",不打包进组件库
1125
1159
  // root: 'loadjs',
1126
1160
  // commonjs: 'loadjs',
@@ -1141,6 +1175,11 @@
1141
1175
  compiler.context;
1142
1176
  const useExtractOptions = this.metaOptions;
1143
1177
 
1178
+ // 在每次编译开始时重置脚本索引计数器,确保文件名一致性
1179
+ compiler.hooks.thisCompilation.tap('ArkResetScriptIdx', () => {
1180
+ resetScriptIdx();
1181
+ });
1182
+
1144
1183
  compiler.hooks.thisCompilation.tap('ArkDynamicCdnChunkLoaderPlugin', (compilation) => {
1145
1184
  compilation.hooks.processAssets.tap(
1146
1185
  {
@@ -1212,25 +1251,18 @@
1212
1251
  });
1213
1252
 
1214
1253
  compiler.hooks.emit.tapPromise('ArkMetaJsonGeneratorPlugin', async (compilation) => {
1215
- const assets = compilation.assets;
1216
- const outputPath = compilation.options.output.publicPath;
1217
- const jsFiles = [];
1218
- Object.keys(assets).forEach((assetName) => {
1219
- if (assetName.endsWith('.js')) {
1220
- console.log('Final JS file:', assetName);
1221
- if (assetName.indexOf('js/app.') !== -1) {
1222
- jsFiles.push(outputPath + assetName);
1223
- }
1224
- }
1225
- });
1226
-
1227
1254
  // 注入环境判断脚本
1228
1255
  const isDev = process.env.NODE_ENV === 'development';
1256
+
1257
+ // 创建 customAssets 数组用于收集自定义资产(如从 HTML 内联 script 提取的代码)
1258
+ const customAssets = [];
1259
+
1229
1260
  await extractArkMetaJson({
1230
1261
  ...useExtractOptions,
1231
- chunkJsFiles: jsFiles,
1262
+ // chunkJsFiles 将从 HTML 中的内联 script 提取,不需要在这里传递
1232
1263
  isDev: isDev,
1233
- compilation: compilation
1264
+ compilation: compilation,
1265
+ customAssets: customAssets
1234
1266
  });
1235
1267
 
1236
1268
  return Promise.resolve();
package/lib/index.js CHANGED
@@ -573,15 +573,21 @@ function buildAssetItem(tag, /** @type {IAssetInfo} */ assetInfo) {
573
573
  return assetItem;
574
574
  }
575
575
 
576
+ // 注意:这个变量需要在每次编译时重置
577
+ // 不在这里维护,而是通过 options 传递
576
578
  let custScriptIdx = 0;
577
579
 
580
+ function resetScriptIdx() {
581
+ custScriptIdx = 0;
582
+ }
583
+
578
584
  /**
579
585
  * @param {HTMLScriptElement | HTMLStyleElement} childDom
580
586
  * @param {string} fileType
581
587
  * @param {IInnerFillAssetListOptions} options
582
588
  */
583
589
  async function writeInnerText(childDom, fileType, options) {
584
- const { homePage, buildDirFullPath } = options;
590
+ const { homePage, buildDirFullPath, compilation, customAssets = [] } = options;
585
591
  const innerText = getInnerText(childDom);
586
592
  if (!innerText) return '';
587
593
 
@@ -591,7 +597,24 @@ async function writeInnerText(childDom, fileType, options) {
591
597
  const fileAbsolutePath = `${buildDirFullPath}/${scriptName}`;
592
598
  const fileWebPath = `${slash.noEnd(homePage)}/${scriptName}`;
593
599
 
594
- await writeFile(fileAbsolutePath, innerText);
600
+ // 在开发模式下,使用 compilation.emitAsset 确保文件能被 dev server 访问
601
+ if (compilation && compilation.emitAsset) {
602
+ const { sources } = compilation.compiler.webpack;
603
+ compilation.emitAsset(
604
+ scriptName,
605
+ new sources.RawSource(innerText)
606
+ );
607
+ verbose(`emit asset ${scriptName} via webpack compilation`);
608
+ } else {
609
+ // 生产模式或没有 compilation 对象时,直接写入文件系统
610
+ await writeFile(fileAbsolutePath, innerText);
611
+ }
612
+
613
+ // 将自定义资产信息保存到 customAssets 数组,供后续使用
614
+ if (customAssets) {
615
+ customAssets.push({ scriptName, fileWebPath, content: innerText });
616
+ }
617
+
595
618
  verbose(`write done, the web file will be ${fileWebPath} later`);
596
619
  return fileWebPath;
597
620
  }
@@ -970,11 +993,22 @@ async function extractArkMetaJson(userExtractOptions) {
970
993
  verbose('[begin] write memory ark meta ' + metaFilename);
971
994
 
972
995
  const metaContent = JSON.stringify(arkMeta, null, 2);
973
- // 写入 webpack 内存文件系统
974
- userExtractOptions.compilation.assets[metaFilename] = {
975
- source: () => metaContent,
976
- size: () => metaContent.length
977
- };
996
+ const compilation = userExtractOptions.compilation;
997
+
998
+ // Webpack 5 正确的 API:使用 emitAsset
999
+ if (compilation.emitAsset) {
1000
+ const { sources } = compilation.compiler.webpack;
1001
+ compilation.emitAsset(
1002
+ metaFilename,
1003
+ new sources.RawSource(metaContent)
1004
+ );
1005
+ } else {
1006
+ // Webpack 4 兼容
1007
+ compilation.assets[metaFilename] = {
1008
+ source: () => metaContent,
1009
+ size: () => metaContent.length
1010
+ };
1011
+ }
978
1012
  verbose('[finish] write memory ark meta ' + metaFilename);
979
1013
  }else if (writeMetaJsonToDist) {
980
1014
  // 生产模式:写入物理文件
@@ -1124,8 +1158,8 @@ var ExternalsDefault = {
1124
1158
  '@arkxio/ark-micro-core': 'ArkMicroCore',
1125
1159
  '@arkxio/ark-lib-proxy': 'ArkLibProxy',
1126
1160
  '@arkxio/ark-micro': 'ArkMicro',
1127
- 'echarts': 'echarts',
1128
- 'tinymce': 'tinymce'
1161
+ // 'echarts': 'echarts',
1162
+ // 'tinymce': 'tinymce'
1129
1163
  // "loadjs": { //将vue依赖 "外部化",不打包进组件库
1130
1164
  // root: 'loadjs',
1131
1165
  // commonjs: 'loadjs',
@@ -1146,6 +1180,11 @@ class ArkWebpackPlugin {
1146
1180
  compiler.context;
1147
1181
  const useExtractOptions = this.metaOptions;
1148
1182
 
1183
+ // 在每次编译开始时重置脚本索引计数器,确保文件名一致性
1184
+ compiler.hooks.thisCompilation.tap('ArkResetScriptIdx', () => {
1185
+ resetScriptIdx();
1186
+ });
1187
+
1149
1188
  compiler.hooks.thisCompilation.tap('ArkDynamicCdnChunkLoaderPlugin', (compilation) => {
1150
1189
  compilation.hooks.processAssets.tap(
1151
1190
  {
@@ -1217,25 +1256,18 @@ class ArkWebpackPlugin {
1217
1256
  });
1218
1257
 
1219
1258
  compiler.hooks.emit.tapPromise('ArkMetaJsonGeneratorPlugin', async (compilation) => {
1220
- const assets = compilation.assets;
1221
- const outputPath = compilation.options.output.publicPath;
1222
- const jsFiles = [];
1223
- Object.keys(assets).forEach((assetName) => {
1224
- if (assetName.endsWith('.js')) {
1225
- console.log('Final JS file:', assetName);
1226
- if (assetName.indexOf('js/app.') !== -1) {
1227
- jsFiles.push(outputPath + assetName);
1228
- }
1229
- }
1230
- });
1231
-
1232
1259
  // 注入环境判断脚本
1233
1260
  const isDev = process.env.NODE_ENV === 'development';
1261
+
1262
+ // 创建 customAssets 数组用于收集自定义资产(如从 HTML 内联 script 提取的代码)
1263
+ const customAssets = [];
1264
+
1234
1265
  await extractArkMetaJson({
1235
1266
  ...useExtractOptions,
1236
- chunkJsFiles: jsFiles,
1267
+ // chunkJsFiles 将从 HTML 中的内联 script 提取,不需要在这里传递
1237
1268
  isDev: isDev,
1238
- compilation: compilation
1269
+ compilation: compilation,
1270
+ customAssets: customAssets
1239
1271
  });
1240
1272
 
1241
1273
  return Promise.resolve();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arkxio/ark-dev-utils",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "ark dev utils",
5
5
  "repository": {
6
6
  "type": "git",
@@ -2,6 +2,7 @@ import path from "path";
2
2
  import extractArkMetaJson from './meta-extractor/index';
3
3
  import {verbose} from "./inner-utils";
4
4
  import { Compilation } from 'webpack';
5
+ import { resetScriptIdx } from './meta-extractor/fillAssetList';
5
6
 
6
7
  export default class ArkWebpackPlugin {
7
8
 
@@ -14,6 +15,11 @@ export default class ArkWebpackPlugin {
14
15
  const projectRoot = compiler.context;
15
16
  const useExtractOptions = this.metaOptions;
16
17
 
18
+ // 在每次编译开始时重置脚本索引计数器,确保文件名一致性
19
+ compiler.hooks.thisCompilation.tap('ArkResetScriptIdx', () => {
20
+ resetScriptIdx();
21
+ });
22
+
17
23
  compiler.hooks.thisCompilation.tap('ArkDynamicCdnChunkLoaderPlugin', (compilation) => {
18
24
  compilation.hooks.processAssets.tap(
19
25
  {
@@ -85,25 +91,18 @@ export default class ArkWebpackPlugin {
85
91
  });
86
92
 
87
93
  compiler.hooks.emit.tapPromise('ArkMetaJsonGeneratorPlugin', async (compilation) => {
88
- const assets = compilation.assets;
89
- const outputPath = compilation.options.output.publicPath;
90
- const jsFiles = []
91
- Object.keys(assets).forEach((assetName) => {
92
- if (assetName.endsWith('.js')) {
93
- console.log('Final JS file:', assetName);
94
- if (assetName.indexOf('js/app.') !== -1) {
95
- jsFiles.push(outputPath + assetName);
96
- }
97
- }
98
- });
99
-
100
94
  // 注入环境判断脚本
101
95
  const isDev = process.env.NODE_ENV === 'development';
96
+
97
+ // 创建 customAssets 数组用于收集自定义资产(如从 HTML 内联 script 提取的代码)
98
+ const customAssets = [];
99
+
102
100
  const arkMeta = await extractArkMetaJson({
103
101
  ...useExtractOptions,
104
- chunkJsFiles: jsFiles,
102
+ // chunkJsFiles 将从 HTML 中的内联 script 提取,不需要在这里传递
105
103
  isDev: isDev,
106
- compilation: compilation
104
+ compilation: compilation,
105
+ customAssets: customAssets
107
106
  });
108
107
 
109
108
  return Promise.resolve();
@@ -12,8 +12,8 @@ export default {
12
12
  '@arkxio/ark-micro-core': 'ArkMicroCore',
13
13
  '@arkxio/ark-lib-proxy': 'ArkLibProxy',
14
14
  '@arkxio/ark-micro': 'ArkMicro',
15
- 'echarts': 'echarts',
16
- 'tinymce': 'tinymce'
15
+ // 'echarts': 'echarts',
16
+ // 'tinymce': 'tinymce'
17
17
  // "loadjs": { //将vue依赖 "外部化",不打包进组件库
18
18
  // root: 'loadjs',
19
19
  // commonjs: 'loadjs',
@@ -64,15 +64,21 @@ function buildAssetItem(tag, /** @type {IAssetInfo} */ assetInfo) {
64
64
  return assetItem;
65
65
  }
66
66
 
67
+ // 注意:这个变量需要在每次编译时重置
68
+ // 不在这里维护,而是通过 options 传递
67
69
  let custScriptIdx = 0;
68
70
 
71
+ export function resetScriptIdx() {
72
+ custScriptIdx = 0;
73
+ }
74
+
69
75
  /**
70
76
  * @param {HTMLScriptElement | HTMLStyleElement} childDom
71
77
  * @param {string} fileType
72
78
  * @param {IInnerFillAssetListOptions} options
73
79
  */
74
80
  async function writeInnerText(childDom, fileType, options) {
75
- const { homePage, buildDirFullPath } = options;
81
+ const { homePage, buildDirFullPath, compilation, customAssets = [] } = options;
76
82
  const innerText = getInnerText(childDom);
77
83
  if (!innerText) return '';
78
84
 
@@ -82,7 +88,24 @@ async function writeInnerText(childDom, fileType, options) {
82
88
  const fileAbsolutePath = `${buildDirFullPath}/${scriptName}`;
83
89
  const fileWebPath = `${slash.noEnd(homePage)}/${scriptName}`;
84
90
 
85
- await writeFile(fileAbsolutePath, innerText);
91
+ // 在开发模式下,使用 compilation.emitAsset 确保文件能被 dev server 访问
92
+ if (compilation && compilation.emitAsset) {
93
+ const { sources } = compilation.compiler.webpack;
94
+ compilation.emitAsset(
95
+ scriptName,
96
+ new sources.RawSource(innerText)
97
+ );
98
+ verbose(`emit asset ${scriptName} via webpack compilation`);
99
+ } else {
100
+ // 生产模式或没有 compilation 对象时,直接写入文件系统
101
+ await writeFile(fileAbsolutePath, innerText);
102
+ }
103
+
104
+ // 将自定义资产信息保存到 customAssets 数组,供后续使用
105
+ if (customAssets) {
106
+ customAssets.push({ scriptName, fileWebPath, content: innerText });
107
+ }
108
+
86
109
  verbose(`write done, the web file will be ${fileWebPath} later`);
87
110
  return fileWebPath;
88
111
  }
@@ -56,11 +56,22 @@ export default async function extractArkMetaJson(userExtractOptions) {
56
56
  verbose('[begin] write memory ark meta ' + metaFilename)
57
57
 
58
58
  const metaContent = JSON.stringify(arkMeta, null, 2);
59
- // 写入 webpack 内存文件系统
60
- userExtractOptions.compilation.assets[metaFilename] = {
61
- source: () => metaContent,
62
- size: () => metaContent.length
63
- };
59
+ const compilation = userExtractOptions.compilation;
60
+
61
+ // Webpack 5 正确的 API:使用 emitAsset
62
+ if (compilation.emitAsset) {
63
+ const { sources } = compilation.compiler.webpack;
64
+ compilation.emitAsset(
65
+ metaFilename,
66
+ new sources.RawSource(metaContent)
67
+ );
68
+ } else {
69
+ // Webpack 4 兼容
70
+ compilation.assets[metaFilename] = {
71
+ source: () => metaContent,
72
+ size: () => metaContent.length
73
+ };
74
+ }
64
75
  verbose('[finish] write memory ark meta ' + metaFilename)
65
76
  }else if (writeMetaJsonToDist) {
66
77
  // 生产模式:写入物理文件
package/typings.d.ts CHANGED
@@ -235,6 +235,10 @@ export interface IInnerFillAssetListOptions {
235
235
  enableRelativePath: IUserExtractOptions['enableRelativePath'];
236
236
  enablePrefixHomePage: IUserExtractOptions['enablePrefixHomePage'];
237
237
  enableAssetInnerText: IUserExtractOptions['enableAssetInnerText'];
238
+ /** webpack compilation 对象,用于在开发模式下通过 emitAsset 输出文件 */
239
+ compilation?: any;
240
+ /** 自定义资产列表,用于收集从 HTML 内联脚本提取的代码 */
241
+ customAssets?: Array<{ scriptName: string; fileWebPath: string; content: string }>;
238
242
  }
239
243
 
240
244
  export interface ICreateSubAppOptions {