@nativue/core 0.4.1 → 0.4.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/cli/nativue.mjs +26 -1
- package/package.json +1 -1
package/cli/nativue.mjs
CHANGED
|
@@ -13,7 +13,7 @@ import net from 'node:net'
|
|
|
13
13
|
import { execFileSync } from 'node:child_process'
|
|
14
14
|
import { copyFileSync, existsSync, mkdirSync, readFileSync, renameSync, rmSync } from 'node:fs'
|
|
15
15
|
import { createRequire } from 'node:module'
|
|
16
|
-
import { dirname } from 'node:path'
|
|
16
|
+
import { dirname, relative } from 'node:path'
|
|
17
17
|
import { fileURLToPath } from 'node:url'
|
|
18
18
|
import { linkIosPlugins } from './link.mjs'
|
|
19
19
|
import { runOnAndroid, runOnIOS } from './run.mjs'
|
|
@@ -86,6 +86,30 @@ function finishBundle(mode) {
|
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
+
// A .vue file's <style> would become CSS that native views never read: warn instead of dropping it
|
|
90
|
+
// silently, once per file, and leave the CSS out of the build.
|
|
91
|
+
function ignoreStyleBlocks() {
|
|
92
|
+
const warnedFiles = new Set()
|
|
93
|
+
|
|
94
|
+
return {
|
|
95
|
+
name: 'nativue-ignore-style-blocks',
|
|
96
|
+
enforce: 'pre',
|
|
97
|
+
load(id) {
|
|
98
|
+
if (!id.includes('?vue&type=style')) return null
|
|
99
|
+
|
|
100
|
+
const file = relative(process.cwd(), id.split('?')[0])
|
|
101
|
+
if (!warnedFiles.has(file)) {
|
|
102
|
+
warnedFiles.add(file)
|
|
103
|
+
this.warn(
|
|
104
|
+
`${file}: <style> blocks aren't supported, native views don't read CSS. Use StyleSheet or @nativue/tailwind instead: https://github.com/nativue/nativue/blob/main/docs/styling.md`,
|
|
105
|
+
)
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return ''
|
|
109
|
+
},
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
89
113
|
const CONFIG_FILES = [
|
|
90
114
|
'nativue.config.ts',
|
|
91
115
|
'nativue.config.mts',
|
|
@@ -143,6 +167,7 @@ function viteConfig({ mode, plugins = [], watch = null, sourcemap = false }) {
|
|
|
143
167
|
compilerOptions: { isCustomElement: (tag) => NATIVE_COMPONENT_TAGS.includes(tag) },
|
|
144
168
|
},
|
|
145
169
|
}),
|
|
170
|
+
ignoreStyleBlocks(),
|
|
146
171
|
...APP_VITE_PLUGINS,
|
|
147
172
|
finishBundle(mode),
|
|
148
173
|
...plugins,
|