@razorwind/vsce 0.0.6 → 0.0.8
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.cjs +46 -13
- package/dist/index.d.cts +24 -17
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +24 -17
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +46 -13
- package/package.json +7 -8
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,41 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});let e=require("@razorwind/core/plugin"),t=require("@razorwind/core/utils"),n=require("node:path");
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});let e=require("@razorwind/core/plugin"),t=require("@razorwind/core/utils"),n=require("node:path");function r(e){let t=e.themes.map(e=>`- \`${e.path}\` — ${e.label}`).join(`
|
|
2
|
+
`),n=e.themes.map(e=>`- **${e.label}**`).join(`
|
|
3
|
+
`),r=`./dist/${e.extensionName}.vsix`,i=e.includeScripts?`
|
|
4
|
+
## Package VSIX
|
|
5
|
+
|
|
6
|
+
From the generated extension directory:
|
|
7
|
+
|
|
8
|
+
\`\`\`bash
|
|
9
|
+
pnpm package-vsix
|
|
10
|
+
\`\`\`
|
|
11
|
+
|
|
12
|
+
This writes \`${r}\`.
|
|
13
|
+
|
|
14
|
+
## Install from VSIX
|
|
15
|
+
|
|
16
|
+
1. Open the Extensions view (\`Ctrl+Shift+X\` / \`Cmd+Shift+X\`)
|
|
17
|
+
2. Open the **⋯** menu → **Install from VSIX...**
|
|
18
|
+
3. Select \`${r}\`
|
|
19
|
+
`:`
|
|
20
|
+
## Install locally
|
|
21
|
+
|
|
22
|
+
Open this folder in VS Code / Cursor and press **F5** to launch an Extension Development Host, or copy \`themes/*.json\` into a local extension package.
|
|
23
|
+
`;return`# Installing ${e.displayName}
|
|
24
|
+
|
|
25
|
+
Generated by \`@razorwind/vsce\`.
|
|
26
|
+
|
|
27
|
+
## Files
|
|
28
|
+
|
|
29
|
+
- \`package.json\` — extension manifest (\`contributes.themes\`)
|
|
30
|
+
- \`themes/*.json\` — color theme documents
|
|
31
|
+
${t}
|
|
32
|
+
${i}
|
|
33
|
+
## Select theme
|
|
34
|
+
|
|
35
|
+
Open the Command Palette (\`Ctrl+Shift+P\` / \`Cmd+Shift+P\`) → **Preferences: Color Theme** → choose:
|
|
36
|
+
|
|
37
|
+
${n}
|
|
38
|
+
`}function i(e){return`import { existsSync, readFileSync, renameSync, writeFileSync } from "node:fs";
|
|
2
39
|
import { dirname, join } from "node:path";
|
|
3
40
|
import { fileURLToPath } from "node:url";
|
|
4
41
|
|
|
@@ -62,7 +99,7 @@ export function withVsixPackageShim(action: () => void): void {
|
|
|
62
99
|
console.log(\`\\nRestored package name: \${originalName}\`);
|
|
63
100
|
}
|
|
64
101
|
}
|
|
65
|
-
`}function
|
|
102
|
+
`}function a(){return`import { execFileSync } from "node:child_process";
|
|
66
103
|
import { mkdirSync } from "node:fs";
|
|
67
104
|
import { join } from "node:path";
|
|
68
105
|
import { packageRoot, withVsixPackageShim } from "./vsixPackageShim.ts";
|
|
@@ -86,7 +123,7 @@ withVsixPackageShim(() => {
|
|
|
86
123
|
}
|
|
87
124
|
);
|
|
88
125
|
});
|
|
89
|
-
`}function
|
|
126
|
+
`}function o(){return`import { execFileSync } from "node:child_process";
|
|
90
127
|
import { packageRoot, withVsixPackageShim } from "./vsixPackageShim.ts";
|
|
91
128
|
|
|
92
129
|
// Manual VS Marketplace publish. Requires VSCE_PAT in the environment.
|
|
@@ -103,7 +140,7 @@ withVsixPackageShim(() => {
|
|
|
103
140
|
stdio: "inherit"
|
|
104
141
|
});
|
|
105
142
|
});
|
|
106
|
-
`}function
|
|
143
|
+
`}function s(){return`import { execFileSync } from "node:child_process";
|
|
107
144
|
import { packageRoot, withVsixPackageShim } from "./vsixPackageShim.ts";
|
|
108
145
|
|
|
109
146
|
// Manual Open VSX publish. Requires OVSX_PAT in the environment.
|
|
@@ -120,22 +157,17 @@ withVsixPackageShim(() => {
|
|
|
120
157
|
stdio: "inherit"
|
|
121
158
|
});
|
|
122
159
|
});
|
|
123
|
-
`}function
|
|
160
|
+
`}function c(e){let t=e.themes.map(e=>`- ${e.label}`).join(`
|
|
124
161
|
`),n=e.repositoryUrl?`\n## Links\n\n- [GitHub](${e.repositoryUrl})\n`:``;return`# ${e.displayName}
|
|
125
162
|
|
|
126
163
|
${e.description}
|
|
127
164
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
1. Open the Extensions view (\`Cmd+Shift+X\` / \`Ctrl+Shift+X\`)
|
|
131
|
-
2. Search for **${e.displayName}**
|
|
132
|
-
3. Click **Install**
|
|
133
|
-
4. Open the Command Palette (\`Cmd+Shift+P\` / \`Ctrl+Shift+P\`) → **Color Theme** → select a theme
|
|
165
|
+
See **INSTALL.md** for VS Code extension install steps (VSIX or Extension Development Host).
|
|
134
166
|
|
|
135
167
|
## Themes
|
|
136
168
|
|
|
137
169
|
${t||`- (generated themes)`}
|
|
138
|
-
${n}`}function
|
|
170
|
+
${n}`}function l(){return`node_modules/**
|
|
139
171
|
src/**
|
|
140
172
|
scripts/**
|
|
141
173
|
test/**
|
|
@@ -148,5 +180,6 @@ tests/**
|
|
|
148
180
|
*.vsix
|
|
149
181
|
artifacts/**
|
|
150
182
|
README.md.bak
|
|
183
|
+
INSTALL.md
|
|
151
184
|
.DS_Store
|
|
152
|
-
`}const
|
|
185
|
+
`}const u={name:`razorwind-vsce`},d={vscode:`^1.85.0`};function f(e,n,r){return(0,t.createDocument)(e,n,u,r)}function p(e){switch(e){case`light`:return`vs`;case`hc`:return`hc-black`;case`hcLight`:return`hc-light`;case`dark`:return`vs-dark`;default:return`vs-dark`}}function m(e){return(0,t.isObject)(e)&&typeof e.name==`string`&&(e.type===`light`||e.type===`dark`||e.type===`hc`||e.type===`hcLight`)}function h(e){if(Array.isArray(e))return e.map((e,t)=>{if(!m(e))throw TypeError(`@razorwind/vsce mapTheme()[${t}] must be a VsCodeTheme with name + type`);return e});if(m(e))return[e];if(!(0,t.isObject)(e))throw TypeError(`@razorwind/vsce mapTheme() must return a theme, theme array, or theme record`);return Object.entries(e).map(([e,t])=>{if(!m(t))throw TypeError(`@razorwind/vsce mapTheme()["${e}"] must be a VsCodeTheme with name + type`);return{...t,name:t.name||e}})}function g(e){if(typeof e==`string`)return e;if(e&&typeof e.url==`string`)return e.url}function _(e){if(!e.mapTheme)throw Error(`@razorwind/vsce requires options.mapTheme`);if(!e.name||e.name.includes(`/`))throw Error(`@razorwind/vsce requires options.name (unscoped Marketplace id)`);if(!e.publisher)throw Error(`@razorwind/vsce requires options.publisher`)}function v(e){return e===`light`||e===`hcLight`?`light`:`dark`}function y(e){let t={name:e.name,type:v(e.type),colors:e.colors??{}};return e.displayName&&(t.displayName=e.displayName),e.tokenColors&&(t.tokenColors=e.tokenColors),e.semanticHighlighting!==void 0&&(t.semanticHighlighting=e.semanticHighlighting),e.semanticTokenColors&&(t.semanticTokenColors=e.semanticTokenColors),`${JSON.stringify(t,null,2)}\n`}function b(e,n){let r=e.includeScripts!==!1,i=e.displayName??(0,t.titleCase)(e.name),a=e.description??`${i} — VS Code themes generated by Razorwind`,o={themes:n.map(e=>({label:e.displayName??e.name,uiTheme:p(e.type),path:`./themes/${(0,t.slugifyThemeName)(e.name)}.json`}))},s=r?{"package-vsix":`node --import tsx scripts/buildVsCodePackage.ts`,"publish-vsce":`node --import tsx scripts/publishVsce.ts`,"publish-ovsx":`node --import tsx scripts/publishOvsx.ts`}:void 0,c={name:e.name,displayName:i,description:a,version:e.version??`0.0.1`,publisher:e.publisher,license:e.license??`Apache-2.0`,categories:e.categories??[`Themes`],engines:e.engines??{...d},contributes:o,...e.keywords?{keywords:e.keywords}:{},...e.repository?{repository:e.repository}:{},...e.homepage?{homepage:e.homepage}:{},...e.bugs?{bugs:e.bugs}:{},...e.author?{author:e.author}:{},...e.icon?{icon:e.icon}:{},...e.galleryBanner?{galleryBanner:e.galleryBanner}:{},...s?{scripts:s}:{},...e.packageJson??{}};return c.name=e.name,c.publisher=e.publisher,c.contributes=o,s&&(c.scripts=(0,t.isObject)(c.scripts)&&!Array.isArray(c.scripts)?{...c.scripts,...s}:s),`${JSON.stringify(c,null,2)}\n`}function x(e,u){_(u);let d=u.outputPath??`vscode-extension`,p=u.includeScripts!==!1,m=u.extensionName??u.name,v=u.displayName??(0,t.titleCase)(u.name),x=u.description??`${v} — VS Code themes generated by Razorwind`,S=h(u.mapTheme(e.tokens));if(S.length===0)throw Error(`@razorwind/vsce mapTheme() returned no themes`);let C={};for(let e of S){let r=`${(0,t.slugifyThemeName)(e.name)}.json`,i=(0,n.join)(d,`themes`,r);C[i]=f(i,y(e),`json`)}let w=(0,n.join)(d,`package.json`);C[w]=f(w,b(u,S),`json`);let T=(0,n.join)(d,`.vscodeignore`);C[T]=f(T,l(),`ignore`);let E=S.map(e=>({label:e.displayName??e.name,path:`./themes/${(0,t.slugifyThemeName)(e.name)}.json`})),D=u.readme??c({displayName:v,description:x,themes:E,repositoryUrl:g(u.repository)}),O=(0,n.join)(d,`README.md`);C[O]=f(O,D,`markdown`);let k=u.installGuide??r({displayName:v,extensionName:m,themes:E,includeScripts:p}),A=(0,n.join)(d,`INSTALL.md`);if(C[A]=f(A,k,`markdown`),p){let e=(0,n.join)(d,`scripts`,`vsixPackageShim.ts`);C[e]=f(e,i(m),`typescript`);let t=(0,n.join)(d,`scripts`,`buildVsCodePackage.ts`);C[t]=f(t,a(),`typescript`);let r=(0,n.join)(d,`scripts`,`publishVsce.ts`);C[r]=f(r,o(),`typescript`);let l=(0,n.join)(d,`scripts`,`publishOvsx.ts`);C[l]=f(l,s(),`typescript`);let p=(0,n.join)(d,`scripts`,`README.package.md`);C[p]=f(p,c({displayName:v,description:x,themes:E,repositoryUrl:g(u.repository)}),`markdown`)}return C}var S=(0,e.definePlugin)(e=>({name:`vsce`,generate:async t=>{if(!e)throw Error(`@razorwind/vsce requires options: { name, publisher, mapTheme }`);return x(t,e)}}));exports.default=S,Object.defineProperty(exports,"flattenTokens",{enumerable:!0,get:function(){return t.flattenTokens}}),Object.defineProperty(exports,"formatTokenValue",{enumerable:!0,get:function(){return t.formatTokenValue}}),exports.generateVsceExtension=x,exports.normalizeThemes=h,exports.renderInstallMd=r,exports.renderPackageJson=b,exports.renderThemeJson=y,Object.defineProperty(exports,"resolveTokenSets",{enumerable:!0,get:function(){return t.resolveTokenSets}}),Object.defineProperty(exports,"toCssVar",{enumerable:!0,get:function(){return t.toCssVar}});
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,23 @@
|
|
|
1
|
+
import { flattenTokens, formatTokenValue, resolveTokenSets, toCssVar } from "@razorwind/core/utils";
|
|
2
|
+
import { GeneratorFunctionResult } from "@power-plant/core";
|
|
1
3
|
import { Schema, Tokens } from "@razorwind/core/schema";
|
|
2
4
|
import { TokenType } from "@power-plant/dtcg-schema";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
+
//#region src/install.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* VS Code extension INSTALL.md for generated theme packages.
|
|
8
|
+
*
|
|
9
|
+
* @see https://code.visualstudio.com/api/extension-guides/color-theme
|
|
10
|
+
*/
|
|
11
|
+
declare function renderInstallMd(options: {
|
|
12
|
+
displayName: string;
|
|
13
|
+
extensionName: string;
|
|
14
|
+
themes: Array<{
|
|
15
|
+
label: string;
|
|
16
|
+
path: string;
|
|
17
|
+
}>;
|
|
18
|
+
includeScripts: boolean;
|
|
19
|
+
}): string;
|
|
20
|
+
//#endregion
|
|
5
21
|
//#region src/types.d.ts
|
|
6
22
|
/**
|
|
7
23
|
* A flattened design token ready for VS Code theme mapping.
|
|
@@ -170,22 +186,13 @@ interface VscePluginOptions {
|
|
|
170
186
|
* (shallow merge; `contributes.themes` / `scripts` from the plugin win).
|
|
171
187
|
*/
|
|
172
188
|
packageJson?: Record<string, unknown>;
|
|
189
|
+
/**
|
|
190
|
+
* Override body for generated `INSTALL.md`. When omitted, VS Code extension
|
|
191
|
+
* install steps are generated from contributed themes.
|
|
192
|
+
*/
|
|
193
|
+
installGuide?: string;
|
|
173
194
|
}
|
|
174
195
|
//#endregion
|
|
175
|
-
//#region src/flatten.d.ts
|
|
176
|
-
interface TokenSet {
|
|
177
|
-
id: string;
|
|
178
|
-
tokens: Tokens;
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
* Split `Schema.tokens` into one or more named token sets.
|
|
182
|
-
*/
|
|
183
|
-
declare function resolveTokenSets(tokens: Tokens | Record<string, Tokens>): TokenSet[];
|
|
184
|
-
/**
|
|
185
|
-
* Flatten DTCG token trees into rows helpful for {@link VscePluginOptions.mapTheme}.
|
|
186
|
-
*/
|
|
187
|
-
declare function flattenTokens(tokens: Tokens | Record<string, Tokens>, options?: Pick<VscePluginOptions, "includeTypes">): FlatToken[];
|
|
188
|
-
//#endregion
|
|
189
196
|
//#region src/generate.d.ts
|
|
190
197
|
/**
|
|
191
198
|
* Normalize {@link VscePluginOptions.mapTheme} results into a theme list.
|
|
@@ -257,5 +264,5 @@ declare function generateVsceExtension(spec: Schema, options: VscePluginOptions)
|
|
|
257
264
|
*/
|
|
258
265
|
declare const _default: (options?: VscePluginOptions | undefined) => import("@razorwind/core/plugin").Plugin;
|
|
259
266
|
//#endregion
|
|
260
|
-
export { type FlatToken, type GenerateVsCodeTheme, type VsCodeTheme, type VsCodeTokenColor, type VscePluginOptions, _default as default, flattenTokens, formatTokenValue, generateVsceExtension, normalizeThemes, renderPackageJson, renderThemeJson, resolveTokenSets, toCssVar };
|
|
267
|
+
export { type FlatToken, type GenerateVsCodeTheme, type VsCodeTheme, type VsCodeTokenColor, type VscePluginOptions, _default as default, flattenTokens, formatTokenValue, generateVsceExtension, normalizeThemes, renderInstallMd, renderPackageJson, renderThemeJson, resolveTokenSets, toCssVar };
|
|
261
268
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/install.ts","../src/types.ts","../src/generate.ts","../src/index.ts"],"mappings":";;;;;;;;;;iBAuBgB,gBAAgB;EAC9B;EACA;EACA,QAAQ;IAAQ;IAAe;;EAC/B;;;;;;;UCHe;;EAEf;;EAEA,OAAO;;EAEP;;EAEA;;EAEA;;EAEA;;;;;;;UAQe;EACf;EACA;EACA;IACE;IACA;IACA;;;;;;;;UASa;;EAEf;;EAEA;;EAEA;EACA,SAAS;EACT,cAAc;EACd;EACA,sBAAsB;IAET;IAAqB;IAAoB;;;;;;;;KAS5C,uBACV,QAAQ,SAAS,eAAe,YAC7B,cAAc,gBAAgB,eAAe;;;;KAKtC;EAGN;EACA;EACA;;;;;;;;UASW;;;;;;;EAOf;;;;;;EAOA,UAAU;;;;;EAMV;;EAGA;;EAGA;;;;;;EAOA;;EAGA;;;;;EAMA;;;;EAKA;EAEA;IAGM;IACA;IACA;;EAGN;EAEA;IAGM;IACA;;EAGN,SAAS;;;;;EAMT;EAEA;IACE;IACA;;;;;EAMF;EAEA;;;;EAKA;IACE;;;;;;;;;;EAWF;;;;;EAMA;;;;;EAMA,eAAe;;;;;EAMf,cAAc;;;;;EAMd;;;;;;;iBCjJc,gBACd,QAAQ,cAAc,gBAAgB,eAAe,eACpD;iBA0Ea,gBAAgB,OAAO;;;;iBA0BvB,kBACd,SAAS,mBACT,QAAQ;;;;iBAiEM,sBACd,MAAM,QACN,SAAS,oBACR,wBAAwB,QAAQ"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,23 @@
|
|
|
1
|
-
import { formatTokenValue, toCssVar } from "@razorwind/core/utils";
|
|
1
|
+
import { flattenTokens, formatTokenValue, resolveTokenSets, toCssVar } from "@razorwind/core/utils";
|
|
2
|
+
import { GeneratorFunctionResult } from "@power-plant/core";
|
|
2
3
|
import { Schema, Tokens } from "@razorwind/core/schema";
|
|
3
4
|
import { TokenType } from "@power-plant/dtcg-schema";
|
|
4
|
-
|
|
5
|
+
//#region src/install.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* VS Code extension INSTALL.md for generated theme packages.
|
|
8
|
+
*
|
|
9
|
+
* @see https://code.visualstudio.com/api/extension-guides/color-theme
|
|
10
|
+
*/
|
|
11
|
+
declare function renderInstallMd(options: {
|
|
12
|
+
displayName: string;
|
|
13
|
+
extensionName: string;
|
|
14
|
+
themes: Array<{
|
|
15
|
+
label: string;
|
|
16
|
+
path: string;
|
|
17
|
+
}>;
|
|
18
|
+
includeScripts: boolean;
|
|
19
|
+
}): string;
|
|
20
|
+
//#endregion
|
|
5
21
|
//#region src/types.d.ts
|
|
6
22
|
/**
|
|
7
23
|
* A flattened design token ready for VS Code theme mapping.
|
|
@@ -170,22 +186,13 @@ interface VscePluginOptions {
|
|
|
170
186
|
* (shallow merge; `contributes.themes` / `scripts` from the plugin win).
|
|
171
187
|
*/
|
|
172
188
|
packageJson?: Record<string, unknown>;
|
|
189
|
+
/**
|
|
190
|
+
* Override body for generated `INSTALL.md`. When omitted, VS Code extension
|
|
191
|
+
* install steps are generated from contributed themes.
|
|
192
|
+
*/
|
|
193
|
+
installGuide?: string;
|
|
173
194
|
}
|
|
174
195
|
//#endregion
|
|
175
|
-
//#region src/flatten.d.ts
|
|
176
|
-
interface TokenSet {
|
|
177
|
-
id: string;
|
|
178
|
-
tokens: Tokens;
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
* Split `Schema.tokens` into one or more named token sets.
|
|
182
|
-
*/
|
|
183
|
-
declare function resolveTokenSets(tokens: Tokens | Record<string, Tokens>): TokenSet[];
|
|
184
|
-
/**
|
|
185
|
-
* Flatten DTCG token trees into rows helpful for {@link VscePluginOptions.mapTheme}.
|
|
186
|
-
*/
|
|
187
|
-
declare function flattenTokens(tokens: Tokens | Record<string, Tokens>, options?: Pick<VscePluginOptions, "includeTypes">): FlatToken[];
|
|
188
|
-
//#endregion
|
|
189
196
|
//#region src/generate.d.ts
|
|
190
197
|
/**
|
|
191
198
|
* Normalize {@link VscePluginOptions.mapTheme} results into a theme list.
|
|
@@ -257,5 +264,5 @@ declare function generateVsceExtension(spec: Schema, options: VscePluginOptions)
|
|
|
257
264
|
*/
|
|
258
265
|
declare const _default: (options?: VscePluginOptions | undefined) => import("@razorwind/core/plugin").Plugin;
|
|
259
266
|
//#endregion
|
|
260
|
-
export { type FlatToken, type GenerateVsCodeTheme, type VsCodeTheme, type VsCodeTokenColor, type VscePluginOptions, _default as default, flattenTokens, formatTokenValue, generateVsceExtension, normalizeThemes, renderPackageJson, renderThemeJson, resolveTokenSets, toCssVar };
|
|
267
|
+
export { type FlatToken, type GenerateVsCodeTheme, type VsCodeTheme, type VsCodeTokenColor, type VscePluginOptions, _default as default, flattenTokens, formatTokenValue, generateVsceExtension, normalizeThemes, renderInstallMd, renderPackageJson, renderThemeJson, resolveTokenSets, toCssVar };
|
|
261
268
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/install.ts","../src/types.ts","../src/generate.ts","../src/index.ts"],"mappings":""}
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,41 @@
|
|
|
1
|
-
import{definePlugin as e}from"@razorwind/core/plugin";import{createDocument as t,
|
|
1
|
+
import{definePlugin as e}from"@razorwind/core/plugin";import{createDocument as t,flattenTokens as n,formatTokenValue as r,isObject as i,resolveTokenSets as a,slugifyThemeName as o,titleCase as s,toCssVar as c}from"@razorwind/core/utils";import{join as l}from"node:path";function u(e){let t=e.themes.map(e=>`- \`${e.path}\` — ${e.label}`).join(`
|
|
2
|
+
`),n=e.themes.map(e=>`- **${e.label}**`).join(`
|
|
3
|
+
`),r=`./dist/${e.extensionName}.vsix`,i=e.includeScripts?`
|
|
4
|
+
## Package VSIX
|
|
5
|
+
|
|
6
|
+
From the generated extension directory:
|
|
7
|
+
|
|
8
|
+
\`\`\`bash
|
|
9
|
+
pnpm package-vsix
|
|
10
|
+
\`\`\`
|
|
11
|
+
|
|
12
|
+
This writes \`${r}\`.
|
|
13
|
+
|
|
14
|
+
## Install from VSIX
|
|
15
|
+
|
|
16
|
+
1. Open the Extensions view (\`Ctrl+Shift+X\` / \`Cmd+Shift+X\`)
|
|
17
|
+
2. Open the **⋯** menu → **Install from VSIX...**
|
|
18
|
+
3. Select \`${r}\`
|
|
19
|
+
`:`
|
|
20
|
+
## Install locally
|
|
21
|
+
|
|
22
|
+
Open this folder in VS Code / Cursor and press **F5** to launch an Extension Development Host, or copy \`themes/*.json\` into a local extension package.
|
|
23
|
+
`;return`# Installing ${e.displayName}
|
|
24
|
+
|
|
25
|
+
Generated by \`@razorwind/vsce\`.
|
|
26
|
+
|
|
27
|
+
## Files
|
|
28
|
+
|
|
29
|
+
- \`package.json\` — extension manifest (\`contributes.themes\`)
|
|
30
|
+
- \`themes/*.json\` — color theme documents
|
|
31
|
+
${t}
|
|
32
|
+
${i}
|
|
33
|
+
## Select theme
|
|
34
|
+
|
|
35
|
+
Open the Command Palette (\`Ctrl+Shift+P\` / \`Cmd+Shift+P\`) → **Preferences: Color Theme** → choose:
|
|
36
|
+
|
|
37
|
+
${n}
|
|
38
|
+
`}function d(e){return`import { existsSync, readFileSync, renameSync, writeFileSync } from "node:fs";
|
|
2
39
|
import { dirname, join } from "node:path";
|
|
3
40
|
import { fileURLToPath } from "node:url";
|
|
4
41
|
|
|
@@ -62,7 +99,7 @@ export function withVsixPackageShim(action: () => void): void {
|
|
|
62
99
|
console.log(\`\\nRestored package name: \${originalName}\`);
|
|
63
100
|
}
|
|
64
101
|
}
|
|
65
|
-
`}function
|
|
102
|
+
`}function f(){return`import { execFileSync } from "node:child_process";
|
|
66
103
|
import { mkdirSync } from "node:fs";
|
|
67
104
|
import { join } from "node:path";
|
|
68
105
|
import { packageRoot, withVsixPackageShim } from "./vsixPackageShim.ts";
|
|
@@ -86,7 +123,7 @@ withVsixPackageShim(() => {
|
|
|
86
123
|
}
|
|
87
124
|
);
|
|
88
125
|
});
|
|
89
|
-
`}function
|
|
126
|
+
`}function p(){return`import { execFileSync } from "node:child_process";
|
|
90
127
|
import { packageRoot, withVsixPackageShim } from "./vsixPackageShim.ts";
|
|
91
128
|
|
|
92
129
|
// Manual VS Marketplace publish. Requires VSCE_PAT in the environment.
|
|
@@ -103,7 +140,7 @@ withVsixPackageShim(() => {
|
|
|
103
140
|
stdio: "inherit"
|
|
104
141
|
});
|
|
105
142
|
});
|
|
106
|
-
`}function
|
|
143
|
+
`}function m(){return`import { execFileSync } from "node:child_process";
|
|
107
144
|
import { packageRoot, withVsixPackageShim } from "./vsixPackageShim.ts";
|
|
108
145
|
|
|
109
146
|
// Manual Open VSX publish. Requires OVSX_PAT in the environment.
|
|
@@ -120,22 +157,17 @@ withVsixPackageShim(() => {
|
|
|
120
157
|
stdio: "inherit"
|
|
121
158
|
});
|
|
122
159
|
});
|
|
123
|
-
`}function
|
|
160
|
+
`}function h(e){let t=e.themes.map(e=>`- ${e.label}`).join(`
|
|
124
161
|
`),n=e.repositoryUrl?`\n## Links\n\n- [GitHub](${e.repositoryUrl})\n`:``;return`# ${e.displayName}
|
|
125
162
|
|
|
126
163
|
${e.description}
|
|
127
164
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
1. Open the Extensions view (\`Cmd+Shift+X\` / \`Ctrl+Shift+X\`)
|
|
131
|
-
2. Search for **${e.displayName}**
|
|
132
|
-
3. Click **Install**
|
|
133
|
-
4. Open the Command Palette (\`Cmd+Shift+P\` / \`Ctrl+Shift+P\`) → **Color Theme** → select a theme
|
|
165
|
+
See **INSTALL.md** for VS Code extension install steps (VSIX or Extension Development Host).
|
|
134
166
|
|
|
135
167
|
## Themes
|
|
136
168
|
|
|
137
169
|
${t||`- (generated themes)`}
|
|
138
|
-
${n}`}function
|
|
170
|
+
${n}`}function g(){return`node_modules/**
|
|
139
171
|
src/**
|
|
140
172
|
scripts/**
|
|
141
173
|
test/**
|
|
@@ -148,6 +180,7 @@ tests/**
|
|
|
148
180
|
*.vsix
|
|
149
181
|
artifacts/**
|
|
150
182
|
README.md.bak
|
|
183
|
+
INSTALL.md
|
|
151
184
|
.DS_Store
|
|
152
|
-
`}const
|
|
185
|
+
`}const _={name:`razorwind-vsce`},v={vscode:`^1.85.0`};function y(e,n,r){return t(e,n,_,r)}function b(e){switch(e){case`light`:return`vs`;case`hc`:return`hc-black`;case`hcLight`:return`hc-light`;case`dark`:return`vs-dark`;default:return`vs-dark`}}function x(e){return i(e)&&typeof e.name==`string`&&(e.type===`light`||e.type===`dark`||e.type===`hc`||e.type===`hcLight`)}function S(e){if(Array.isArray(e))return e.map((e,t)=>{if(!x(e))throw TypeError(`@razorwind/vsce mapTheme()[${t}] must be a VsCodeTheme with name + type`);return e});if(x(e))return[e];if(!i(e))throw TypeError(`@razorwind/vsce mapTheme() must return a theme, theme array, or theme record`);return Object.entries(e).map(([e,t])=>{if(!x(t))throw TypeError(`@razorwind/vsce mapTheme()["${e}"] must be a VsCodeTheme with name + type`);return{...t,name:t.name||e}})}function C(e){if(typeof e==`string`)return e;if(e&&typeof e.url==`string`)return e.url}function w(e){if(!e.mapTheme)throw Error(`@razorwind/vsce requires options.mapTheme`);if(!e.name||e.name.includes(`/`))throw Error(`@razorwind/vsce requires options.name (unscoped Marketplace id)`);if(!e.publisher)throw Error(`@razorwind/vsce requires options.publisher`)}function T(e){return e===`light`||e===`hcLight`?`light`:`dark`}function E(e){let t={name:e.name,type:T(e.type),colors:e.colors??{}};return e.displayName&&(t.displayName=e.displayName),e.tokenColors&&(t.tokenColors=e.tokenColors),e.semanticHighlighting!==void 0&&(t.semanticHighlighting=e.semanticHighlighting),e.semanticTokenColors&&(t.semanticTokenColors=e.semanticTokenColors),`${JSON.stringify(t,null,2)}\n`}function D(e,t){let n=e.includeScripts!==!1,r=e.displayName??s(e.name),a=e.description??`${r} — VS Code themes generated by Razorwind`,c={themes:t.map(e=>({label:e.displayName??e.name,uiTheme:b(e.type),path:`./themes/${o(e.name)}.json`}))},l=n?{"package-vsix":`node --import tsx scripts/buildVsCodePackage.ts`,"publish-vsce":`node --import tsx scripts/publishVsce.ts`,"publish-ovsx":`node --import tsx scripts/publishOvsx.ts`}:void 0,u={name:e.name,displayName:r,description:a,version:e.version??`0.0.1`,publisher:e.publisher,license:e.license??`Apache-2.0`,categories:e.categories??[`Themes`],engines:e.engines??{...v},contributes:c,...e.keywords?{keywords:e.keywords}:{},...e.repository?{repository:e.repository}:{},...e.homepage?{homepage:e.homepage}:{},...e.bugs?{bugs:e.bugs}:{},...e.author?{author:e.author}:{},...e.icon?{icon:e.icon}:{},...e.galleryBanner?{galleryBanner:e.galleryBanner}:{},...l?{scripts:l}:{},...e.packageJson??{}};return u.name=e.name,u.publisher=e.publisher,u.contributes=c,l&&(u.scripts=i(u.scripts)&&!Array.isArray(u.scripts)?{...u.scripts,...l}:l),`${JSON.stringify(u,null,2)}\n`}function O(e,t){w(t);let n=t.outputPath??`vscode-extension`,r=t.includeScripts!==!1,i=t.extensionName??t.name,a=t.displayName??s(t.name),c=t.description??`${a} — VS Code themes generated by Razorwind`,_=S(t.mapTheme(e.tokens));if(_.length===0)throw Error(`@razorwind/vsce mapTheme() returned no themes`);let v={};for(let e of _){let t=`${o(e.name)}.json`,r=l(n,`themes`,t);v[r]=y(r,E(e),`json`)}let b=l(n,`package.json`);v[b]=y(b,D(t,_),`json`);let x=l(n,`.vscodeignore`);v[x]=y(x,g(),`ignore`);let T=_.map(e=>({label:e.displayName??e.name,path:`./themes/${o(e.name)}.json`})),O=t.readme??h({displayName:a,description:c,themes:T,repositoryUrl:C(t.repository)}),k=l(n,`README.md`);v[k]=y(k,O,`markdown`);let A=t.installGuide??u({displayName:a,extensionName:i,themes:T,includeScripts:r}),j=l(n,`INSTALL.md`);if(v[j]=y(j,A,`markdown`),r){let e=l(n,`scripts`,`vsixPackageShim.ts`);v[e]=y(e,d(i),`typescript`);let r=l(n,`scripts`,`buildVsCodePackage.ts`);v[r]=y(r,f(),`typescript`);let o=l(n,`scripts`,`publishVsce.ts`);v[o]=y(o,p(),`typescript`);let s=l(n,`scripts`,`publishOvsx.ts`);v[s]=y(s,m(),`typescript`);let u=l(n,`scripts`,`README.package.md`);v[u]=y(u,h({displayName:a,description:c,themes:T,repositoryUrl:C(t.repository)}),`markdown`)}return v}var k=e(e=>({name:`vsce`,generate:async t=>{if(!e)throw Error(`@razorwind/vsce requires options: { name, publisher, mapTheme }`);return O(t,e)}}));export{k as default,n as flattenTokens,r as formatTokenValue,O as generateVsceExtension,S as normalizeThemes,u as renderInstallMd,D as renderPackageJson,E as renderThemeJson,a as resolveTokenSets,c as toCssVar};
|
|
153
186
|
//# sourceMappingURL=index.mjs.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@razorwind/vsce",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Razorwind Visual Studio Code Extension plugin that creates theming extensions from design tokens.",
|
|
6
6
|
"repository": {
|
|
@@ -66,15 +66,14 @@
|
|
|
66
66
|
"types": "./dist/index.d.cts",
|
|
67
67
|
"typings": "dist/index.d.mts",
|
|
68
68
|
"dependencies": {
|
|
69
|
-
"@power-plant/core": "
|
|
70
|
-
"@power-plant/dtcg-schema": "
|
|
71
|
-
"@razorwind/core": "
|
|
69
|
+
"@power-plant/core": "catalog:",
|
|
70
|
+
"@power-plant/dtcg-schema": "catalog:",
|
|
71
|
+
"@razorwind/core": "workspace:*"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
|
-
"@powerlines/plugin-tsdown": "
|
|
75
|
-
"@types/node": "
|
|
74
|
+
"@powerlines/plugin-tsdown": "catalog:",
|
|
75
|
+
"@types/node": "catalog:",
|
|
76
76
|
"typescript": "^6.0.3"
|
|
77
77
|
},
|
|
78
|
-
"publishConfig": { "access": "public" }
|
|
79
|
-
"gitHead": "a861c6938501ed645ccdcd3970fc1164d110b4ed"
|
|
78
|
+
"publishConfig": { "access": "public" }
|
|
80
79
|
}
|