@md-plugins/quasar-app-extension-q-press 0.1.0-beta.2 → 0.1.0-beta.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.
- package/README.md +1 -1
- package/dist/index.js +23 -2
- package/package.json +14 -14
- package/src/index.ts +47 -6
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ The Ultimate Markdown Solution for the Quasar Framework.
|
|
|
4
4
|
|
|
5
5
|
See the [documentation](https://md-plugins.netlify.app/quasar-app-extensions/qpress/overview) for more information.
|
|
6
6
|
|
|
7
|
-
> Current beta release: `0.1.0-beta.
|
|
7
|
+
> Current beta release: `0.1.0-beta.3`.
|
|
8
8
|
>
|
|
9
9
|
> Q-Press currently targets Quasar Vite projects using `@quasar/app-vite` `>=3.0.0-beta.14`. TypeScript processing is required.
|
|
10
10
|
|
package/dist/index.js
CHANGED
|
@@ -5,8 +5,26 @@
|
|
|
5
5
|
* Docs: https://quasar.dev/app-extensions/development-guide/index-api
|
|
6
6
|
*/
|
|
7
7
|
import { defineIndexScript } from '@quasar/app-vite';
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
function normalizeAlias(alias) {
|
|
9
|
+
if (Array.isArray(alias)) {
|
|
10
|
+
return [...alias];
|
|
11
|
+
}
|
|
12
|
+
return Object.entries(alias ?? {}).map(([find, replacement]) => ({
|
|
13
|
+
find,
|
|
14
|
+
replacement,
|
|
15
|
+
}));
|
|
16
|
+
}
|
|
17
|
+
function addQuasarSourceAlias(viteConf, appDir) {
|
|
18
|
+
const alias = normalizeAlias(viteConf.resolve?.alias);
|
|
19
|
+
viteConf.resolve ??= {};
|
|
20
|
+
viteConf.resolve.alias = [
|
|
21
|
+
...alias,
|
|
22
|
+
{
|
|
23
|
+
find: /^quasar\/src\/(.*)$/,
|
|
24
|
+
replacement: `${appDir.replace(/\\/g, '/')}/node_modules/quasar/src/$1`,
|
|
25
|
+
},
|
|
26
|
+
];
|
|
27
|
+
}
|
|
10
28
|
export default defineIndexScript((api) => {
|
|
11
29
|
// verify this is a Vite project
|
|
12
30
|
if (!api.hasVite) {
|
|
@@ -56,4 +74,7 @@ export default defineIndexScript((api) => {
|
|
|
56
74
|
// config.vite.plugins.push(viteMdPlugin({ path: markdownPath, menu: sidebar }))
|
|
57
75
|
// }
|
|
58
76
|
});
|
|
77
|
+
api.extendViteConf((viteConf, _invoke, aeApi) => {
|
|
78
|
+
addQuasarSourceAlias(viteConf, aeApi.appDir);
|
|
79
|
+
});
|
|
59
80
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@md-plugins/quasar-app-extension-q-press",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.3",
|
|
4
4
|
"description": "QPress - The Ultimate Markdown Solution for Quasar Framework",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"markdown",
|
|
@@ -29,19 +29,19 @@
|
|
|
29
29
|
"@types/markdown-it": "^14.1.2",
|
|
30
30
|
"fs-extra": "^11.3.4",
|
|
31
31
|
"markdown-it": "^14.1.1",
|
|
32
|
-
"@md-plugins/md-plugin-blockquote": "0.1.0-beta.
|
|
33
|
-
"@md-plugins/md-plugin-
|
|
34
|
-
"@md-plugins/md-plugin-
|
|
35
|
-
"@md-plugins/md-plugin-
|
|
36
|
-
"@md-plugins/md-plugin-headers": "0.1.0-beta.
|
|
37
|
-
"@md-plugins/md-plugin-imports": "0.1.0-beta.
|
|
38
|
-
"@md-plugins/md-plugin-
|
|
39
|
-
"@md-plugins/md-plugin-
|
|
40
|
-
"@md-plugins/md-plugin-
|
|
41
|
-
"@md-plugins/md-plugin-
|
|
42
|
-
"@md-plugins/
|
|
43
|
-
"@md-plugins/
|
|
44
|
-
"@md-plugins/md-plugin
|
|
32
|
+
"@md-plugins/md-plugin-blockquote": "0.1.0-beta.3",
|
|
33
|
+
"@md-plugins/md-plugin-frontmatter": "0.1.0-beta.3",
|
|
34
|
+
"@md-plugins/md-plugin-codeblocks": "0.1.0-beta.3",
|
|
35
|
+
"@md-plugins/md-plugin-containers": "0.1.0-beta.3",
|
|
36
|
+
"@md-plugins/md-plugin-headers": "0.1.0-beta.3",
|
|
37
|
+
"@md-plugins/md-plugin-imports": "0.1.0-beta.3",
|
|
38
|
+
"@md-plugins/md-plugin-image": "0.1.0-beta.3",
|
|
39
|
+
"@md-plugins/md-plugin-inlinecode": "0.1.0-beta.3",
|
|
40
|
+
"@md-plugins/md-plugin-link": "0.1.0-beta.3",
|
|
41
|
+
"@md-plugins/md-plugin-table": "0.1.0-beta.3",
|
|
42
|
+
"@md-plugins/shared": "0.1.0-beta.3",
|
|
43
|
+
"@md-plugins/md-plugin-title": "0.1.0-beta.3",
|
|
44
|
+
"@md-plugins/vite-md-plugin": "0.1.0-beta.3"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@quasar/app-vite": "3.0.0-beta.14",
|
package/src/index.ts
CHANGED
|
@@ -10,6 +10,43 @@ import { defineIndexScript } from '@quasar/app-vite'
|
|
|
10
10
|
// import fse from 'fs-extra'
|
|
11
11
|
// import { viteMdPlugin } from '@md-plugins/vite-md-plugin'
|
|
12
12
|
|
|
13
|
+
type ViteAliasEntry = {
|
|
14
|
+
find: string | RegExp
|
|
15
|
+
replacement: string
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
type ViteAlias = readonly ViteAliasEntry[] | Record<string, string>
|
|
19
|
+
|
|
20
|
+
type ViteConfigWithAlias = {
|
|
21
|
+
resolve?: {
|
|
22
|
+
alias?: ViteAlias
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function normalizeAlias(alias: ViteAlias | undefined): ViteAliasEntry[] {
|
|
27
|
+
if (Array.isArray(alias)) {
|
|
28
|
+
return [...alias]
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return Object.entries(alias ?? {}).map(([find, replacement]) => ({
|
|
32
|
+
find,
|
|
33
|
+
replacement,
|
|
34
|
+
}))
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function addQuasarSourceAlias(viteConf: ViteConfigWithAlias, appDir: string): void {
|
|
38
|
+
const alias = normalizeAlias(viteConf.resolve?.alias)
|
|
39
|
+
|
|
40
|
+
viteConf.resolve ??= {}
|
|
41
|
+
viteConf.resolve.alias = [
|
|
42
|
+
...alias,
|
|
43
|
+
{
|
|
44
|
+
find: /^quasar\/src\/(.*)$/,
|
|
45
|
+
replacement: `${appDir.replace(/\\/g, '/')}/node_modules/quasar/src/$1`,
|
|
46
|
+
},
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
|
|
13
50
|
export default defineIndexScript((api) => {
|
|
14
51
|
// verify this is a Vite project
|
|
15
52
|
if (!api.hasVite) {
|
|
@@ -27,7 +64,9 @@ export default defineIndexScript((api) => {
|
|
|
27
64
|
|
|
28
65
|
// make sure 'vueRouterMode' has 'history' mode
|
|
29
66
|
if (config.build.vueRouterMode !== 'history') {
|
|
30
|
-
console.warn(
|
|
67
|
+
console.warn(
|
|
68
|
+
'Changing vueRouterMode to "history" - required for hash links to work correctly',
|
|
69
|
+
)
|
|
31
70
|
config.build.vueRouterMode = 'history'
|
|
32
71
|
}
|
|
33
72
|
|
|
@@ -35,11 +74,9 @@ export default defineIndexScript((api) => {
|
|
|
35
74
|
const include = config.build.viteVuePluginOptions.include
|
|
36
75
|
if (Array.isArray(include)) {
|
|
37
76
|
include.push(/\.(vue|md)$/)
|
|
38
|
-
}
|
|
39
|
-
else if (include !== void 0) {
|
|
77
|
+
} else if (include !== void 0) {
|
|
40
78
|
config.build.viteVuePluginOptions.include = [include, /\.(vue|md)$/]
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
79
|
+
} else {
|
|
43
80
|
config.build.viteVuePluginOptions.include = [/\.(vue|md)$/]
|
|
44
81
|
}
|
|
45
82
|
|
|
@@ -67,4 +104,8 @@ export default defineIndexScript((api) => {
|
|
|
67
104
|
// config.vite.plugins.push(viteMdPlugin({ path: markdownPath, menu: sidebar }))
|
|
68
105
|
// }
|
|
69
106
|
})
|
|
70
|
-
|
|
107
|
+
|
|
108
|
+
api.extendViteConf((viteConf, _invoke, aeApi) => {
|
|
109
|
+
addQuasarSourceAlias(viteConf, aeApi.appDir)
|
|
110
|
+
})
|
|
111
|
+
})
|