@file-viewer/vite-plugin 2.3.1 → 2.3.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/dist/index.js +46 -19
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -53,20 +53,26 @@ const rendererModules = [
|
|
|
53
53
|
id: 'presentation',
|
|
54
54
|
packageName: '@file-viewer/renderer-presentation',
|
|
55
55
|
exportName: 'presentationRenderer',
|
|
56
|
-
formats: [
|
|
57
|
-
'presentation',
|
|
58
|
-
'ppt',
|
|
59
|
-
'pptx',
|
|
60
|
-
'pptm',
|
|
61
|
-
'pot',
|
|
62
|
-
'potx',
|
|
63
|
-
'potm',
|
|
64
|
-
'ppsx',
|
|
65
|
-
'ppsm'
|
|
66
|
-
],
|
|
56
|
+
formats: ['presentation'],
|
|
67
57
|
rendererIds: ['office-presentation-binary', 'office-presentation'],
|
|
68
58
|
chunkName: 'file-viewer-presentation'
|
|
69
59
|
},
|
|
60
|
+
{
|
|
61
|
+
id: 'presentation-binary',
|
|
62
|
+
packageName: '@file-viewer/renderer-presentation/ppt',
|
|
63
|
+
exportName: 'pptRenderer',
|
|
64
|
+
formats: ['ppt', 'pot'],
|
|
65
|
+
rendererIds: ['office-presentation-binary'],
|
|
66
|
+
chunkName: 'file-viewer-presentation-ppt'
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
id: 'presentation-openxml',
|
|
70
|
+
packageName: '@file-viewer/renderer-presentation/pptx',
|
|
71
|
+
exportName: 'pptxRenderer',
|
|
72
|
+
formats: ['pptx', 'pptm', 'potx', 'potm', 'ppsx', 'ppsm'],
|
|
73
|
+
rendererIds: ['office-presentation'],
|
|
74
|
+
chunkName: 'file-viewer-presentation-pptx'
|
|
75
|
+
},
|
|
70
76
|
{
|
|
71
77
|
id: 'word',
|
|
72
78
|
packageName: '@file-viewer/renderer-word',
|
|
@@ -1070,8 +1076,37 @@ function resolvePackageEntry(packageName, anchorPackages = []) {
|
|
|
1070
1076
|
return null;
|
|
1071
1077
|
}
|
|
1072
1078
|
const packageRoot = dirname(packageJsonPath);
|
|
1079
|
+
const anchorPackageJson = anchorPackages
|
|
1080
|
+
.map((anchorPackage) => resolvePackageJson(anchorPackage))
|
|
1081
|
+
.find(Boolean);
|
|
1082
|
+
const requireFns = [
|
|
1083
|
+
projectRequire(),
|
|
1084
|
+
pluginRequire,
|
|
1085
|
+
...(anchorPackageJson ? [createRequire(anchorPackageJson)] : [])
|
|
1086
|
+
];
|
|
1073
1087
|
try {
|
|
1074
1088
|
const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8'));
|
|
1089
|
+
const exportSubpath = packageJson.name && packageName.startsWith(`${packageJson.name}/`)
|
|
1090
|
+
? `.${packageName.slice(packageJson.name.length)}`
|
|
1091
|
+
: null;
|
|
1092
|
+
if (exportSubpath) {
|
|
1093
|
+
const exportedEntry = readPackageExportEntry(packageJson.exports?.[exportSubpath]);
|
|
1094
|
+
if (exportedEntry) {
|
|
1095
|
+
const entry = resolve(packageRoot, exportedEntry);
|
|
1096
|
+
if (existsSync(entry) && statSync(entry).isFile()) {
|
|
1097
|
+
return entry;
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
for (const requireFn of requireFns) {
|
|
1101
|
+
try {
|
|
1102
|
+
return requireFn.resolve(packageName);
|
|
1103
|
+
}
|
|
1104
|
+
catch {
|
|
1105
|
+
// Continue probing alternate anchors.
|
|
1106
|
+
}
|
|
1107
|
+
}
|
|
1108
|
+
return null;
|
|
1109
|
+
}
|
|
1075
1110
|
const candidates = unique([
|
|
1076
1111
|
packageJson.module,
|
|
1077
1112
|
packageJson.main,
|
|
@@ -1087,14 +1122,6 @@ function resolvePackageEntry(packageName, anchorPackages = []) {
|
|
|
1087
1122
|
catch {
|
|
1088
1123
|
// Fall back to Node resolution below.
|
|
1089
1124
|
}
|
|
1090
|
-
const anchorPackageJson = anchorPackages
|
|
1091
|
-
.map((anchorPackage) => resolvePackageJson(anchorPackage))
|
|
1092
|
-
.find(Boolean);
|
|
1093
|
-
const requireFns = [
|
|
1094
|
-
projectRequire(),
|
|
1095
|
-
pluginRequire,
|
|
1096
|
-
...(anchorPackageJson ? [createRequire(anchorPackageJson)] : [])
|
|
1097
|
-
];
|
|
1098
1125
|
for (const requireFn of requireFns) {
|
|
1099
1126
|
try {
|
|
1100
1127
|
return requireFn.resolve(packageName);
|
package/package.json
CHANGED