vite-plugin-spire.officejs-test 2.0.2 → 2.0.4

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/lib/index.d.ts ADDED
@@ -0,0 +1,32 @@
1
+ import type { Plugin as Plugin_2 } from 'vite';
2
+
3
+ export declare interface Bundle_Options {
4
+ dir: string
5
+ }
6
+
7
+ export declare interface PluginOptions {
8
+ port?: number
9
+ name?: string
10
+ coAuthor?: boolean
11
+ }
12
+
13
+ export declare interface ServiceMapping {
14
+ package: string
15
+ path: string
16
+ name: string
17
+ platform: string
18
+ build: string
19
+ }
20
+
21
+ declare function spireOfficeJsPlugin(options?: PluginOptions): Plugin_2
22
+ export default spireOfficeJsPlugin;
23
+
24
+ export declare interface WebMapping {
25
+ package: string
26
+ route: string
27
+ name: string
28
+ build: string
29
+ identify: string
30
+ }
31
+
32
+ export { }
package/lib/index.mjs CHANGED
@@ -6,7 +6,7 @@ import { access, constants } from "node:fs/promises";
6
6
  import { statSync, createReadStream, existsSync, mkdirSync, chmodSync, readFileSync } from "node:fs";
7
7
  import { readdir, mkdir, cp } from "fs/promises";
8
8
  import { spawn } from "node:child_process";
9
- const web = [{ "package": "spire.officejs-web-word", "path": "/spireword", "route": "/service/spireword", "name": "spireword", "build": "/service/spireword", "identify": "word" }, { "package": "spire.officejs-web-excel", "path": "/spireexcel", "route": "/service/spireexcel", "name": "spireexcel", "build": "/service/spireexcel", "identify": "excel" }, { "package": "spire.officejs-web-powerpoint", "path": "/spirepowerpoint", "route": "/service/spirepowerpoint", "name": "spirepowerpoint", "build": "/service/spirepowerpoint", "identify": "ppt" }, { "package": "spire.officejs-web-pdf", "path": "/spireword", "route": "/service/spireword", "name": "pdf", "build": "/service/spireword", "identify": "pdf" }, { "package": "spire.officejs-web-common", "path": "/lib", "route": "/service/spirecommon", "name": "spirecommon", "build": "/service/spirecommon", "identify": "spirecommon" }, { "package": "spire.officejs-web-editors", "path": "/lib", "route": "/editors", "name": "editors", "build": "/editors", "identify": "editors" }, { "package": "spire.officejs-web-externs", "path": "/lib", "route": "/externs", "name": "externs", "build": "/externs", "identify": "externs" }, { "package": "spire.officejs-web-fontsweb", "path": "/lib", "route": "/fontsweb", "name": "fontsweb", "build": "/fontsweb", "identify": "fontsweb" }];
9
+ const web = [{ "package": "spire.officejs-web-word-brook", "route": "/service/spireword", "name": "spireword", "build": "/service/spireword", "identify": "word" }, { "package": "spire.officejs-web-excel-brook", "route": "/service/spireexcel", "name": "spireexcel", "build": "/service/spireexcel", "identify": "excel" }, { "package": "spire.officejs-web-powerpoint-brook", "route": "/service/spirepowerpoint", "name": "spirepowerpoint", "build": "/service/spirepowerpoint", "identify": "ppt" }, { "package": "spire.officejs-web-pdf-brook", "route": "/service/spireword", "name": "pdf", "build": "/service/spireword", "identify": "pdf" }, { "package": "spire.officejs-web-common-brook", "route": "/service/spirecommon", "name": "spirecommon", "build": "/service/spirecommon", "identify": "spirecommon" }, { "package": "spire.officejs-web-editors-brook", "route": "/editors", "name": "editors", "build": "/editors", "identify": "editors" }, { "package": "spire.officejs-web-externs-brook", "route": "/externs", "name": "externs", "build": "/externs", "identify": "externs" }, { "package": "spire.officejs-web-fontsweb-brook", "route": "/fontsweb", "name": "fontsweb", "build": "/fontsweb", "identify": "fontsweb" }];
10
10
  const service = [{ "package": "spire.officejs-service-win-test", "path": "/lib", "name": "service-windows", "platform": "win32", "build": "/", "identify": "windows" }, { "package": "spire.officejs-service-linux-test", "path": "/lib", "name": "service-linux", "platform": "linux", "build": "/", "identify": "linux" }, { "package": "spire.officejs-service-arm-test", "path": "/lib", "name": "service-arm", "platform": "arm", "build": "/", "identify": "arm" }];
