Comparing version 0.1.1 to 0.2.0
@@ -0,5 +1,6 @@ | ||
import { UnunuraViteOptions } from 'ununura-shared'; | ||
import { Plugin } from 'vite'; | ||
declare const ununura: () => Plugin[]; | ||
declare const ununura: (options?: UnunuraViteOptions) => Plugin[]; | ||
export { ununura }; |
// src/plugins/core.ts | ||
import { UnunuraGlobalGenerate, UnunuraScopedSFCFile } from "ununura-engine"; | ||
import { isVueFile as isVueFile2, VIRTUAL_CSS_INJECT_FILENAME, RESOLVED_VIRTUAL_CSS_INJECT_FILENAME as RESOLVED_VIRTUAL_CSS_INJECT_FILENAME2, isSvelteFile as isSvelteFile2 } from "ununura-shared"; | ||
import { UnunuraGlobalGenerate, UnunuraJSXSFCFile, UnunuraScopedSFCFile } from "ununura-engine"; | ||
import { | ||
isVueFile as isVueFile2, | ||
VIRTUAL_CSS_INJECT_FILENAME, | ||
RESOLVED_VIRTUAL_CSS_INJECT_FILENAME as RESOLVED_VIRTUAL_CSS_INJECT_FILENAME2, | ||
isSvelteFile as isSvelteFile2, | ||
isJSXFile as isJSXFile2, | ||
getFilename, | ||
isJSXEntryFile | ||
} from "ununura-shared"; | ||
@@ -16,7 +24,16 @@ // src/hot.ts | ||
// src/support.ts | ||
import { isSvelteFile, isVueFile } from "ununura-shared"; | ||
var validForUpdate = (filename) => isVueFile(filename) || isSvelteFile(filename); | ||
import { isJSXFile, isSvelteFile, isVueFile } from "ununura-shared"; | ||
var validForUpdate = (filename) => isVueFile(filename) || isSvelteFile(filename) || isJSXFile(filename); | ||
// src/options.ts | ||
var resolvedViteOptions = (options = {}) => { | ||
let _options = {}; | ||
_options.jsx = options?.jsx ?? false; | ||
_options.jsxIgnoreEntryFile = options?.jsxIgnoreEntryFile ?? true; | ||
return _options; | ||
}; | ||
// src/plugins/core.ts | ||
var core_default = () => { | ||
var core_default = (options) => { | ||
const { jsx, jsxIgnoreEntryFile } = resolvedViteOptions(options); | ||
return { | ||
@@ -26,8 +43,14 @@ name: "ununuracss:core", | ||
transform(code, id) { | ||
const filename = getFilename(id); | ||
if (isVueFile2(id)) { | ||
return UnunuraScopedSFCFile(code, "vue"); | ||
return UnunuraScopedSFCFile(code, "vue", filename); | ||
} | ||
if (isSvelteFile2(id)) { | ||
return UnunuraScopedSFCFile(code, "svelte"); | ||
return UnunuraScopedSFCFile(code, "svelte", filename); | ||
} | ||
if (isJSXFile2(id) && jsx) { | ||
if (jsxIgnoreEntryFile && isJSXEntryFile(id)) | ||
return null; | ||
return UnunuraJSXSFCFile(code, filename); | ||
} | ||
}, | ||
@@ -39,3 +62,3 @@ resolveId(id) { | ||
if (id === RESOLVED_VIRTUAL_CSS_INJECT_FILENAME2) { | ||
const code = await UnunuraGlobalGenerate(); | ||
const code = await UnunuraGlobalGenerate({ jsx, jsxIgnoreEntryFile }); | ||
return { code }; | ||
@@ -62,4 +85,4 @@ } | ||
// src/index.ts | ||
var ununura = () => { | ||
return [core_default(), fontaine_default]; | ||
var ununura = (options = {}) => { | ||
return [core_default(options), fontaine_default]; | ||
}; | ||
@@ -66,0 +89,0 @@ export { |
{ | ||
"name": "ununura", | ||
"version": "0.1.1", | ||
"version": "0.2.0", | ||
"description": "Atomic CSS Engine.", | ||
@@ -37,4 +37,4 @@ "author": "Novout", | ||
"fontaine": "^0.2.3", | ||
"ununura-engine": "0.1.1", | ||
"ununura-shared": "0.1.1" | ||
"ununura-engine": "0.2.0", | ||
"ununura-shared": "0.2.0" | ||
}, | ||
@@ -44,3 +44,3 @@ "devDependencies": { | ||
}, | ||
"gitHead": "256270bd05d449af50a4e4cd2b42d51587617253" | ||
"gitHead": "b87cc0d01493131d95829152458723e7fb2856ef" | ||
} |
@@ -1,2 +0,2 @@ | ||
## Example with Vue | ||
## Example with Vite | ||
@@ -6,30 +6,24 @@ `pnpm add -D ununura` | ||
```ts | ||
import { defineConfig } from 'vite' | ||
import vue from '@vitejs/plugin-vue' | ||
// in your framework entrypoint | ||
import 'ununura.css' | ||
``` | ||
```ts | ||
// Insert ununura plugin in first position | ||
import { ununura } from 'ununura' | ||
export default defineConfig({ | ||
plugins: [vue(), ununura()], | ||
plugins: [ununura(), framework_plugin()], | ||
}) | ||
``` | ||
## Example with Svelte | ||
> ATTENTION! Uses `type: module` in `package.json` | ||
`pnpm add -D ununura` | ||
### JSX | ||
> Insert the ununura plugin in first position | ||
To use JSX (whether in React or Vue-JSX), enter the following option: | ||
```ts | ||
import { defineConfig } from 'vite' | ||
import { svelte } from '@sveltejs/vite-plugin-svelte' | ||
import { ununura } from 'ununura' | ||
// https://vitejs.dev/config/ | ||
export default defineConfig({ | ||
plugins: [ununura(), svelte()], | ||
plugins: [ununura({ jsx: true })], | ||
}) | ||
``` | ||
> ATTENTION! Insert 'ununura.css' in your svelte/vue entrypoint. | ||
> ATTENTION! Uses `type: module` in `package.json` | ||
``` |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8017
184
28
+ Addedununura-engine@0.2.0(transitive)
+ Addedununura-shared@0.2.0(transitive)
- Removedununura-engine@0.1.1(transitive)
- Removedununura-shared@0.1.1(transitive)
Updatedununura-engine@0.2.0
Updatedununura-shared@0.2.0