Skip to content
This repository has been archived by the owner on Mar 20, 2024. It is now read-only.

Commit

Permalink
update reset resolving for @unocss/resets to handle pnpm and npm
Browse files Browse the repository at this point in the history
  • Loading branch information
jacob-8 committed May 19, 2023
1 parent 33257be commit 7344d8f
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"commit": false,
"fixed": [],
"linked": [
["svelte-scoped-uno", "svelte-preprocess-unocss"]
["svelte-preprocess-unocss", "svelte-scoped-uno"]
],
"access": "public",
"baseBranch": "main",
Expand Down
2 changes: 1 addition & 1 deletion examples/svelte-vite-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"marked": "^5.0.2",
"svelte": "^3.59.1",
"svelte-check": "^3.3.2",
"svelte-scoped-uno": "^0.1.1",
"svelte-scoped-uno": "^0.1.2",
"tslib": "^2.5.2",
"typescript": "^5.0.4",
"vite": "^4.3.8"
Expand Down
2 changes: 1 addition & 1 deletion examples/sveltekit-preprocess/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"publint": "^0.1.11",
"svelte": "^3.59.1",
"svelte-check": "^3.3.2",
"svelte-preprocess-unocss": "^0.1.1",
"svelte-preprocess-unocss": "^0.1.2",
"tslib": "^2.5.2",
"typescript": "^5.0.4",
"vite": "^4.3.8",
Expand Down
2 changes: 1 addition & 1 deletion examples/sveltekit-vite-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"marked": "^5.0.2",
"svelte": "^3.59.1",
"svelte-check": "^3.3.2",
"svelte-scoped-uno": "^0.1.1",
"svelte-scoped-uno": "^0.1.2",
"tslib": "^2.5.2",
"typescript": "^5.0.4",
"vite": "^4.3.8"
Expand Down
8 changes: 8 additions & 0 deletions packages/svelte-preprocess-unocss/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# svelte-preprocess-unocss

## 0.1.2

### Patch Changes

- update reset resolving for @unocss/resets to handle pnpm and npm
- Updated dependencies
- svelte-scoped-uno@0.1.2

## 0.1.1

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions packages/svelte-preprocess-unocss/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "svelte-preprocess-unocss",
"version": "0.1.1",
"version": "0.1.2",
"description": "Run UnoCSS in svelte-scoped mode via a svelte-preprocessor for use in component libraries",
"type": "module",
"scripts": {
Expand All @@ -21,7 +21,7 @@
"dist"
],
"dependencies": {
"svelte-scoped-uno": "^0.1.1"
"svelte-scoped-uno": "^0.1.2"
},
"devDependencies": {
"@vitest/ui": "^0.31.1",
Expand Down
6 changes: 6 additions & 0 deletions packages/svelte-scoped-uno/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# svelte-scoped-uno

## 0.1.2

### Patch Changes

- update reset resolving for @unocss/resets to handle pnpm and npm

## 0.1.1

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/svelte-scoped-uno/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "svelte-scoped-uno",
"version": "0.1.1",
"version": "0.1.2",
"description": "Use UnoCSS utility styles in a modular fashion in Svelte, with styles being stored only where needed.",
"type": "module",
"scripts": {
Expand Down
10 changes: 10 additions & 0 deletions packages/svelte-scoped-uno/src/vite/getReset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@ const _dirname = typeof __dirname !== 'undefined'
: dirname(fileURLToPath(import.meta.url))

export function getReset(injectReset: string): string {
if (injectReset.startsWith("@unocss/reset")) {
const resolvedPNPM = resolve(resolve(_dirname, `../node_modules/${injectReset}`));
if (isFile(resolvedPNPM))
return readFileSync(resolvedPNPM, "utf-8");

const resolvedNPM = resolve(process.cwd(), "node_modules", injectReset);
return readFileSync(resolvedNPM, "utf-8");
}


if (injectReset.startsWith('@unocss/reset'))
return readFileSync(resolve(_dirname, `../node_modules/${injectReset}`), 'utf-8')

Expand Down

0 comments on commit 7344d8f

Please sign in to comment.