11
11
  const configJSon = {
12
12
  web,
@@ -29,7 +29,7 @@ const initServer = (viteServer, port, name) => {
29
29
  mapping = mappings$2.find((m) => m.name == "pdf");
30
30
  } else {
31
31
  mapping = mappings$2.find(
32
- (m) => requestPathname.startsWith(m.route)
32
+ (m) => requestPathname.includes(m.route)
33
33
  );
34
34
  }
35
35
  if (!mapping) {
@@ -55,7 +55,7 @@ const initServer = (viteServer, port, name) => {
55
55
  }
56
56
  const localPackagePath = fileURLToPath(packagePath2);
57
57
  const relativePath = requestPathname.replace(mapping.route, "") || "/index.html";
58
- const fullPath = join(localPackagePath, mapping.path, relativePath);
58
+ const fullPath = join(localPackagePath, requestPathname);
59
59
  await access(fullPath);
60
60
  const stat = statSync(fullPath);
61
61
  const ext = (_a2 = fullPath.split(".").pop()) == null ? void 0 : _a2.toLowerCase();
@@ -99,7 +99,7 @@ const initServer = (viteServer, port, name) => {
99
99
  console.log(` - Service address: http://localhost:${port}`);
100
100
  mappings$2.forEach((m) => {
101
101
  console.log(
102
- ` - Mapping ${m.package}${m.path} -> http://localhost:${port}${m.route}`
102
+ ` - Mapping ${m.package} -> http://localhost:${port}${m.route}`
103
103
  );
104
104
  });
105
105
  });
@@ -174,10 +174,9 @@ const initBundle = async (options, projectRoot) => {
174
174
  const requireFunc = createRequire(projectRoot + "/node_modules/");
175
175
  for (let i = 0; i < mappings$1.length; i++) {
176
176
  let packageName = mappings$1[i].package;
177
- let packagePath2 = mappings$1[i].path;
178
177
  let buildDir = targetStaticPrfix2 + mappings$1[i].build;
179
178
  const packageJsonPath = requireFunc.resolve(`${packageName}/package.json`);
180
- const packageRoot = path.dirname(packageJsonPath) + packagePath2;
179
+ const packageRoot = path.dirname(packageJsonPath);
181
180
  const targetStaticDir = path.join(buildOutDir, buildDir);
182
181
  console.log(`copying ${packageName} ......`);
183
182
  await copyFile(packageRoot, targetStaticDir, excludesFile_copy);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plugin-spire.officejs-test",
3
- "version": "2.0.2",
3
+ "version": "2.0.4",
4
4
  "description": "",
5
5
  "main": "./lib/index.mjs",
6
6
  "files": [
@@ -13,5 +13,5 @@
13
13
  "author": "",
14
14
  "license": "MIT",
15
15
  "type": "module",
16
- "types": "./lib/plugins.d.ts"
16
+ "types": "./lib/index.d.ts"
17
17
  }
package/lib/plugins.d.ts DELETED
@@ -1,29 +0,0 @@
1
- import type { Plugin as Plugin_2 } from 'vite';
2
-
3
- export declare interface PluginOptions {
4
- port?: number;
5
- name?: string;
6
- coAuthor?: boolean;
7
- }
8
-
9
- export declare interface ServiceMapping {
10
- package: string;
11
- path: string;
12
- name: string;
13
- platform: string;
14
- build: string;
15
- }
16
-
17
- declare function spireOfficeJsPlugin(options?: PluginOptions): Plugin_2;
18
- export default spireOfficeJsPlugin;
19
-
20
- export declare interface WebMapping {
21
- package: string;
22
- path: string;
23
- route: string;
24
- name: string;
25
- build: string;
26
- identify: string;
27
- }
28
-
29
- export { }