webpack-plugin-spire.officejs-ve 1.0.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/README.md +49 -0
- package/lib/index.d.ts +48 -0
- package/lib/index.js +827 -0
- package/lib/index.min.js +1 -0
- package/package.json +17 -0
package/README.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# webpack-plugin-spire.officejs
|
|
2
|
+
|
|
3
|
+
The webpack plugin is one of the plug-ins for Spire.OfficeJS to work
|
|
4
|
+
|
|
5
|
+
# Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install webpack-plugin-spire.officejs
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
# usage
|
|
12
|
+
|
|
13
|
+
```js
|
|
14
|
+
// vue.config.js
|
|
15
|
+
const { defineConfig } = require('@vue/cli-service')
|
|
16
|
+
const webpack_plugin = require('webpack-plugin-spire.officejs')
|
|
17
|
+
|
|
18
|
+
// define Config
|
|
19
|
+
module.exports = defineConfig({
|
|
20
|
+
configureWebpack: config => {
|
|
21
|
+
config.plugins = config.plugins || []
|
|
22
|
+
config.plugins.push(new webpack_plugin())
|
|
23
|
+
return config
|
|
24
|
+
}
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
// Config With parameters
|
|
28
|
+
module.exports = defineConfig({
|
|
29
|
+
configureWebpack: config => {
|
|
30
|
+
config.plugins = config.plugins || []
|
|
31
|
+
config.plugins.push(
|
|
32
|
+
new webpack_plugin({
|
|
33
|
+
port: 7000,
|
|
34
|
+
name: 'webpack-plugin-spire.officejs',
|
|
35
|
+
coAuthor: false
|
|
36
|
+
})
|
|
37
|
+
)
|
|
38
|
+
return config
|
|
39
|
+
}
|
|
40
|
+
})
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
# Parameters
|
|
44
|
+
|
|
45
|
+
| Properties | Explanation | Type | Default |
|
|
46
|
+
| ---------- | ------------------------------ | --------- | --------------------------------- |
|
|
47
|
+
| port | server port | `number` | 7000 |
|
|
48
|
+
| name | server name | `string` | `'webpack-plugin-spire.officejs'` |
|
|
49
|
+
| coAuthor | Enable the co-authoring server | `boolean` | `false` |
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Compiler } from 'webpack';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Mapping configuration for web static resources.
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export declare interface Mapping {
|
|
8
|
+
package: string
|
|
9
|
+
route: string
|
|
10
|
+
name: string
|
|
11
|
+
build: string
|
|
12
|
+
identify: string
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Options for the SpireOfficeJsWebpackPlugin.
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
19
|
+
export declare interface PluginOptions {
|
|
20
|
+
port?: number
|
|
21
|
+
name?: string
|
|
22
|
+
coAuthor?: Boolean
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Mapping configuration for service resources.
|
|
27
|
+
* @public
|
|
28
|
+
*/
|
|
29
|
+
export declare interface ServiceMapping {
|
|
30
|
+
package: string
|
|
31
|
+
path: string
|
|
32
|
+
name: string
|
|
33
|
+
platform: string
|
|
34
|
+
build: string
|
|
35
|
+
identify: string
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Webpack plugin for Spire.OfficeJS static resources.
|
|
40
|
+
* @public
|
|
41
|
+
*/
|
|
42
|
+
declare class SpireOfficeJsWebpackPlugin {
|
|
43
|
+
constructor(options?: PluginOptions);
|
|
44
|
+
apply(compiler: Compiler): void;
|
|
45
|
+
}
|
|
46
|
+
export default SpireOfficeJsWebpackPlugin;
|
|
47
|
+
|
|
48
|
+
export { }
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,827 @@
|
|
|
1
|
+
(function webpackUniversalModuleDefinition(root, factory) {
|
|
2
|
+
if(typeof exports === 'object' && typeof module === 'object')
|
|
3
|
+
module.exports = factory();
|
|
4
|
+
else if(typeof define === 'function' && define.amd)
|
|
5
|
+
define([], factory);
|
|
6
|
+
else {
|
|
7
|
+
var a = factory();
|
|
8
|
+
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
|
|
9
|
+
}
|
|
10
|
+
})(this, () => {
|
|
11
|
+
return /******/ (() => { // webpackBootstrap
|
|
12
|
+
/******/ "use strict";
|
|
13
|
+
/******/ var __webpack_modules__ = ([
|
|
14
|
+
/* 0 */
|
|
15
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
19
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
20
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
21
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
22
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
23
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
24
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
28
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
29
|
+
};
|
|
30
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
31
|
+
const bundle_1 = __importDefault(__webpack_require__(1));
|
|
32
|
+
const initserver_1 = __webpack_require__(6);
|
|
33
|
+
const coAuthServer_1 = __webpack_require__(12);
|
|
34
|
+
const config_json_1 = __importDefault(__webpack_require__(14));
|
|
35
|
+
const mappings = config_json_1.default.web;
|
|
36
|
+
const serviceMapping = config_json_1.default.service;
|
|
37
|
+
class SpireOfficeJsWebpackPlugin {
|
|
38
|
+
constructor(options = {}) {
|
|
39
|
+
this.name = options.name || 'webpack-plugin-spire.officejs';
|
|
40
|
+
this.port = options.port || 7000;
|
|
41
|
+
this.coAuthor = options.coAuthor || false;
|
|
42
|
+
this.projectRoot = '';
|
|
43
|
+
}
|
|
44
|
+
apply(compiler) {
|
|
45
|
+
this.projectRoot = compiler.options.context || process.cwd();
|
|
46
|
+
compiler.hooks.done.tap(this.name, stats => {
|
|
47
|
+
if (stats.hasErrors())
|
|
48
|
+
return;
|
|
49
|
+
const mode = compiler.options.mode;
|
|
50
|
+
if (mode === 'production') {
|
|
51
|
+
this.setupBuildHook(compiler);
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
this.setupDevServer(compiler);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
setupDevServer(compiler) {
|
|
59
|
+
// 检测webpack版本(通过检查hooks API是否存在)
|
|
60
|
+
// 使用类型断言避免TypeScript错误
|
|
61
|
+
const compilerAny = compiler;
|
|
62
|
+
const isWebpack4OrAbove = typeof compilerAny.hooks !== 'undefined';
|
|
63
|
+
// 确保devServer配置存在
|
|
64
|
+
if (!compiler.options.devServer) {
|
|
65
|
+
compiler.options.devServer = {};
|
|
66
|
+
}
|
|
67
|
+
// 定义添加中间件的函数
|
|
68
|
+
const addSpireOfficeJsMiddleware = () => {
|
|
69
|
+
(0, initserver_1.createSpireOfficeJsMiddleware)(mappings, this.port, this.name);
|
|
70
|
+
};
|
|
71
|
+
if (isWebpack4OrAbove) {
|
|
72
|
+
// Webpack 4+ 使用hooks API
|
|
73
|
+
addSpireOfficeJsMiddleware();
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
// Webpack 3 或更早版本使用plugin API
|
|
77
|
+
addSpireOfficeJsMiddleware();
|
|
78
|
+
}
|
|
79
|
+
// 启动协同服务
|
|
80
|
+
if (this.coAuthor) {
|
|
81
|
+
(0, coAuthServer_1.developCoAuthServer)(compiler, this.projectRoot, serviceMapping, compiler.options);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
setupBuildHook(compiler) {
|
|
85
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
86
|
+
var _a;
|
|
87
|
+
const isDev = compiler.options.mode === 'development';
|
|
88
|
+
const outputPath = ((_a = compiler.options.output) === null || _a === void 0 ? void 0 : _a.path) || compiler.options.context || process.cwd();
|
|
89
|
+
const projectRoot = compiler.options.context || process.cwd();
|
|
90
|
+
// 获取webpack的resolver
|
|
91
|
+
const resolverFactory = compiler.resolverFactory;
|
|
92
|
+
let resolver = null;
|
|
93
|
+
if (resolverFactory) {
|
|
94
|
+
// 创建normal resolver
|
|
95
|
+
resolver = resolverFactory.get('normal', {
|
|
96
|
+
resolveToContext: false,
|
|
97
|
+
fileSystem: compiler.inputFileSystem
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
try {
|
|
101
|
+
yield (0, bundle_1.default)(outputPath, projectRoot, mappings, resolver
|
|
102
|
+
? (context, request, callback) => {
|
|
103
|
+
resolver.resolve({}, context, request, {}, (err, result) => {
|
|
104
|
+
callback(err, result);
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
: undefined);
|
|
108
|
+
// 生产环境:拷贝协同服务
|
|
109
|
+
if (this.coAuthor) {
|
|
110
|
+
yield (0, coAuthServer_1.bundleCoAuthServer)(outputPath, projectRoot, serviceMapping);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
catch (error) {
|
|
114
|
+
console.error(`[${this.name}] Failed to copy static resources:`, error);
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
exports["default"] = SpireOfficeJsWebpackPlugin;
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
/***/ }),
|
|
123
|
+
/* 1 */
|
|
124
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
128
|
+
if (k2 === undefined) k2 = k;
|
|
129
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
130
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
131
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
132
|
+
}
|
|
133
|
+
Object.defineProperty(o, k2, desc);
|
|
134
|
+
}) : (function(o, m, k, k2) {
|
|
135
|
+
if (k2 === undefined) k2 = k;
|
|
136
|
+
o[k2] = m[k];
|
|
137
|
+
}));
|
|
138
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
139
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
140
|
+
}) : function(o, v) {
|
|
141
|
+
o["default"] = v;
|
|
142
|
+
});
|
|
143
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
144
|
+
var ownKeys = function(o) {
|
|
145
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
146
|
+
var ar = [];
|
|
147
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
148
|
+
return ar;
|
|
149
|
+
};
|
|
150
|
+
return ownKeys(o);
|
|
151
|
+
};
|
|
152
|
+
return function (mod) {
|
|
153
|
+
if (mod && mod.__esModule) return mod;
|
|
154
|
+
var result = {};
|
|
155
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
156
|
+
__setModuleDefault(result, mod);
|
|
157
|
+
return result;
|
|
158
|
+
};
|
|
159
|
+
})();
|
|
160
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
161
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
162
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
163
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
164
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
165
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
166
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
167
|
+
});
|
|
168
|
+
};
|
|
169
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
170
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
171
|
+
};
|
|
172
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
173
|
+
const path_1 = __importDefault(__webpack_require__(2));
|
|
174
|
+
const copyFile_1 = __webpack_require__(3);
|
|
175
|
+
const excludesFile_copy = [
|
|
176
|
+
'README.md',
|
|
177
|
+
'package.json',
|
|
178
|
+
'index.js',
|
|
179
|
+
'index.d.ts',
|
|
180
|
+
'**/SpireCloudEditor.module.js'
|
|
181
|
+
];
|
|
182
|
+
const initBundle = (outputPath, projectRoot, mappings, resolver) => __awaiter(void 0, void 0, void 0, function* () {
|
|
183
|
+
const targetStaticPrefix = 'spire.officejs/web';
|
|
184
|
+
try {
|
|
185
|
+
// 如果没有提供resolver,使用默认的Node.js模块解析
|
|
186
|
+
const resolvePackage = resolver
|
|
187
|
+
? (packageName) => {
|
|
188
|
+
return new Promise((resolve, reject) => {
|
|
189
|
+
resolver(projectRoot, `${packageName}/package.json`, (err, result) => {
|
|
190
|
+
if (err || !result) {
|
|
191
|
+
reject(err || new Error(`Cannot resolve package: ${packageName}`));
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
resolve(result);
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
: (packageName) => __awaiter(void 0, void 0, void 0, function* () {
|
|
200
|
+
// 动态解析包的真实路径
|
|
201
|
+
const createRequire = (yield Promise.resolve().then(() => __importStar(__webpack_require__(5)))).createRequire;
|
|
202
|
+
const requireFunc = createRequire(projectRoot + '/node_modules/');
|
|
203
|
+
return requireFunc.resolve(`${packageName}/package.json`);
|
|
204
|
+
});
|
|
205
|
+
for (const mapping of mappings) {
|
|
206
|
+
const { package: packageName, build } = mapping;
|
|
207
|
+
const buildDir = targetStaticPrefix;
|
|
208
|
+
const packagePath = '/web';
|
|
209
|
+
try {
|
|
210
|
+
// 解析包路径
|
|
211
|
+
const packageJsonPath = yield resolvePackage(packageName);
|
|
212
|
+
const packageRoot = path_1.default.dirname(packageJsonPath) + packagePath;
|
|
213
|
+
const targetStaticDir = path_1.default.join(outputPath, buildDir);
|
|
214
|
+
// 执行复制
|
|
215
|
+
console.log(`copying ${packageName} ......`);
|
|
216
|
+
yield (0, copyFile_1.copyFile)(packageRoot, targetStaticDir, excludesFile_copy);
|
|
217
|
+
}
|
|
218
|
+
catch (error) {
|
|
219
|
+
console.error(`❌ Failed to copy ${packageName}:`, error);
|
|
220
|
+
throw error;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
console.log(`✅ successfully copied to: ${targetStaticPrefix}`);
|
|
224
|
+
}
|
|
225
|
+
catch (error) {
|
|
226
|
+
console.error('❌ Bundle initialization failed:', error);
|
|
227
|
+
throw error;
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
exports["default"] = initBundle;
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
/***/ }),
|
|
234
|
+
/* 2 */
|
|
235
|
+
/***/ ((module) => {
|
|
236
|
+
|
|
237
|
+
module.exports = require("path");
|
|
238
|
+
|
|
239
|
+
/***/ }),
|
|
240
|
+
/* 3 */
|
|
241
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
245
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
246
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
247
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
248
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
249
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
250
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
251
|
+
});
|
|
252
|
+
};
|
|
253
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
254
|
+
exports.copyFile = exports.copySingleFile = void 0;
|
|
255
|
+
const promises_1 = __webpack_require__(4);
|
|
256
|
+
const path_1 = __webpack_require__(2);
|
|
257
|
+
/**
|
|
258
|
+
* 复制单个文件
|
|
259
|
+
* @param src 源文件路径
|
|
260
|
+
* @param dest 目标文件路径
|
|
261
|
+
*/
|
|
262
|
+
const copySingleFile = (src, dest) => __awaiter(void 0, void 0, void 0, function* () {
|
|
263
|
+
// 确保目标目录存在
|
|
264
|
+
const destDir = (0, path_1.dirname)(dest);
|
|
265
|
+
yield (0, promises_1.mkdir)(destDir, { recursive: true });
|
|
266
|
+
// 复制文件
|
|
267
|
+
yield (0, promises_1.cp)(src, dest, { recursive: true });
|
|
268
|
+
});
|
|
269
|
+
exports.copySingleFile = copySingleFile;
|
|
270
|
+
const copyFile = (src, dest, excludes) => __awaiter(void 0, void 0, void 0, function* () {
|
|
271
|
+
const entries = yield (0, promises_1.readdir)(src, { withFileTypes: true });
|
|
272
|
+
yield (0, promises_1.mkdir)(dest, { recursive: true });
|
|
273
|
+
for (const entry of entries) {
|
|
274
|
+
const srcPath = (0, path_1.join)(src, entry.name);
|
|
275
|
+
const destPath = (0, path_1.join)(dest, entry.name);
|
|
276
|
+
const relativePath = (0, path_1.relative)(src, srcPath);
|
|
277
|
+
// 检查是否应该排除
|
|
278
|
+
const shouldExclude = excludes.some((pattern) => {
|
|
279
|
+
if (typeof pattern === 'string') {
|
|
280
|
+
return relativePath.includes(pattern) || entry.name === pattern;
|
|
281
|
+
}
|
|
282
|
+
if (pattern instanceof RegExp) {
|
|
283
|
+
return pattern.test(relativePath);
|
|
284
|
+
}
|
|
285
|
+
return false;
|
|
286
|
+
});
|
|
287
|
+
if (shouldExclude) {
|
|
288
|
+
continue;
|
|
289
|
+
}
|
|
290
|
+
if (entry.isDirectory()) {
|
|
291
|
+
yield (0, exports.copyFile)(srcPath, destPath, excludes);
|
|
292
|
+
}
|
|
293
|
+
else {
|
|
294
|
+
yield (0, promises_1.cp)(srcPath, destPath, { recursive: true });
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
});
|
|
298
|
+
exports.copyFile = copyFile;
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
/***/ }),
|
|
302
|
+
/* 4 */
|
|
303
|
+
/***/ ((module) => {
|
|
304
|
+
|
|
305
|
+
module.exports = require("fs/promises");
|
|
306
|
+
|
|
307
|
+
/***/ }),
|
|
308
|
+
/* 5 */
|
|
309
|
+
/***/ ((module) => {
|
|
310
|
+
|
|
311
|
+
module.exports = require("module");
|
|
312
|
+
|
|
313
|
+
/***/ }),
|
|
314
|
+
/* 6 */
|
|
315
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
319
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
320
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
321
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
322
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
323
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
324
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
325
|
+
});
|
|
326
|
+
};
|
|
327
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
328
|
+
exports.createSpireOfficeJsMiddleware = void 0;
|
|
329
|
+
const node_http_1 = __webpack_require__(7);
|
|
330
|
+
const node_url_1 = __webpack_require__(8);
|
|
331
|
+
const node_path_1 = __webpack_require__(9);
|
|
332
|
+
const promises_1 = __webpack_require__(10);
|
|
333
|
+
const node_fs_1 = __webpack_require__(11);
|
|
334
|
+
let server;
|
|
335
|
+
const creat = (mappings) => {
|
|
336
|
+
server = (0, node_http_1.createServer)((req, res) => __awaiter(void 0, void 0, void 0, function* () {
|
|
337
|
+
var _a;
|
|
338
|
+
// 1. 使用 URL 模块解析请求的完整URL(需要提供基础URL,这里用本机地址即可)
|
|
339
|
+
const parsedUrl = new URL(req.url, `http://${req.headers.host}`);
|
|
340
|
+
// 2. 获取不包含查询参数的纯净路径名
|
|
341
|
+
const requestPathname = parsedUrl.pathname;
|
|
342
|
+
// 3. 后续逻辑使用 requestPathname 代替之前的 req.url
|
|
343
|
+
let mapping = {};
|
|
344
|
+
// 区分pdf与word的wasm文件
|
|
345
|
+
if (requestPathname.includes('Spire.Pdf.Base')) {
|
|
346
|
+
mapping = mappings.find(m => m.name == 'pdf');
|
|
347
|
+
}
|
|
348
|
+
else {
|
|
349
|
+
mapping = mappings.find(m => requestPathname.includes(m.route));
|
|
350
|
+
}
|
|
351
|
+
if (!mapping) {
|
|
352
|
+
res.writeHead(404, { 'Content-Type': 'text/plain' });
|
|
353
|
+
res.end('Resource not found');
|
|
354
|
+
return;
|
|
355
|
+
}
|
|
356
|
+
// 允许跨域
|
|
357
|
+
res.setHeader('Access-Control-Allow-Origin', '*'); // 允许所有域名
|
|
358
|
+
try {
|
|
359
|
+
// 2. 动态解析npm包的路径 (核心步骤)
|
|
360
|
+
let packagePath = (0, node_path_1.resolve)(process.cwd(), 'node_modules', mapping.package);
|
|
361
|
+
// }
|
|
362
|
+
if (!packagePath.startsWith('file://')) {
|
|
363
|
+
// 如果是本地文件路径,需要先转换为 file:// URL
|
|
364
|
+
if (packagePath.startsWith('/') || packagePath.match(/^[A-Za-z]:/)) {
|
|
365
|
+
packagePath =
|
|
366
|
+
'file://' + (packagePath.startsWith('/') ? '' : '/') + packagePath;
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
// 3. 使用纯净的路径名来拼接文件路径
|
|
370
|
+
const localPackagePath = (0, node_url_1.fileURLToPath)(packagePath);
|
|
371
|
+
const relativePath = requestPathname.replace(mapping.route, '') || '/index.html';
|
|
372
|
+
const fullPath = (0, node_path_1.join)(localPackagePath, requestPathname);
|
|
373
|
+
// 4. 检查文件是否存在并读取
|
|
374
|
+
yield (0, promises_1.access)(fullPath); // 检查文件可访问性
|
|
375
|
+
const stat = (0, node_fs_1.statSync)(fullPath);
|
|
376
|
+
// 设置合适的Content-Type (可根据扩展名细化)
|
|
377
|
+
const ext = (_a = fullPath.split('.').pop()) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
|
378
|
+
const mimeTypes = {
|
|
379
|
+
html: 'text/html',
|
|
380
|
+
js: 'application/javascript',
|
|
381
|
+
css: 'text/css',
|
|
382
|
+
json: 'application/json',
|
|
383
|
+
png: 'image/png',
|
|
384
|
+
jpg: 'image/jpeg',
|
|
385
|
+
svg: 'image/svg+xml',
|
|
386
|
+
wasm: 'application/wasm'
|
|
387
|
+
};
|
|
388
|
+
res.writeHead(200, {
|
|
389
|
+
'Content-Type': (ext && mimeTypes[ext]) ||
|
|
390
|
+
'application/octet-stream',
|
|
391
|
+
'Content-Length': stat.size
|
|
392
|
+
});
|
|
393
|
+
// 5. 创建文件流并返回
|
|
394
|
+
const stream = (0, node_fs_1.createReadStream)(fullPath);
|
|
395
|
+
stream.pipe(res);
|
|
396
|
+
stream.on('error', err => {
|
|
397
|
+
console.error(`Stream error for ${fullPath}:`, err);
|
|
398
|
+
res.writeHead(500);
|
|
399
|
+
res.end('Internal server error');
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
catch (error) {
|
|
403
|
+
// 文件不存在或其他错误
|
|
404
|
+
if (error.code === 'ENOENT') {
|
|
405
|
+
res.writeHead(404, { 'Content-Type': 'text/plain' });
|
|
406
|
+
res.end(`File not found: ${req.url}`);
|
|
407
|
+
}
|
|
408
|
+
else {
|
|
409
|
+
console.error(`Error serving ${req.url}:`, error);
|
|
410
|
+
res.writeHead(500);
|
|
411
|
+
res.end('Internal server error');
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
}));
|
|
415
|
+
};
|
|
416
|
+
const open = (mappings, port, name) => {
|
|
417
|
+
server.listen(port, () => {
|
|
418
|
+
console.log(`📦 [${name}] The Spire.OfficeJS static resource service has been started.`);
|
|
419
|
+
console.log(` - Service address: http://localhost:${port}`);
|
|
420
|
+
mappings.forEach(m => {
|
|
421
|
+
console.log(` - Mapping ${m.package}${m.path} -> http://localhost:${port}${m.route}`);
|
|
422
|
+
});
|
|
423
|
+
});
|
|
424
|
+
};
|
|
425
|
+
const close = () => {
|
|
426
|
+
if (server)
|
|
427
|
+
server.close();
|
|
428
|
+
};
|
|
429
|
+
const createSpireOfficeJsMiddleware = (mappings, port, name) => {
|
|
430
|
+
close();
|
|
431
|
+
creat(mappings);
|
|
432
|
+
open(mappings, port, name);
|
|
433
|
+
};
|
|
434
|
+
exports.createSpireOfficeJsMiddleware = createSpireOfficeJsMiddleware;
|
|
435
|
+
|
|
436
|
+
|
|
437
|
+
/***/ }),
|
|
438
|
+
/* 7 */
|
|
439
|
+
/***/ ((module) => {
|
|
440
|
+
|
|
441
|
+
module.exports = require("node:http");
|
|
442
|
+
|
|
443
|
+
/***/ }),
|
|
444
|
+
/* 8 */
|
|
445
|
+
/***/ ((module) => {
|
|
446
|
+
|
|
447
|
+
module.exports = require("node:url");
|
|
448
|
+
|
|
449
|
+
/***/ }),
|
|
450
|
+
/* 9 */
|
|
451
|
+
/***/ ((module) => {
|
|
452
|
+
|
|
453
|
+
module.exports = require("node:path");
|
|
454
|
+
|
|
455
|
+
/***/ }),
|
|
456
|
+
/* 10 */
|
|
457
|
+
/***/ ((module) => {
|
|
458
|
+
|
|
459
|
+
module.exports = require("node:fs/promises");
|
|
460
|
+
|
|
461
|
+
/***/ }),
|
|
462
|
+
/* 11 */
|
|
463
|
+
/***/ ((module) => {
|
|
464
|
+
|
|
465
|
+
module.exports = require("node:fs");
|
|
466
|
+
|
|
467
|
+
/***/ }),
|
|
468
|
+
/* 12 */
|
|
469
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
470
|
+
|
|
471
|
+
|
|
472
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
473
|
+
if (k2 === undefined) k2 = k;
|
|
474
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
475
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
476
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
477
|
+
}
|
|
478
|
+
Object.defineProperty(o, k2, desc);
|
|
479
|
+
}) : (function(o, m, k, k2) {
|
|
480
|
+
if (k2 === undefined) k2 = k;
|
|
481
|
+
o[k2] = m[k];
|
|
482
|
+
}));
|
|
483
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
484
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
485
|
+
}) : function(o, v) {
|
|
486
|
+
o["default"] = v;
|
|
487
|
+
});
|
|
488
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
489
|
+
var ownKeys = function(o) {
|
|
490
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
491
|
+
var ar = [];
|
|
492
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
493
|
+
return ar;
|
|
494
|
+
};
|
|
495
|
+
return ownKeys(o);
|
|
496
|
+
};
|
|
497
|
+
return function (mod) {
|
|
498
|
+
if (mod && mod.__esModule) return mod;
|
|
499
|
+
var result = {};
|
|
500
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
501
|
+
__setModuleDefault(result, mod);
|
|
502
|
+
return result;
|
|
503
|
+
};
|
|
504
|
+
})();
|
|
505
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
506
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
507
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
508
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
509
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
510
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
511
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
512
|
+
});
|
|
513
|
+
};
|
|
514
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
515
|
+
exports.bundleCoAuthServer = exports.developCoAuthServer = void 0;
|
|
516
|
+
const node_path_1 = __webpack_require__(9);
|
|
517
|
+
const node_child_process_1 = __webpack_require__(13);
|
|
518
|
+
const copyFile_1 = __webpack_require__(3);
|
|
519
|
+
const node_fs_1 = __webpack_require__(11);
|
|
520
|
+
const promises_1 = __webpack_require__(10);
|
|
521
|
+
const targetStaticPrfix = 'spire.officejs/service'; // bundle目标目录
|
|
522
|
+
const devConfigName = 'spire.officejs-server-config.json';
|
|
523
|
+
const prodConfigDir = 'OfficeServer/config/';
|
|
524
|
+
const prodConfigName = 'default.json';
|
|
525
|
+
const platformProps = {
|
|
526
|
+
windows: 'win32',
|
|
527
|
+
linux: 'linux',
|
|
528
|
+
arm: 'arm'
|
|
529
|
+
};
|
|
530
|
+
const defaultPlatform = 'win32';
|
|
531
|
+
let serverProcess = null;
|
|
532
|
+
let packagePath;
|
|
533
|
+
let ExeFileRootDir, ExeFileDir, ExeFileDirName, ExeFileName, ExeFilePath;
|
|
534
|
+
const startServer = (root, mappings, options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
535
|
+
var _a, _b;
|
|
536
|
+
// 重启时,先停止旧的服务进程(等待其完全退出后再启动新的)
|
|
537
|
+
yield stopServer();
|
|
538
|
+
const mapping = getMapping(mappings);
|
|
539
|
+
try {
|
|
540
|
+
// 使用 createRequire 解析包路径(CommonJS 兼容)
|
|
541
|
+
const createRequire = (yield Promise.resolve().then(() => __importStar(__webpack_require__(5)))).createRequire;
|
|
542
|
+
const requireFunc = createRequire(root + '/node_modules/');
|
|
543
|
+
try {
|
|
544
|
+
const packageMain = requireFunc.resolve(`${mapping.package}/package.json`);
|
|
545
|
+
packagePath = (0, node_path_1.dirname)(packageMain);
|
|
546
|
+
}
|
|
547
|
+
catch (resolveErr) {
|
|
548
|
+
// 回退到从 node_modules 拼接路径
|
|
549
|
+
packagePath = (0, node_path_1.resolve)(process.cwd(), 'node_modules', mapping.package);
|
|
550
|
+
}
|
|
551
|
+
const localPackagePath = packagePath;
|
|
552
|
+
const configPath = (0, node_path_1.resolve)(root, devConfigName);
|
|
553
|
+
const platform = getSystemPlatform();
|
|
554
|
+
if (platform != platformProps.windows) {
|
|
555
|
+
ExeFileDirName = 'OfficeServer';
|
|
556
|
+
ExeFileName = 'officeserver-linux';
|
|
557
|
+
}
|
|
558
|
+
else {
|
|
559
|
+
ExeFileDirName = 'OfficeServer';
|
|
560
|
+
ExeFileName = 'officeserver-win.exe';
|
|
561
|
+
}
|
|
562
|
+
ExeFileRootDir = localPackagePath + mapping.path;
|
|
563
|
+
ExeFileDir = (0, node_path_1.resolve)(ExeFileRootDir, ExeFileDirName);
|
|
564
|
+
ExeFilePath = (0, node_path_1.resolve)(ExeFileDir, ExeFileName);
|
|
565
|
+
// 服务启动之前,将config拷贝到指定目录
|
|
566
|
+
const NODE_CONFIG_DIR = yield applyConfigBeforeStartSerever(options, root, mapping);
|
|
567
|
+
// 修改执行权限
|
|
568
|
+
if (platform != platformProps.windows) {
|
|
569
|
+
try {
|
|
570
|
+
(0, node_fs_1.chmodSync)(ExeFilePath, 0o755); // 注意 Node.js 中八进制用 0o 前缀
|
|
571
|
+
}
|
|
572
|
+
catch (err) {
|
|
573
|
+
console.error(err);
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
// 启动服务器进程
|
|
577
|
+
serverProcess = (0, node_child_process_1.spawn)(ExeFilePath, [], {
|
|
578
|
+
stdio: 'pipe',
|
|
579
|
+
detached: false,
|
|
580
|
+
cwd: ExeFileDir,
|
|
581
|
+
env: Object.assign(Object.assign({}, process.env), { NODE_CONFIG_DIR: NODE_CONFIG_DIR })
|
|
582
|
+
});
|
|
583
|
+
console.log(`Officeserver started with PID: ${serverProcess.pid}`);
|
|
584
|
+
// 处理进程输出
|
|
585
|
+
(_a = serverProcess.stdout) === null || _a === void 0 ? void 0 : _a.on('data', data => {
|
|
586
|
+
console.log(`[officeserver] ${data.toString().trim()}`);
|
|
587
|
+
});
|
|
588
|
+
(_b = serverProcess.stderr) === null || _b === void 0 ? void 0 : _b.on('data', data => {
|
|
589
|
+
console.error(`[${mapping.package}] ${data.toString().trim()}`);
|
|
590
|
+
});
|
|
591
|
+
// 处理进程退出
|
|
592
|
+
serverProcess.on('close', code => {
|
|
593
|
+
console.log(`${mapping.package} process exited with code ${code}`);
|
|
594
|
+
serverProcess = null;
|
|
595
|
+
});
|
|
596
|
+
serverProcess.on('error', err => {
|
|
597
|
+
console.error('Failed to start ${mapping.package}:', err);
|
|
598
|
+
serverProcess = null;
|
|
599
|
+
});
|
|
600
|
+
}
|
|
601
|
+
catch (error) {
|
|
602
|
+
console.error(`${mapping.package} executable not found at ${ExeFilePath}:`, error);
|
|
603
|
+
}
|
|
604
|
+
});
|
|
605
|
+
const stopServer = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
606
|
+
if (serverProcess) {
|
|
607
|
+
const p = serverProcess;
|
|
608
|
+
serverProcess = null;
|
|
609
|
+
// Windows 上优先使用 taskkill 确保子进程树被完整清理
|
|
610
|
+
if (process.platform === 'win32') {
|
|
611
|
+
try {
|
|
612
|
+
const { execSync } = yield Promise.resolve().then(() => __importStar(__webpack_require__(13)));
|
|
613
|
+
execSync(`taskkill /pid ${p.pid} /T /F`, { stdio: 'ignore' });
|
|
614
|
+
}
|
|
615
|
+
catch (_a) {
|
|
616
|
+
// taskkill 失败时回退到 kill
|
|
617
|
+
try {
|
|
618
|
+
p.kill('SIGKILL');
|
|
619
|
+
}
|
|
620
|
+
catch (_b) { }
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
else {
|
|
624
|
+
p.kill('SIGTERM');
|
|
625
|
+
}
|
|
626
|
+
// 等待进程真正退出(最多 5 秒),然后强制结束
|
|
627
|
+
yield new Promise(resolve => {
|
|
628
|
+
const timeout = setTimeout(() => {
|
|
629
|
+
try {
|
|
630
|
+
p.kill('SIGKILL');
|
|
631
|
+
}
|
|
632
|
+
catch (_a) { }
|
|
633
|
+
resolve();
|
|
634
|
+
}, 5000);
|
|
635
|
+
p.on('close', () => {
|
|
636
|
+
clearTimeout(timeout);
|
|
637
|
+
resolve();
|
|
638
|
+
});
|
|
639
|
+
});
|
|
640
|
+
}
|
|
641
|
+
});
|
|
642
|
+
const getMapping = (mappings) => {
|
|
643
|
+
let platform = getSystemPlatform();
|
|
644
|
+
let mapping = mappings.filter(item => {
|
|
645
|
+
return item.platform == platform;
|
|
646
|
+
})[0];
|
|
647
|
+
if (!mapping) {
|
|
648
|
+
mapping = mappings.filter(item => {
|
|
649
|
+
return item.platform == defaultPlatform;
|
|
650
|
+
})[0];
|
|
651
|
+
}
|
|
652
|
+
return mapping;
|
|
653
|
+
};
|
|
654
|
+
const getSystemPlatform = () => {
|
|
655
|
+
let platform = process && process.platform;
|
|
656
|
+
let arch = getSystemArch();
|
|
657
|
+
// ARM环境下 platform 值依旧为linux,手动修改
|
|
658
|
+
if (platform == platformProps.linux && (arch === 'arm' || arch === 'arm64'))
|
|
659
|
+
platform = platformProps.arm;
|
|
660
|
+
return platform;
|
|
661
|
+
};
|
|
662
|
+
const getSystemArch = () => {
|
|
663
|
+
return process && process.arch;
|
|
664
|
+
};
|
|
665
|
+
const applyConfigBeforeStartSerever = (options, root, mapping) => __awaiter(void 0, void 0, void 0, function* () {
|
|
666
|
+
const platform = getSystemPlatform();
|
|
667
|
+
const sourceFile = (0, node_path_1.resolve)(root, devConfigName);
|
|
668
|
+
const packageName = mapping.package;
|
|
669
|
+
const packagePath = mapping.path;
|
|
670
|
+
const createRequire = yield Promise.resolve().then(() => __importStar(__webpack_require__(5))).then(m => m.createRequire);
|
|
671
|
+
const requireFunc = createRequire(root + '/node_modules/');
|
|
672
|
+
const packageJsonPath = requireFunc.resolve(`${packageName}/package.json`);
|
|
673
|
+
const packageRoot = (0, node_path_1.dirname)(packageJsonPath) + packagePath;
|
|
674
|
+
const targetDir = (0, node_path_1.resolve)(packageRoot, prodConfigDir);
|
|
675
|
+
const targetFile = (0, node_path_1.resolve)(targetDir, prodConfigName);
|
|
676
|
+
// 创建sqlite对应的目录
|
|
677
|
+
yield createSqlDirInDev(targetDir, sourceFile);
|
|
678
|
+
yield (0, copyFile_1.copySingleFile)(sourceFile, targetFile);
|
|
679
|
+
return targetDir;
|
|
680
|
+
});
|
|
681
|
+
const createSqlDirInDev = (targetDir, sourceFile) => __awaiter(void 0, void 0, void 0, function* () {
|
|
682
|
+
try {
|
|
683
|
+
const dbPath = (yield getConfigDbPath(sourceFile));
|
|
684
|
+
const absoluteDir = dbPath && (0, node_path_1.resolve)(targetDir, '..', dbPath);
|
|
685
|
+
if (absoluteDir && !(0, node_fs_1.existsSync)(absoluteDir)) {
|
|
686
|
+
(0, node_fs_1.mkdirSync)(absoluteDir, { recursive: true });
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
catch (error) {
|
|
690
|
+
console.error(error);
|
|
691
|
+
}
|
|
692
|
+
});
|
|
693
|
+
const createSqlDirInProd = (root) => __awaiter(void 0, void 0, void 0, function* () {
|
|
694
|
+
const configDir = (0, node_path_1.resolve)(root, targetStaticPrfix, prodConfigDir);
|
|
695
|
+
const configPath = (0, node_path_1.resolve)(configDir, prodConfigName);
|
|
696
|
+
const sqlDir = (yield getConfigDbPath(configPath));
|
|
697
|
+
const absoluteDir = sqlDir && (0, node_path_1.resolve)(configDir, '..', sqlDir);
|
|
698
|
+
try {
|
|
699
|
+
if (absoluteDir && !(0, node_fs_1.existsSync)(absoluteDir)) {
|
|
700
|
+
(0, node_fs_1.mkdirSync)(absoluteDir, { recursive: true });
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
catch (error) {
|
|
704
|
+
console.error(error);
|
|
705
|
+
}
|
|
706
|
+
});
|
|
707
|
+
const getConfigDbPath = (sourceFile) => __awaiter(void 0, void 0, void 0, function* () {
|
|
708
|
+
var _a, _b, _c;
|
|
709
|
+
if (!sourceFile)
|
|
710
|
+
return;
|
|
711
|
+
try {
|
|
712
|
+
yield (0, promises_1.access)(sourceFile, promises_1.constants.F_OK);
|
|
713
|
+
const configContent = (0, node_fs_1.readFileSync)(sourceFile, 'utf8');
|
|
714
|
+
const config = JSON.parse(configContent);
|
|
715
|
+
const dbPath = (_c = (_b = (_a = config.ServicesInformation) === null || _a === void 0 ? void 0 : _a.OfficeServer) === null || _b === void 0 ? void 0 : _b.sqlite3) === null || _c === void 0 ? void 0 : _c.path;
|
|
716
|
+
if (!dbPath) {
|
|
717
|
+
return;
|
|
718
|
+
}
|
|
719
|
+
const dir = (0, node_path_1.dirname)(dbPath);
|
|
720
|
+
return dir;
|
|
721
|
+
}
|
|
722
|
+
catch (error) {
|
|
723
|
+
console.error(error);
|
|
724
|
+
}
|
|
725
|
+
});
|
|
726
|
+
const developCoAuthServer = (compiler, root, serviceMapping, options) => {
|
|
727
|
+
// 启动服务器
|
|
728
|
+
startServer(root, serviceMapping, options);
|
|
729
|
+
// 注册进程退出时的清理逻辑(Webpack dev server 没有像 Vite 那样的 httpServer.close 事件)
|
|
730
|
+
const cleanup = () => {
|
|
731
|
+
stopServer();
|
|
732
|
+
};
|
|
733
|
+
// 监听进程退出信号
|
|
734
|
+
process.on('exit', cleanup);
|
|
735
|
+
process.on('SIGINT', cleanup);
|
|
736
|
+
process.on('SIGTERM', cleanup);
|
|
737
|
+
// 也可以通过 compiler.hooks.done 来追踪(但不作为主要清理方式)
|
|
738
|
+
// compiler.hooks.done 在每次编译完成时触发,不适合做一次性清理
|
|
739
|
+
};
|
|
740
|
+
exports.developCoAuthServer = developCoAuthServer;
|
|
741
|
+
const bundleCoAuthServer = (outputPath, projectRoot, mappings) => __awaiter(void 0, void 0, void 0, function* () {
|
|
742
|
+
try {
|
|
743
|
+
const mapping = getMapping(mappings);
|
|
744
|
+
const plateform = getSystemPlatform();
|
|
745
|
+
const bundleConfigDir = targetStaticPrfix + `/${prodConfigDir}`;
|
|
746
|
+
const bundleConfigFileName = bundleConfigDir + `/${prodConfigName}`;
|
|
747
|
+
const targetDir = (0, node_path_1.resolve)(outputPath, targetStaticPrfix);
|
|
748
|
+
const createRequire = yield Promise.resolve().then(() => __importStar(__webpack_require__(5))).then(m => m.createRequire);
|
|
749
|
+
const requireFunc = createRequire(projectRoot + '/node_modules/');
|
|
750
|
+
const configSourcetPath = (0, node_path_1.resolve)(projectRoot, devConfigName);
|
|
751
|
+
const configtargetPath = (0, node_path_1.resolve)(outputPath, bundleConfigFileName);
|
|
752
|
+
let packageName = mapping.package;
|
|
753
|
+
let packagePath = mapping.path;
|
|
754
|
+
let buildDir = targetStaticPrfix + mapping.build;
|
|
755
|
+
// 解析包路径
|
|
756
|
+
const packageJsonPath = requireFunc.resolve(`${packageName}/package.json`);
|
|
757
|
+
const packageRoot = (0, node_path_1.dirname)(packageJsonPath) + packagePath;
|
|
758
|
+
const targetStaticDir = (0, node_path_1.join)(outputPath, buildDir); // 目标目录
|
|
759
|
+
// 执行复制
|
|
760
|
+
console.log(`copying ${packageName} ......`);
|
|
761
|
+
yield (0, copyFile_1.copyFile)(packageRoot, targetStaticDir, ['logs', 'data']);
|
|
762
|
+
// 拷贝可执行程序
|
|
763
|
+
// await copyExecutableProgram(packageRoot, )
|
|
764
|
+
// 拷贝配置文件
|
|
765
|
+
yield (0, copyFile_1.copySingleFile)(configSourcetPath, configtargetPath);
|
|
766
|
+
// 创建sql文件夹
|
|
767
|
+
yield createSqlDirInProd(outputPath);
|
|
768
|
+
console.log(`✅ successfully copied to: ${targetDir}`);
|
|
769
|
+
}
|
|
770
|
+
catch (error) {
|
|
771
|
+
throw new Error(error);
|
|
772
|
+
}
|
|
773
|
+
});
|
|
774
|
+
exports.bundleCoAuthServer = bundleCoAuthServer;
|
|
775
|
+
|
|
776
|
+
|
|
777
|
+
/***/ }),
|
|
778
|
+
/* 13 */
|
|
779
|
+
/***/ ((module) => {
|
|
780
|
+
|
|
781
|
+
module.exports = require("node:child_process");
|
|
782
|
+
|
|
783
|
+
/***/ }),
|
|
784
|
+
/* 14 */
|
|
785
|
+
/***/ ((module) => {
|
|
786
|
+
|
|
787
|
+
module.exports = /*#__PURE__*/JSON.parse('{"web":[{"package":"spire.officejs-web-word-ve","route":"/service/spireword","name":"spireword","build":"/web/spireword","identify":"word"},{"package":"spire.officejs-web-excel-ve","route":"/service/spireexcel","name":"spireexcel","build":"/service/spireexcel","identify":"excel"},{"package":"spire.officejs-web-powerpoint-ve","route":"/service/spirepowerpoint","name":"spirepowerpoint","build":"/service/spirepowerpoint","identify":"ppt"},{"package":"spire.officejs-web-pdf-ve","route":"/service/spireword","name":"pdf","build":"/service/spireword","identify":"pdf"},{"package":"spire.officejs-web-common-ve","route":"/service/spirecommon","name":"spirecommon","build":"/service/spirecommon","identify":"spirecommon"},{"package":"spire.officejs-web-editors-ve","route":"/editors","name":"editors","build":"/editors","identify":"editors"},{"package":"spire.officejs-web-externs-ve","route":"/externs","name":"externs","build":"/externs","identify":"externs"},{"package":"spire.officejs-web-fontsweb-ve","route":"/fontsweb","name":"fontsweb","build":"/fontsweb","identify":"fontsweb"}],"service":[{"package":"spire.officejs-service-win-ve","path":"/lib","name":"service-windows","platform":"win32","build":"/","identify":"windows"},{"package":"spire.officejs-service-linux-ve","path":"/lib","name":"service-linux","platform":"linux","build":"/","identify":"linux"},{"package":"spire.officejs-service-arm-ve","path":"/lib","name":"service-arm","platform":"arm","build":"/","identify":"arm"}]}');
|
|
788
|
+
|
|
789
|
+
/***/ })
|
|
790
|
+
/******/ ]);
|
|
791
|
+
/************************************************************************/
|
|
792
|
+
/******/ // The module cache
|
|
793
|
+
/******/ const __webpack_module_cache__ = {};
|
|
794
|
+
/******/
|
|
795
|
+
/******/ // The require function
|
|
796
|
+
/******/ function __webpack_require__(moduleId) {
|
|
797
|
+
/******/ // Check if module is in cache
|
|
798
|
+
/******/ const cachedModule = __webpack_module_cache__[moduleId];
|
|
799
|
+
/******/ if (cachedModule !== undefined) {
|
|
800
|
+
/******/ return cachedModule.exports;
|
|
801
|
+
/******/ }
|
|
802
|
+
/******/ // Create a new module (and put it into the cache)
|
|
803
|
+
/******/ const module = __webpack_module_cache__[moduleId] = {
|
|
804
|
+
/******/ // no module.id needed
|
|
805
|
+
/******/ // no module.loaded needed
|
|
806
|
+
/******/ exports: {}
|
|
807
|
+
/******/ };
|
|
808
|
+
/******/
|
|
809
|
+
/******/ // Execute the module function
|
|
810
|
+
/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
811
|
+
/******/
|
|
812
|
+
/******/ // Return the exports of the module
|
|
813
|
+
/******/ return module.exports;
|
|
814
|
+
/******/ }
|
|
815
|
+
/******/
|
|
816
|
+
/************************************************************************/
|
|
817
|
+
/******/
|
|
818
|
+
/******/ // startup
|
|
819
|
+
/******/ // Load entry module and return exports
|
|
820
|
+
/******/ // This entry module is referenced by other modules so it can't be inlined
|
|
821
|
+
/******/ let __webpack_exports__ = __webpack_require__(0);
|
|
822
|
+
/******/ __webpack_exports__ = __webpack_exports__["default"];
|
|
823
|
+
/******/
|
|
824
|
+
/******/ return __webpack_exports__;
|
|
825
|
+
/******/ })()
|
|
826
|
+
;
|
|
827
|
+
});
|
package/lib/index.min.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(e,o){if("object"==typeof exports&&"object"==typeof module)module.exports=o();else if("function"==typeof define&&define.amd)define([],o);else{var t=o();for(var r in t)("object"==typeof exports?exports:e)[r]=t[r]}}(this,()=>(()=>{"use strict";var e=[function(e,o,t){var r=this&&this.__awaiter||function(e,o,t,r){return new(t||(t=Promise))(function(i,n){function s(e){try{a(r.next(e))}catch(e){n(e)}}function c(e){try{a(r.throw(e))}catch(e){n(e)}}function a(e){var o;e.done?i(e.value):(o=e.value,o instanceof t?o:new t(function(e){e(o)})).then(s,c)}a((r=r.apply(e,o||[])).next())})},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(o,"__esModule",{value:!0});const n=i(t(1)),s=t(6),c=t(12),a=i(t(14)),l=a.default.web,d=a.default.service;o.default=class{constructor(e={}){this.name=e.name||"webpack-plugin-spire.officejs",this.port=e.port||7e3,this.coAuthor=e.coAuthor||!1,this.projectRoot=""}apply(e){this.projectRoot=e.options.context||process.cwd(),e.hooks.done.tap(this.name,o=>{if(o.hasErrors())return;"production"===e.options.mode?this.setupBuildHook(e):this.setupDevServer(e)})}setupDevServer(e){e.hooks;e.options.devServer||(e.options.devServer={});const o=()=>{(0,s.createSpireOfficeJsMiddleware)(l,this.port,this.name)};o(),this.coAuthor&&(0,c.developCoAuthServer)(e,this.projectRoot,d,e.options)}setupBuildHook(e){return r(this,void 0,void 0,function*(){var o;e.options.mode;const t=(null===(o=e.options.output)||void 0===o?void 0:o.path)||e.options.context||process.cwd(),r=e.options.context||process.cwd(),i=e.resolverFactory;let s=null;i&&(s=i.get("normal",{resolveToContext:!1,fileSystem:e.inputFileSystem}));try{yield(0,n.default)(t,r,l,s?(e,o,t)=>{s.resolve({},e,o,{},(e,o)=>{t(e,o)})}:void 0),this.coAuthor&&(yield(0,c.bundleCoAuthServer)(t,r,d))}catch(e){console.error(`[${this.name}] Failed to copy static resources:`,e)}})}}},function(e,o,t){var r,i=this&&this.__createBinding||(Object.create?function(e,o,t,r){void 0===r&&(r=t);var i=Object.getOwnPropertyDescriptor(o,t);i&&!("get"in i?!o.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return o[t]}}),Object.defineProperty(e,r,i)}:function(e,o,t,r){void 0===r&&(r=t),e[r]=o[t]}),n=this&&this.__setModuleDefault||(Object.create?function(e,o){Object.defineProperty(e,"default",{enumerable:!0,value:o})}:function(e,o){e.default=o}),s=this&&this.__importStar||(r=function(e){return r=Object.getOwnPropertyNames||function(e){var o=[];for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(o[o.length]=t);return o},r(e)},function(e){if(e&&e.__esModule)return e;var o={};if(null!=e)for(var t=r(e),s=0;s<t.length;s++)"default"!==t[s]&&i(o,e,t[s]);return n(o,e),o}),c=this&&this.__awaiter||function(e,o,t,r){return new(t||(t=Promise))(function(i,n){function s(e){try{a(r.next(e))}catch(e){n(e)}}function c(e){try{a(r.throw(e))}catch(e){n(e)}}function a(e){var o;e.done?i(e.value):(o=e.value,o instanceof t?o:new t(function(e){e(o)})).then(s,c)}a((r=r.apply(e,o||[])).next())})},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(o,"__esModule",{value:!0});const l=a(t(2)),d=t(3),u=["README.md","package.json","index.js","index.d.ts","**/SpireCloudEditor.module.js"];o.default=(e,o,r,i)=>c(void 0,void 0,void 0,function*(){const n="spire.officejs/web";try{const a=i?e=>new Promise((t,r)=>{i(o,`${e}/package.json`,(o,i)=>{o||!i?r(o||new Error(`Cannot resolve package: ${e}`)):t(i)})}):e=>c(void 0,void 0,void 0,function*(){return(0,(yield Promise.resolve().then(()=>s(t(5)))).createRequire)(o+"/node_modules/").resolve(`${e}/package.json`)});for(const o of r){const{package:t,build:r}=o,i=n,s="/web";try{const o=yield a(t),r=l.default.dirname(o)+s,n=l.default.join(e,i);console.log(`copying ${t} ......`),yield(0,d.copyFile)(r,n,u)}catch(e){throw console.error(`❌ Failed to copy ${t}:`,e),e}}console.log(`✅ successfully copied to: ${n}`)}catch(e){throw console.error("❌ Bundle initialization failed:",e),e}})},e=>{e.exports=require("path")},function(e,o,t){var r=this&&this.__awaiter||function(e,o,t,r){return new(t||(t=Promise))(function(i,n){function s(e){try{a(r.next(e))}catch(e){n(e)}}function c(e){try{a(r.throw(e))}catch(e){n(e)}}function a(e){var o;e.done?i(e.value):(o=e.value,o instanceof t?o:new t(function(e){e(o)})).then(s,c)}a((r=r.apply(e,o||[])).next())})};Object.defineProperty(o,"__esModule",{value:!0}),o.copyFile=o.copySingleFile=void 0;const i=t(4),n=t(2);o.copySingleFile=(e,o)=>r(void 0,void 0,void 0,function*(){const t=(0,n.dirname)(o);yield(0,i.mkdir)(t,{recursive:!0}),yield(0,i.cp)(e,o,{recursive:!0})});o.copyFile=(e,t,s)=>r(void 0,void 0,void 0,function*(){const r=yield(0,i.readdir)(e,{withFileTypes:!0});yield(0,i.mkdir)(t,{recursive:!0});for(const c of r){const r=(0,n.join)(e,c.name),a=(0,n.join)(t,c.name),l=(0,n.relative)(e,r);s.some(e=>"string"==typeof e?l.includes(e)||c.name===e:e instanceof RegExp&&e.test(l))||(c.isDirectory()?yield(0,o.copyFile)(r,a,s):yield(0,i.cp)(r,a,{recursive:!0}))}})},e=>{e.exports=require("fs/promises")},e=>{e.exports=require("module")},function(e,o,t){var r=this&&this.__awaiter||function(e,o,t,r){return new(t||(t=Promise))(function(i,n){function s(e){try{a(r.next(e))}catch(e){n(e)}}function c(e){try{a(r.throw(e))}catch(e){n(e)}}function a(e){var o;e.done?i(e.value):(o=e.value,o instanceof t?o:new t(function(e){e(o)})).then(s,c)}a((r=r.apply(e,o||[])).next())})};Object.defineProperty(o,"__esModule",{value:!0}),o.createSpireOfficeJsMiddleware=void 0;const i=t(7),n=t(8),s=t(9),c=t(10),a=t(11);let l;o.createSpireOfficeJsMiddleware=(e,o,t)=>{l&&l.close(),(e=>{l=(0,i.createServer)((o,t)=>r(void 0,void 0,void 0,function*(){var r;const i=new URL(o.url,`http://${o.headers.host}`).pathname;let l={};if(l=i.includes("Spire.Pdf.Base")?e.find(e=>"pdf"==e.name):e.find(e=>i.includes(e.route)),!l)return t.writeHead(404,{"Content-Type":"text/plain"}),void t.end("Resource not found");t.setHeader("Access-Control-Allow-Origin","*");try{let e=(0,s.resolve)(process.cwd(),"node_modules",l.package);e.startsWith("file://")||(e.startsWith("/")||e.match(/^[A-Za-z]:/))&&(e="file://"+(e.startsWith("/")?"":"/")+e);const o=(0,n.fileURLToPath)(e),d=(i.replace(l.route,""),(0,s.join)(o,i));yield(0,c.access)(d);const u=(0,a.statSync)(d),p=null===(r=d.split(".").pop())||void 0===r?void 0:r.toLowerCase(),f={html:"text/html",js:"application/javascript",css:"text/css",json:"application/json",png:"image/png",jpg:"image/jpeg",svg:"image/svg+xml",wasm:"application/wasm"};t.writeHead(200,{"Content-Type":p&&f[p]||"application/octet-stream","Content-Length":u.size});const v=(0,a.createReadStream)(d);v.pipe(t),v.on("error",e=>{console.error(`Stream error for ${d}:`,e),t.writeHead(500),t.end("Internal server error")})}catch(e){"ENOENT"===e.code?(t.writeHead(404,{"Content-Type":"text/plain"}),t.end(`File not found: ${o.url}`)):(console.error(`Error serving ${o.url}:`,e),t.writeHead(500),t.end("Internal server error"))}}))})(e),((e,o,t)=>{l.listen(o,()=>{console.log(`📦 [${t}] The Spire.OfficeJS static resource service has been started.`),console.log(` - Service address: http://localhost:${o}`),e.forEach(e=>{console.log(` - Mapping ${e.package}${e.path} -> http://localhost:${o}${e.route}`)})})})(e,o,t)}},e=>{e.exports=require("node:http")},e=>{e.exports=require("node:url")},e=>{e.exports=require("node:path")},e=>{e.exports=require("node:fs/promises")},e=>{e.exports=require("node:fs")},function(e,o,t){var r,i=this&&this.__createBinding||(Object.create?function(e,o,t,r){void 0===r&&(r=t);var i=Object.getOwnPropertyDescriptor(o,t);i&&!("get"in i?!o.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return o[t]}}),Object.defineProperty(e,r,i)}:function(e,o,t,r){void 0===r&&(r=t),e[r]=o[t]}),n=this&&this.__setModuleDefault||(Object.create?function(e,o){Object.defineProperty(e,"default",{enumerable:!0,value:o})}:function(e,o){e.default=o}),s=this&&this.__importStar||(r=function(e){return r=Object.getOwnPropertyNames||function(e){var o=[];for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(o[o.length]=t);return o},r(e)},function(e){if(e&&e.__esModule)return e;var o={};if(null!=e)for(var t=r(e),s=0;s<t.length;s++)"default"!==t[s]&&i(o,e,t[s]);return n(o,e),o}),c=this&&this.__awaiter||function(e,o,t,r){return new(t||(t=Promise))(function(i,n){function s(e){try{a(r.next(e))}catch(e){n(e)}}function c(e){try{a(r.throw(e))}catch(e){n(e)}}function a(e){var o;e.done?i(e.value):(o=e.value,o instanceof t?o:new t(function(e){e(o)})).then(s,c)}a((r=r.apply(e,o||[])).next())})};Object.defineProperty(o,"__esModule",{value:!0}),o.bundleCoAuthServer=o.developCoAuthServer=void 0;const a=t(9),l=t(13),d=t(3),u=t(11),p=t(10),f="spire.officejs/service",v="spire.officejs-server-config.json",h="OfficeServer/config/",y="default.json",m="win32",w="linux",g="arm";let b,x,j,_,S,k,O=null;const $=()=>c(void 0,void 0,void 0,function*(){if(O){const e=O;if(O=null,"win32"===process.platform)try{const{execSync:o}=yield Promise.resolve().then(()=>s(t(13)));o(`taskkill /pid ${e.pid} /T /F`,{stdio:"ignore"})}catch(o){try{e.kill("SIGKILL")}catch(e){}}else e.kill("SIGTERM");yield new Promise(o=>{const t=setTimeout(()=>{try{e.kill("SIGKILL")}catch(e){}o()},5e3);e.on("close",()=>{clearTimeout(t),o()})})}}),P=e=>{let o=F(),t=e.filter(e=>e.platform==o)[0];return t||(t=e.filter(e=>"win32"==e.platform)[0]),t},F=()=>{let e=process&&process.platform,o=M();return e!=w||"arm"!==o&&"arm64"!==o||(e=g),e},M=()=>process&&process.arch,C=(e,o,r)=>c(void 0,void 0,void 0,function*(){F();const e=(0,a.resolve)(o,v),i=r.package,n=r.path,c=(yield Promise.resolve().then(()=>s(t(5))).then(e=>e.createRequire))(o+"/node_modules/").resolve(`${i}/package.json`),l=(0,a.dirname)(c)+n,u=(0,a.resolve)(l,h),p=(0,a.resolve)(u,y);return yield R(u,e),yield(0,d.copySingleFile)(e,p),u}),R=(e,o)=>c(void 0,void 0,void 0,function*(){try{const t=yield q(o),r=t&&(0,a.resolve)(e,"..",t);r&&!(0,u.existsSync)(r)&&(0,u.mkdirSync)(r,{recursive:!0})}catch(e){console.error(e)}}),q=e=>c(void 0,void 0,void 0,function*(){var o,t,r;if(e)try{yield(0,p.access)(e,p.constants.F_OK);const i=(0,u.readFileSync)(e,"utf8"),n=null===(r=null===(t=null===(o=JSON.parse(i).ServicesInformation)||void 0===o?void 0:o.OfficeServer)||void 0===t?void 0:t.sqlite3)||void 0===r?void 0:r.path;if(!n)return;return(0,a.dirname)(n)}catch(e){console.error(e)}});o.developCoAuthServer=(e,o,r,i)=>{((e,o,r)=>{c(void 0,void 0,void 0,function*(){var i,n;yield $();const c=P(o);try{const o=(0,(yield Promise.resolve().then(()=>s(t(5)))).createRequire)(e+"/node_modules/");try{const e=o.resolve(`${c.package}/package.json`);b=(0,a.dirname)(e)}catch(e){b=(0,a.resolve)(process.cwd(),"node_modules",c.package)}const d=b,p=((0,a.resolve)(e,v),F());p!=m?(_="OfficeServer",S="officeserver-linux"):(_="OfficeServer",S="officeserver-win.exe"),x=d+c.path,j=(0,a.resolve)(x,_),k=(0,a.resolve)(j,S);const f=yield C(r,e,c);if(p!=m)try{(0,u.chmodSync)(k,493)}catch(e){console.error(e)}O=(0,l.spawn)(k,[],{stdio:"pipe",detached:!1,cwd:j,env:Object.assign(Object.assign({},process.env),{NODE_CONFIG_DIR:f})}),console.log(`Officeserver started with PID: ${O.pid}`),null===(i=O.stdout)||void 0===i||i.on("data",e=>{console.log(`[officeserver] ${e.toString().trim()}`)}),null===(n=O.stderr)||void 0===n||n.on("data",e=>{console.error(`[${c.package}] ${e.toString().trim()}`)}),O.on("close",e=>{console.log(`${c.package} process exited with code ${e}`),O=null}),O.on("error",e=>{console.error("Failed to start ${mapping.package}:",e),O=null})}catch(e){console.error(`${c.package} executable not found at ${k}:`,e)}})})(o,r,i);const n=()=>{$()};process.on("exit",n),process.on("SIGINT",n),process.on("SIGTERM",n)};o.bundleCoAuthServer=(e,o,r)=>c(void 0,void 0,void 0,function*(){try{const n=P(r),l=(F(),f+`/${h}`+`/${y}`),p=(0,a.resolve)(e,f),m=(yield Promise.resolve().then(()=>s(t(5))).then(e=>e.createRequire))(o+"/node_modules/"),w=(0,a.resolve)(o,v),g=(0,a.resolve)(e,l);let b=n.package,x=n.path,j=f+n.build;const _=m.resolve(`${b}/package.json`),S=(0,a.dirname)(_)+x,k=(0,a.join)(e,j);console.log(`copying ${b} ......`),yield(0,d.copyFile)(S,k,["logs","data"]),yield(0,d.copySingleFile)(w,g),yield(i=e,c(void 0,void 0,void 0,function*(){const e=(0,a.resolve)(i,f,h),o=(0,a.resolve)(e,y),t=yield q(o),r=t&&(0,a.resolve)(e,"..",t);try{r&&!(0,u.existsSync)(r)&&(0,u.mkdirSync)(r,{recursive:!0})}catch(e){console.error(e)}})),console.log(`✅ successfully copied to: ${p}`)}catch(e){throw new Error(e)}var i})},e=>{e.exports=require("node:child_process")},e=>{e.exports=JSON.parse('{"web":[{"package":"spire.officejs-web-word-ve","route":"/service/spireword","name":"spireword","build":"/web/spireword","identify":"word"},{"package":"spire.officejs-web-excel-ve","route":"/service/spireexcel","name":"spireexcel","build":"/service/spireexcel","identify":"excel"},{"package":"spire.officejs-web-powerpoint-ve","route":"/service/spirepowerpoint","name":"spirepowerpoint","build":"/service/spirepowerpoint","identify":"ppt"},{"package":"spire.officejs-web-pdf-ve","route":"/service/spireword","name":"pdf","build":"/service/spireword","identify":"pdf"},{"package":"spire.officejs-web-common-ve","route":"/service/spirecommon","name":"spirecommon","build":"/service/spirecommon","identify":"spirecommon"},{"package":"spire.officejs-web-editors-ve","route":"/editors","name":"editors","build":"/editors","identify":"editors"},{"package":"spire.officejs-web-externs-ve","route":"/externs","name":"externs","build":"/externs","identify":"externs"},{"package":"spire.officejs-web-fontsweb-ve","route":"/fontsweb","name":"fontsweb","build":"/fontsweb","identify":"fontsweb"}],"service":[{"package":"spire.officejs-service-win-ve","path":"/lib","name":"service-windows","platform":"win32","build":"/","identify":"windows"},{"package":"spire.officejs-service-linux-ve","path":"/lib","name":"service-linux","platform":"linux","build":"/","identify":"linux"},{"package":"spire.officejs-service-arm-ve","path":"/lib","name":"service-arm","platform":"arm","build":"/","identify":"arm"}]}')}];const o={};let t=function t(r){const i=o[r];if(void 0!==i)return i.exports;const n=o[r]={exports:{}};return e[r].call(n.exports,n,n.exports,t),n.exports}(0);return t=t.default,t})());
|
package/package.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "webpack-plugin-spire.officejs-ve",
|
|
3
|
+
"version": "1.0.2",
|
|
4
|
+
"description": "Webpack plugin for spire.officejs static resources",
|
|
5
|
+
"main": "./lib/index.js",
|
|
6
|
+
"files": [
|
|
7
|
+
"lib"
|
|
8
|
+
],
|
|
9
|
+
"keywords": [
|
|
10
|
+
"webpack",
|
|
11
|
+
"spire.officejs"
|
|
12
|
+
],
|
|
13
|
+
"author": "",
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"type": "commonjs",
|
|
16
|
+
"types": "./lib/index.d.ts"
|
|
17
|
+
}
|