@sugarcube-org/vite 0.0.0-alpha.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/dist/index.d.mts +5 -0
- package/dist/index.mjs +11 -0
- package/package.json +53 -0
package/dist/index.d.mts
ADDED
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
var p=Object.defineProperty;var c=(r,o)=>p(r,"name",{value:o,configurable:!0});import{getTokenPathsFromConfig as a,tokensToCSSPipeline as g,writeCSSFilesToDisk as u,loadConfig as h}from"@sugarcube-org/core";import{minimatch as l}from"minimatch";function m(){let r;return{name:"vite-plugin-sugarcube",async config(){return r=await h(),{exclude:[r.output?.directories?.css||"./src/styles/**"]}},configureServer(o){const i=c(async()=>{try{const e=await g(r),t=[];if(e.errors.load.length>0&&t.push(e.errors.load.map(s=>` - ${s.message}`).join(`
|
|
2
|
+
`)),e.errors.flatten.length>0&&t.push(e.errors.flatten.map(s=>` - ${s.message}`).join(`
|
|
3
|
+
`)),e.errors.validation.length>0&&t.push(e.errors.validation.map(s=>` - ${s.message}`).join(`
|
|
4
|
+
`)),e.errors.resolution.length>0&&t.push(e.errors.resolution.map(s=>` - ${s.message}`).join(`
|
|
5
|
+
`)),t.length>0){o.ws.send("vite:error",{message:"Token processing failed",stack:t.join(`
|
|
6
|
+
|
|
7
|
+
`)}),o.config.logger.error(`[sugarcube] Token processing failed:
|
|
8
|
+
${t.join(`
|
|
9
|
+
|
|
10
|
+
`)}`);return}const f=a(r);await u(e.output,!0,f)}catch(e){o.ws.send("vite:error",{message:"Token processing failed",stack:e instanceof Error?e.stack:String(e)}),o.config.logger.error(`[sugarcube] Error processing tokens:
|
|
11
|
+
${e instanceof Error?e.stack:String(e)}`)}},"processTokens");i();const n=a(r);for(const e of n)o.watcher.add(e);o.watcher.on("change",async e=>{n.some(t=>l(e,t))&&await i()})},async handleHotUpdate(o){if(a(r).some(n=>l(o.file,n)))try{const n=await g(r),e=a(r);return await u(n.output,!0,e),[]}catch{return[]}return null}}}c(m,"viteSugarcube");export{m as default};
|
package/package.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sugarcube-org/vite",
|
|
3
|
+
"version": "0.0.0-alpha.2",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public"
|
|
7
|
+
},
|
|
8
|
+
"description": "Vite plugin for sugarcube",
|
|
9
|
+
"license": "UNLICENSED",
|
|
10
|
+
"author": "Mark Tomlinson",
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "https://github.com/sugarcube-org/sugarcube"
|
|
14
|
+
},
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://github.com/sugarcube-org/sugarcube/issues"
|
|
17
|
+
},
|
|
18
|
+
"keywords": [
|
|
19
|
+
"vite",
|
|
20
|
+
"design-tokens",
|
|
21
|
+
"design-system",
|
|
22
|
+
"css",
|
|
23
|
+
"sugarcube"
|
|
24
|
+
],
|
|
25
|
+
"files": [
|
|
26
|
+
"dist/"
|
|
27
|
+
],
|
|
28
|
+
"exports": {
|
|
29
|
+
".": {
|
|
30
|
+
"types": "./dist/index.d.mts",
|
|
31
|
+
"import": "./dist/index.mjs"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"minimatch": "^10.0.1",
|
|
36
|
+
"@sugarcube-org/core": "0.0.1-alpha.5"
|
|
37
|
+
},
|
|
38
|
+
"peerDependencies": {
|
|
39
|
+
"vite": "^5.2.0 || ^6"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"pkgroll": "^2.5.1",
|
|
43
|
+
"tsx": "^4.19.2",
|
|
44
|
+
"vite": "^6.0.0"
|
|
45
|
+
},
|
|
46
|
+
"scripts": {
|
|
47
|
+
"build": "pkgroll --minify --clean-dist",
|
|
48
|
+
"dev": "pkgroll --watch",
|
|
49
|
+
"test": "vitest run",
|
|
50
|
+
"test:watch": "vitest",
|
|
51
|
+
"type-check": "tsc --noEmit"
|
|
52
|
+
}
|
|
53
|
+
}
|