@ditojs/build 1.28.0 → 1.30.0
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/package.json +3 -4
- package/src/rollup.js +0 -29
- package/src/vite.js +3 -15
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ditojs/build",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.30.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": "https://github.com/ditojs/dito/tree/master/packages/build",
|
|
6
6
|
"author": "Jürg Lehni <juerg@scratchdisk.com> (http://scratchdisk.com)",
|
|
@@ -23,14 +23,13 @@
|
|
|
23
23
|
"node >= 18"
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"autoprefixer": "^10.4.
|
|
27
|
-
"find-up": "^6.3.0",
|
|
26
|
+
"autoprefixer": "^10.4.14",
|
|
28
27
|
"mime": "^3.0.0",
|
|
29
28
|
"mini-svg-data-uri": "^1.4.4",
|
|
30
29
|
"minimist": "^1.2.8",
|
|
31
30
|
"postcss": "^8.4.21",
|
|
32
31
|
"postcss-inset": "^1.0.0"
|
|
33
32
|
},
|
|
34
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "5d09dc24ecb77b511f3c25643275ea1b9514fb52",
|
|
35
34
|
"readme": "# Dito.js Build Helper Functions\n\nDito.js is a declarative and modern web framework with a focus on API driven\ndevelopment, based on Koa.js, Objection.js and Vue.js\n\nReleased in 2018 under the MIT license, with support by https://lineto.com/\n"
|
|
36
35
|
}
|
package/src/rollup.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import fs from 'fs'
|
|
2
|
-
import path from 'path'
|
|
3
1
|
import { builtinModules, createRequire } from 'module'
|
|
4
|
-
import { findUpSync } from 'find-up'
|
|
5
2
|
import { asArray, escapeRegexp } from '@ditojs/utils'
|
|
6
3
|
|
|
7
4
|
const require = createRequire(import.meta.url)
|
|
@@ -41,32 +38,6 @@ export function getRollupExternalsFromDependencies({
|
|
|
41
38
|
return externals
|
|
42
39
|
}
|
|
43
40
|
|
|
44
|
-
export function createRollupImportsResolver({ cwd = process.cwd() } = {}) {
|
|
45
|
-
// Read `package.json` from the closest package.json, so we can emulate
|
|
46
|
-
// ESM-style imports mappings in rollup / vite.
|
|
47
|
-
const pkg = findUpSync('package.json', { cwd })
|
|
48
|
-
const { imports = {} } = JSON.parse(fs.readFileSync(pkg, 'utf8'))
|
|
49
|
-
|
|
50
|
-
return {
|
|
51
|
-
// Use a custom rollup resolver to emulate ESM-style imports
|
|
52
|
-
// mappings in vite, as read from `package.json` above:
|
|
53
|
-
find: /^#/,
|
|
54
|
-
replacement: '#',
|
|
55
|
-
customResolver(id) {
|
|
56
|
-
for (const [find, replacement] of Object.entries(imports)) {
|
|
57
|
-
const { match, capture } = matchModuleIdentifier(id, find)
|
|
58
|
-
if (match) {
|
|
59
|
-
const replacementPath = path.resolve(replacement)
|
|
60
|
-
id = capture
|
|
61
|
-
? replacementPath.replace('*', capture)
|
|
62
|
-
: replacementPath
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
return id
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
41
|
export function matchModuleIdentifier(id, pattern) {
|
|
71
42
|
const regexp = new RegExp(`^${escapeRegexp(pattern).replace('\\*', '(.*)')}$`)
|
|
72
43
|
const match = id.match(regexp)
|
package/src/vite.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { defineConfig as defineViteConfig } from 'vite'
|
|
2
2
|
import { createVuePlugin } from 'vite-plugin-vue2'
|
|
3
3
|
import { getPostCssConfig } from './postcss.js'
|
|
4
|
-
import {
|
|
5
|
-
getRollupExternalsFromDependencies,
|
|
6
|
-
createRollupImportsResolver
|
|
7
|
-
} from './rollup.js'
|
|
4
|
+
import { getRollupExternalsFromDependencies } from './rollup.js'
|
|
8
5
|
|
|
9
6
|
export function getViteConfig({
|
|
10
7
|
name,
|
|
@@ -26,15 +23,8 @@ export function getViteConfig({
|
|
|
26
23
|
})
|
|
27
24
|
return defineConfig({
|
|
28
25
|
plugins: vue
|
|
29
|
-
? [
|
|
30
|
-
createVuePlugin()
|
|
31
|
-
]
|
|
26
|
+
? [createVuePlugin()]
|
|
32
27
|
: null,
|
|
33
|
-
resolve: {
|
|
34
|
-
alias: [
|
|
35
|
-
createRollupImportsResolver()
|
|
36
|
-
]
|
|
37
|
-
},
|
|
38
28
|
esbuild: build
|
|
39
29
|
? { minify }
|
|
40
30
|
: null,
|
|
@@ -59,9 +49,7 @@ export function getViteConfig({
|
|
|
59
49
|
}
|
|
60
50
|
: null,
|
|
61
51
|
css: css
|
|
62
|
-
? {
|
|
63
|
-
postcss: getPostCssConfig()
|
|
64
|
-
}
|
|
52
|
+
? { postcss: getPostCssConfig() }
|
|
65
53
|
: null,
|
|
66
54
|
...rest
|
|
67
55
|
})
|