@markweave/vue2 0.10.0 → 0.10.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/LICENSE +21 -21
- package/README.md +64 -64
- package/dist/index.js +1 -1
- package/dist/legacy/index.js +4975 -4950
- package/legacy.d.ts +1 -1
- package/legacy.js +1 -1
- package/package.json +2 -2
- package/webpack4/index.cjs +223 -223
- package/webpack4/index.d.cts +12 -12
- package/webpack4/package.json +5 -5
package/legacy.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./dist/types/index";
|
|
1
|
+
export * from "./dist/types/index";
|
package/legacy.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./dist/legacy/index.js";
|
|
1
|
+
export * from "./dist/legacy/index.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@markweave/vue2",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Vue 2 adapter for the Markweave Markdown-first WYSIWYG editor.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"prosemirror-model": "1.25.11",
|
|
70
70
|
"prosemirror-state": "1.4.4",
|
|
71
71
|
"prosemirror-view": "1.42.2",
|
|
72
|
-
"markweave": "^0.10.
|
|
72
|
+
"markweave": "^0.10.1"
|
|
73
73
|
},
|
|
74
74
|
"peerDependencies": {
|
|
75
75
|
"vue": "^2.6.12"
|
package/webpack4/index.cjs
CHANGED
|
@@ -1,223 +1,223 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const fs = require("node:fs");
|
|
4
|
-
const path = require("node:path");
|
|
5
|
-
|
|
6
|
-
const TIPTAP_PM_SUBPATHS = [
|
|
7
|
-
"changeset",
|
|
8
|
-
"commands",
|
|
9
|
-
"dropcursor",
|
|
10
|
-
"gapcursor",
|
|
11
|
-
"history",
|
|
12
|
-
"inputrules",
|
|
13
|
-
"keymap",
|
|
14
|
-
"model",
|
|
15
|
-
"schema-list",
|
|
16
|
-
"state",
|
|
17
|
-
"tables",
|
|
18
|
-
"transform",
|
|
19
|
-
"view",
|
|
20
|
-
];
|
|
21
|
-
const PROSEMIRROR_RUNTIME_PACKAGES = [
|
|
22
|
-
"prosemirror-model",
|
|
23
|
-
"prosemirror-state",
|
|
24
|
-
"prosemirror-view",
|
|
25
|
-
];
|
|
26
|
-
|
|
27
|
-
function findPackageRoot(packageName, searchPaths) {
|
|
28
|
-
for (const searchPath of searchPaths) {
|
|
29
|
-
let current = fs.existsSync(searchPath) ? fs.realpathSync(searchPath) : path.resolve(searchPath);
|
|
30
|
-
while (current !== path.dirname(current)) {
|
|
31
|
-
const candidate = path.join(current, "node_modules", packageName);
|
|
32
|
-
const manifest = path.join(candidate, "package.json");
|
|
33
|
-
if (fs.existsSync(manifest)) {
|
|
34
|
-
try {
|
|
35
|
-
if (JSON.parse(fs.readFileSync(manifest, "utf8")).name === packageName) {
|
|
36
|
-
return fs.realpathSync(candidate);
|
|
37
|
-
}
|
|
38
|
-
} catch {
|
|
39
|
-
return null;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
current = path.dirname(current);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
let entry;
|
|
47
|
-
try {
|
|
48
|
-
entry = require.resolve(packageName, { paths: searchPaths });
|
|
49
|
-
} catch {
|
|
50
|
-
return null;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
let current = path.dirname(entry);
|
|
54
|
-
while (current !== path.dirname(current)) {
|
|
55
|
-
const manifest = path.join(current, "package.json");
|
|
56
|
-
if (fs.existsSync(manifest)) {
|
|
57
|
-
try {
|
|
58
|
-
if (JSON.parse(fs.readFileSync(manifest, "utf8")).name === packageName) {
|
|
59
|
-
return fs.realpathSync(current);
|
|
60
|
-
}
|
|
61
|
-
} catch {
|
|
62
|
-
return null;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
current = path.dirname(current);
|
|
66
|
-
}
|
|
67
|
-
return null;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
function setRequiredAlias(config, request, target) {
|
|
71
|
-
if (!target || !fs.existsSync(target)) {
|
|
72
|
-
throw new Error(`@markweave/vue2 Webpack 4 alias target is missing: ${request} -> ${target || "unresolved"}`);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
config.resolve.alias.set(request, target);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
function readPackageManifest(packageRoot) {
|
|
79
|
-
return JSON.parse(fs.readFileSync(path.join(packageRoot, "package.json"), "utf8"));
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
function addBabelRule(config, ruleName, test, dependencyRoots, cacheDirectory, asJavascriptAuto) {
|
|
83
|
-
const rule = config.module.rule(ruleName).test(test);
|
|
84
|
-
if (asJavascriptAuto) {
|
|
85
|
-
rule.type("javascript/auto");
|
|
86
|
-
}
|
|
87
|
-
dependencyRoots.forEach((dependencyRoot) => rule.include.add(dependencyRoot));
|
|
88
|
-
rule
|
|
89
|
-
.use("babel-loader")
|
|
90
|
-
.loader("babel-loader")
|
|
91
|
-
.options({
|
|
92
|
-
cacheCompression: false,
|
|
93
|
-
cacheDirectory,
|
|
94
|
-
presets: ["@vue/cli-plugin-babel/preset"],
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
function applyMarkweaveVue2Webpack4Legacy(config, options = {}) {
|
|
99
|
-
const projectRoot = path.resolve(options.projectRoot || process.cwd());
|
|
100
|
-
const cacheDirectory = path.resolve(
|
|
101
|
-
options.cacheDirectory
|
|
102
|
-
|| process.env.MARKWEAVE_BABEL_CACHE_DIR
|
|
103
|
-
|| path.join(projectRoot, ".cache/markweave-babel-loader"),
|
|
104
|
-
);
|
|
105
|
-
const installedPackageRoot = path.join(projectRoot, "node_modules/@markweave/vue2");
|
|
106
|
-
const packageRoot = fs.existsSync(installedPackageRoot)
|
|
107
|
-
? installedPackageRoot
|
|
108
|
-
: path.resolve(__dirname, "..");
|
|
109
|
-
const searchPaths = [projectRoot, packageRoot, fs.realpathSync(packageRoot)];
|
|
110
|
-
const vueRoot = findPackageRoot("vue", searchPaths);
|
|
111
|
-
const markweaveRoot = findPackageRoot("markweave", searchPaths);
|
|
112
|
-
const tiptapCoreRoot = findPackageRoot("@tiptap/core", searchPaths);
|
|
113
|
-
const tiptapPmRoot = findPackageRoot("@tiptap/pm", searchPaths);
|
|
114
|
-
const tiptapVue2Root = findPackageRoot("@tiptap/vue-2", searchPaths);
|
|
115
|
-
const prosemirrorRoots = new Map(
|
|
116
|
-
PROSEMIRROR_RUNTIME_PACKAGES.map((packageName) => [
|
|
117
|
-
packageName,
|
|
118
|
-
findPackageRoot(packageName, searchPaths),
|
|
119
|
-
]),
|
|
120
|
-
);
|
|
121
|
-
const missingPackages = [
|
|
122
|
-
["vue", vueRoot],
|
|
123
|
-
["markweave", markweaveRoot],
|
|
124
|
-
["@tiptap/core", tiptapCoreRoot],
|
|
125
|
-
["@tiptap/pm", tiptapPmRoot],
|
|
126
|
-
["@tiptap/vue-2", tiptapVue2Root],
|
|
127
|
-
...prosemirrorRoots.entries(),
|
|
128
|
-
].filter(([, packagePath]) => !packagePath).map(([packageName]) => packageName);
|
|
129
|
-
const legacyEntry = path.join(packageRoot, "legacy.js");
|
|
130
|
-
|
|
131
|
-
if (!fs.existsSync(legacyEntry) || missingPackages.length > 0) {
|
|
132
|
-
throw new Error(
|
|
133
|
-
`@markweave/vue2 Webpack 4 legacy setup is incomplete. Missing: ${[
|
|
134
|
-
...(!fs.existsSync(legacyEntry) ? ["@markweave/vue2/legacy.js"] : []),
|
|
135
|
-
...missingPackages,
|
|
136
|
-
].join(", ")}`,
|
|
137
|
-
);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
const packageManifest = readPackageManifest(packageRoot);
|
|
141
|
-
const exactRuntimeRoots = new Map([
|
|
142
|
-
["@tiptap/core", tiptapCoreRoot],
|
|
143
|
-
["@tiptap/pm", tiptapPmRoot],
|
|
144
|
-
["@tiptap/vue-2", tiptapVue2Root],
|
|
145
|
-
...prosemirrorRoots.entries(),
|
|
146
|
-
]);
|
|
147
|
-
const mismatchedPackages = [];
|
|
148
|
-
exactRuntimeRoots.forEach((runtimeRoot, packageName) => {
|
|
149
|
-
const expectedVersion = packageManifest.dependencies?.[packageName];
|
|
150
|
-
const actualVersion = runtimeRoot ? readPackageManifest(runtimeRoot).version : null;
|
|
151
|
-
if (expectedVersion && actualVersion !== expectedVersion) {
|
|
152
|
-
mismatchedPackages.push(`${packageName} expected ${expectedVersion}, received ${actualVersion || "missing"}`);
|
|
153
|
-
}
|
|
154
|
-
});
|
|
155
|
-
if (mismatchedPackages.length) {
|
|
156
|
-
throw new Error(`@markweave/vue2 Webpack 4 runtime versions are misaligned: ${mismatchedPackages.join(", ")}`);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
if (options.aliasPackageImport !== false) {
|
|
160
|
-
setRequiredAlias(config, "@markweave/vue2$", legacyEntry);
|
|
161
|
-
}
|
|
162
|
-
setRequiredAlias(config, "@markweave/vue2/legacy$", legacyEntry);
|
|
163
|
-
setRequiredAlias(config, "@markweave/vue2/styles.css$", path.join(packageRoot, "styles.css"));
|
|
164
|
-
setRequiredAlias(config, "markweave/styles.css$", markweaveRoot && path.join(markweaveRoot, "dist/styles.css"));
|
|
165
|
-
setRequiredAlias(config, "./markweave/styles.css$", markweaveRoot && path.join(markweaveRoot, "dist/styles.css"));
|
|
166
|
-
setRequiredAlias(config, "vue$", vueRoot && path.join(vueRoot, "dist/vue.runtime.common.js"));
|
|
167
|
-
|
|
168
|
-
if (tiptapCoreRoot) {
|
|
169
|
-
setRequiredAlias(config, "@tiptap/core$", path.join(tiptapCoreRoot, "dist/index.js"));
|
|
170
|
-
setRequiredAlias(
|
|
171
|
-
config,
|
|
172
|
-
"@tiptap/core/jsx-runtime$",
|
|
173
|
-
path.join(tiptapCoreRoot, "jsx-runtime/index.js"),
|
|
174
|
-
);
|
|
175
|
-
}
|
|
176
|
-
if (tiptapVue2Root) {
|
|
177
|
-
setRequiredAlias(config, "@tiptap/vue-2$", path.join(tiptapVue2Root, "dist/index.js"));
|
|
178
|
-
setRequiredAlias(config, "@tiptap/vue-2/menus$", path.join(tiptapVue2Root, "dist/menus/index.js"));
|
|
179
|
-
}
|
|
180
|
-
if (tiptapPmRoot) {
|
|
181
|
-
TIPTAP_PM_SUBPATHS.forEach((subpath) => {
|
|
182
|
-
setRequiredAlias(
|
|
183
|
-
config,
|
|
184
|
-
`@tiptap/pm/${subpath}$`,
|
|
185
|
-
path.join(tiptapPmRoot, `dist/${subpath}/index.js`),
|
|
186
|
-
);
|
|
187
|
-
});
|
|
188
|
-
}
|
|
189
|
-
prosemirrorRoots.forEach((dependencyRoot, packageName) => {
|
|
190
|
-
setRequiredAlias(
|
|
191
|
-
config,
|
|
192
|
-
`${packageName}$`,
|
|
193
|
-
dependencyRoot && path.join(dependencyRoot, "dist/index.js"),
|
|
194
|
-
);
|
|
195
|
-
});
|
|
196
|
-
|
|
197
|
-
if (config.resolve.extensions && typeof config.resolve.extensions.add === "function") {
|
|
198
|
-
config.resolve.extensions.add(".mjs");
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
const dependencyRoots = [tiptapCoreRoot, tiptapPmRoot, tiptapVue2Root].filter(Boolean);
|
|
202
|
-
if (dependencyRoots.length > 0) {
|
|
203
|
-
addBabelRule(
|
|
204
|
-
config,
|
|
205
|
-
"markweave-vue2-legacy-shared-runtime-js",
|
|
206
|
-
/\.js$/,
|
|
207
|
-
dependencyRoots,
|
|
208
|
-
cacheDirectory,
|
|
209
|
-
false,
|
|
210
|
-
);
|
|
211
|
-
addBabelRule(
|
|
212
|
-
config,
|
|
213
|
-
"markweave-vue2-legacy-shared-runtime-mjs",
|
|
214
|
-
/\.mjs$/,
|
|
215
|
-
dependencyRoots,
|
|
216
|
-
cacheDirectory,
|
|
217
|
-
true,
|
|
218
|
-
);
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
module.exports = applyMarkweaveVue2Webpack4Legacy;
|
|
223
|
-
module.exports.applyMarkweaveVue2Webpack4Legacy = applyMarkweaveVue2Webpack4Legacy;
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const fs = require("node:fs");
|
|
4
|
+
const path = require("node:path");
|
|
5
|
+
|
|
6
|
+
const TIPTAP_PM_SUBPATHS = [
|
|
7
|
+
"changeset",
|
|
8
|
+
"commands",
|
|
9
|
+
"dropcursor",
|
|
10
|
+
"gapcursor",
|
|
11
|
+
"history",
|
|
12
|
+
"inputrules",
|
|
13
|
+
"keymap",
|
|
14
|
+
"model",
|
|
15
|
+
"schema-list",
|
|
16
|
+
"state",
|
|
17
|
+
"tables",
|
|
18
|
+
"transform",
|
|
19
|
+
"view",
|
|
20
|
+
];
|
|
21
|
+
const PROSEMIRROR_RUNTIME_PACKAGES = [
|
|
22
|
+
"prosemirror-model",
|
|
23
|
+
"prosemirror-state",
|
|
24
|
+
"prosemirror-view",
|
|
25
|
+
];
|
|
26
|
+
|
|
27
|
+
function findPackageRoot(packageName, searchPaths) {
|
|
28
|
+
for (const searchPath of searchPaths) {
|
|
29
|
+
let current = fs.existsSync(searchPath) ? fs.realpathSync(searchPath) : path.resolve(searchPath);
|
|
30
|
+
while (current !== path.dirname(current)) {
|
|
31
|
+
const candidate = path.join(current, "node_modules", packageName);
|
|
32
|
+
const manifest = path.join(candidate, "package.json");
|
|
33
|
+
if (fs.existsSync(manifest)) {
|
|
34
|
+
try {
|
|
35
|
+
if (JSON.parse(fs.readFileSync(manifest, "utf8")).name === packageName) {
|
|
36
|
+
return fs.realpathSync(candidate);
|
|
37
|
+
}
|
|
38
|
+
} catch {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
current = path.dirname(current);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
let entry;
|
|
47
|
+
try {
|
|
48
|
+
entry = require.resolve(packageName, { paths: searchPaths });
|
|
49
|
+
} catch {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
let current = path.dirname(entry);
|
|
54
|
+
while (current !== path.dirname(current)) {
|
|
55
|
+
const manifest = path.join(current, "package.json");
|
|
56
|
+
if (fs.existsSync(manifest)) {
|
|
57
|
+
try {
|
|
58
|
+
if (JSON.parse(fs.readFileSync(manifest, "utf8")).name === packageName) {
|
|
59
|
+
return fs.realpathSync(current);
|
|
60
|
+
}
|
|
61
|
+
} catch {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
current = path.dirname(current);
|
|
66
|
+
}
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function setRequiredAlias(config, request, target) {
|
|
71
|
+
if (!target || !fs.existsSync(target)) {
|
|
72
|
+
throw new Error(`@markweave/vue2 Webpack 4 alias target is missing: ${request} -> ${target || "unresolved"}`);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
config.resolve.alias.set(request, target);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function readPackageManifest(packageRoot) {
|
|
79
|
+
return JSON.parse(fs.readFileSync(path.join(packageRoot, "package.json"), "utf8"));
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function addBabelRule(config, ruleName, test, dependencyRoots, cacheDirectory, asJavascriptAuto) {
|
|
83
|
+
const rule = config.module.rule(ruleName).test(test);
|
|
84
|
+
if (asJavascriptAuto) {
|
|
85
|
+
rule.type("javascript/auto");
|
|
86
|
+
}
|
|
87
|
+
dependencyRoots.forEach((dependencyRoot) => rule.include.add(dependencyRoot));
|
|
88
|
+
rule
|
|
89
|
+
.use("babel-loader")
|
|
90
|
+
.loader("babel-loader")
|
|
91
|
+
.options({
|
|
92
|
+
cacheCompression: false,
|
|
93
|
+
cacheDirectory,
|
|
94
|
+
presets: ["@vue/cli-plugin-babel/preset"],
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function applyMarkweaveVue2Webpack4Legacy(config, options = {}) {
|
|
99
|
+
const projectRoot = path.resolve(options.projectRoot || process.cwd());
|
|
100
|
+
const cacheDirectory = path.resolve(
|
|
101
|
+
options.cacheDirectory
|
|
102
|
+
|| process.env.MARKWEAVE_BABEL_CACHE_DIR
|
|
103
|
+
|| path.join(projectRoot, ".cache/markweave-babel-loader"),
|
|
104
|
+
);
|
|
105
|
+
const installedPackageRoot = path.join(projectRoot, "node_modules/@markweave/vue2");
|
|
106
|
+
const packageRoot = fs.existsSync(installedPackageRoot)
|
|
107
|
+
? installedPackageRoot
|
|
108
|
+
: path.resolve(__dirname, "..");
|
|
109
|
+
const searchPaths = [projectRoot, packageRoot, fs.realpathSync(packageRoot)];
|
|
110
|
+
const vueRoot = findPackageRoot("vue", searchPaths);
|
|
111
|
+
const markweaveRoot = findPackageRoot("markweave", searchPaths);
|
|
112
|
+
const tiptapCoreRoot = findPackageRoot("@tiptap/core", searchPaths);
|
|
113
|
+
const tiptapPmRoot = findPackageRoot("@tiptap/pm", searchPaths);
|
|
114
|
+
const tiptapVue2Root = findPackageRoot("@tiptap/vue-2", searchPaths);
|
|
115
|
+
const prosemirrorRoots = new Map(
|
|
116
|
+
PROSEMIRROR_RUNTIME_PACKAGES.map((packageName) => [
|
|
117
|
+
packageName,
|
|
118
|
+
findPackageRoot(packageName, searchPaths),
|
|
119
|
+
]),
|
|
120
|
+
);
|
|
121
|
+
const missingPackages = [
|
|
122
|
+
["vue", vueRoot],
|
|
123
|
+
["markweave", markweaveRoot],
|
|
124
|
+
["@tiptap/core", tiptapCoreRoot],
|
|
125
|
+
["@tiptap/pm", tiptapPmRoot],
|
|
126
|
+
["@tiptap/vue-2", tiptapVue2Root],
|
|
127
|
+
...prosemirrorRoots.entries(),
|
|
128
|
+
].filter(([, packagePath]) => !packagePath).map(([packageName]) => packageName);
|
|
129
|
+
const legacyEntry = path.join(packageRoot, "legacy.js");
|
|
130
|
+
|
|
131
|
+
if (!fs.existsSync(legacyEntry) || missingPackages.length > 0) {
|
|
132
|
+
throw new Error(
|
|
133
|
+
`@markweave/vue2 Webpack 4 legacy setup is incomplete. Missing: ${[
|
|
134
|
+
...(!fs.existsSync(legacyEntry) ? ["@markweave/vue2/legacy.js"] : []),
|
|
135
|
+
...missingPackages,
|
|
136
|
+
].join(", ")}`,
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
const packageManifest = readPackageManifest(packageRoot);
|
|
141
|
+
const exactRuntimeRoots = new Map([
|
|
142
|
+
["@tiptap/core", tiptapCoreRoot],
|
|
143
|
+
["@tiptap/pm", tiptapPmRoot],
|
|
144
|
+
["@tiptap/vue-2", tiptapVue2Root],
|
|
145
|
+
...prosemirrorRoots.entries(),
|
|
146
|
+
]);
|
|
147
|
+
const mismatchedPackages = [];
|
|
148
|
+
exactRuntimeRoots.forEach((runtimeRoot, packageName) => {
|
|
149
|
+
const expectedVersion = packageManifest.dependencies?.[packageName];
|
|
150
|
+
const actualVersion = runtimeRoot ? readPackageManifest(runtimeRoot).version : null;
|
|
151
|
+
if (expectedVersion && actualVersion !== expectedVersion) {
|
|
152
|
+
mismatchedPackages.push(`${packageName} expected ${expectedVersion}, received ${actualVersion || "missing"}`);
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
if (mismatchedPackages.length) {
|
|
156
|
+
throw new Error(`@markweave/vue2 Webpack 4 runtime versions are misaligned: ${mismatchedPackages.join(", ")}`);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
if (options.aliasPackageImport !== false) {
|
|
160
|
+
setRequiredAlias(config, "@markweave/vue2$", legacyEntry);
|
|
161
|
+
}
|
|
162
|
+
setRequiredAlias(config, "@markweave/vue2/legacy$", legacyEntry);
|
|
163
|
+
setRequiredAlias(config, "@markweave/vue2/styles.css$", path.join(packageRoot, "styles.css"));
|
|
164
|
+
setRequiredAlias(config, "markweave/styles.css$", markweaveRoot && path.join(markweaveRoot, "dist/styles.css"));
|
|
165
|
+
setRequiredAlias(config, "./markweave/styles.css$", markweaveRoot && path.join(markweaveRoot, "dist/styles.css"));
|
|
166
|
+
setRequiredAlias(config, "vue$", vueRoot && path.join(vueRoot, "dist/vue.runtime.common.js"));
|
|
167
|
+
|
|
168
|
+
if (tiptapCoreRoot) {
|
|
169
|
+
setRequiredAlias(config, "@tiptap/core$", path.join(tiptapCoreRoot, "dist/index.js"));
|
|
170
|
+
setRequiredAlias(
|
|
171
|
+
config,
|
|
172
|
+
"@tiptap/core/jsx-runtime$",
|
|
173
|
+
path.join(tiptapCoreRoot, "jsx-runtime/index.js"),
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
if (tiptapVue2Root) {
|
|
177
|
+
setRequiredAlias(config, "@tiptap/vue-2$", path.join(tiptapVue2Root, "dist/index.js"));
|
|
178
|
+
setRequiredAlias(config, "@tiptap/vue-2/menus$", path.join(tiptapVue2Root, "dist/menus/index.js"));
|
|
179
|
+
}
|
|
180
|
+
if (tiptapPmRoot) {
|
|
181
|
+
TIPTAP_PM_SUBPATHS.forEach((subpath) => {
|
|
182
|
+
setRequiredAlias(
|
|
183
|
+
config,
|
|
184
|
+
`@tiptap/pm/${subpath}$`,
|
|
185
|
+
path.join(tiptapPmRoot, `dist/${subpath}/index.js`),
|
|
186
|
+
);
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
prosemirrorRoots.forEach((dependencyRoot, packageName) => {
|
|
190
|
+
setRequiredAlias(
|
|
191
|
+
config,
|
|
192
|
+
`${packageName}$`,
|
|
193
|
+
dependencyRoot && path.join(dependencyRoot, "dist/index.js"),
|
|
194
|
+
);
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
if (config.resolve.extensions && typeof config.resolve.extensions.add === "function") {
|
|
198
|
+
config.resolve.extensions.add(".mjs");
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
const dependencyRoots = [tiptapCoreRoot, tiptapPmRoot, tiptapVue2Root].filter(Boolean);
|
|
202
|
+
if (dependencyRoots.length > 0) {
|
|
203
|
+
addBabelRule(
|
|
204
|
+
config,
|
|
205
|
+
"markweave-vue2-legacy-shared-runtime-js",
|
|
206
|
+
/\.js$/,
|
|
207
|
+
dependencyRoots,
|
|
208
|
+
cacheDirectory,
|
|
209
|
+
false,
|
|
210
|
+
);
|
|
211
|
+
addBabelRule(
|
|
212
|
+
config,
|
|
213
|
+
"markweave-vue2-legacy-shared-runtime-mjs",
|
|
214
|
+
/\.mjs$/,
|
|
215
|
+
dependencyRoots,
|
|
216
|
+
cacheDirectory,
|
|
217
|
+
true,
|
|
218
|
+
);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
module.exports = applyMarkweaveVue2Webpack4Legacy;
|
|
223
|
+
module.exports.applyMarkweaveVue2Webpack4Legacy = applyMarkweaveVue2Webpack4Legacy;
|
package/webpack4/index.d.cts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
interface MarkweaveVue2Webpack4LegacyOptions {
|
|
2
|
-
projectRoot?: string;
|
|
3
|
-
cacheDirectory?: string;
|
|
4
|
-
aliasPackageImport?: boolean;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
declare function applyMarkweaveVue2Webpack4Legacy(
|
|
8
|
-
config: any,
|
|
9
|
-
options?: MarkweaveVue2Webpack4LegacyOptions,
|
|
10
|
-
): void;
|
|
11
|
-
|
|
12
|
-
export = applyMarkweaveVue2Webpack4Legacy;
|
|
1
|
+
interface MarkweaveVue2Webpack4LegacyOptions {
|
|
2
|
+
projectRoot?: string;
|
|
3
|
+
cacheDirectory?: string;
|
|
4
|
+
aliasPackageImport?: boolean;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
declare function applyMarkweaveVue2Webpack4Legacy(
|
|
8
|
+
config: any,
|
|
9
|
+
options?: MarkweaveVue2Webpack4LegacyOptions,
|
|
10
|
+
): void;
|
|
11
|
+
|
|
12
|
+
export = applyMarkweaveVue2Webpack4Legacy;
|
package/webpack4/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
{
|
|
2
|
-
"type": "commonjs",
|
|
3
|
-
"main": "./index.cjs",
|
|
4
|
-
"types": "./index.d.cts"
|
|
5
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"type": "commonjs",
|
|
3
|
+
"main": "./index.cjs",
|
|
4
|
+
"types": "./index.d.cts"
|
|
5
|
+
}
|