resuml 1.4.4 → 1.5.1
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/package.json +9 -2
- package/scripts/bundle-themes.js +47 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "resuml",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.1",
|
|
4
4
|
"description": "Generate JSON resumes from YAML with theme support",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/api.js",
|
|
@@ -23,9 +23,10 @@
|
|
|
23
23
|
],
|
|
24
24
|
"scripts": {
|
|
25
25
|
"build": "tsup && npm run build:builder",
|
|
26
|
+
"build:lib": "tsup",
|
|
26
27
|
"build:builder": "node scripts/build-builder.js",
|
|
27
28
|
"dev:builder": "node scripts/dev-server.js",
|
|
28
|
-
"prepublishOnly": "npm run generate:types && npm run build",
|
|
29
|
+
"prepublishOnly": "npm run generate:types && npm run build:lib",
|
|
29
30
|
"generate:types": "node scripts/generate-types.cjs",
|
|
30
31
|
"test": "vitest run",
|
|
31
32
|
"test:watch": "vitest",
|
|
@@ -43,6 +44,12 @@
|
|
|
43
44
|
"chalk": "^5.3.0",
|
|
44
45
|
"commander": "^11.1.0",
|
|
45
46
|
"js-yaml": "^4.1.0",
|
|
47
|
+
"jsonresume-theme-actual": "^0.2.2",
|
|
48
|
+
"jsonresume-theme-elegant": "^1.16.1",
|
|
49
|
+
"jsonresume-theme-even": "^0.26.1",
|
|
50
|
+
"jsonresume-theme-kendall": "^0.2.0",
|
|
51
|
+
"jsonresume-theme-paper": "^0.5.0",
|
|
52
|
+
"jsonresume-theme-react": "^1.0.4",
|
|
46
53
|
"jsonresume-theme-stackoverflow": "^2.1.0",
|
|
47
54
|
"lodash.merge": "^4.6.2",
|
|
48
55
|
"lucide-react": "^1.7.0",
|
package/scripts/bundle-themes.js
CHANGED
|
@@ -83,9 +83,10 @@ async function discoverThemes() {
|
|
|
83
83
|
|
|
84
84
|
async function bundleTheme(shortName, packageName) {
|
|
85
85
|
const entryContent = `
|
|
86
|
-
import
|
|
87
|
-
|
|
88
|
-
export const
|
|
86
|
+
import * as themeNs from '${packageName}';
|
|
87
|
+
const _t = themeNs.default ?? themeNs;
|
|
88
|
+
export const render = _t.render ?? themeNs.render;
|
|
89
|
+
export const pdfRenderOptions = _t.pdfRenderOptions ?? themeNs.pdfRenderOptions;
|
|
89
90
|
`;
|
|
90
91
|
|
|
91
92
|
const entryFile = resolve(THEMES_DIR, `_entry_${shortName}.js`);
|
|
@@ -99,15 +100,31 @@ async function bundleTheme(shortName, packageName) {
|
|
|
99
100
|
format: 'esm',
|
|
100
101
|
target: 'es2022',
|
|
101
102
|
platform: 'browser',
|
|
103
|
+
// Use 'require' condition so packages like underscore/lodash resolve to their
|
|
104
|
+
// CJS/UMD builds (which export a callable function) instead of their ESM builds
|
|
105
|
+
// (which export a namespace object that breaks _(collection) call syntax).
|
|
106
|
+
conditions: ['browser', 'require', 'default'],
|
|
107
|
+
// Prefer the CJS 'main' field over the ESM 'module' field for packages
|
|
108
|
+
// that don't use the exports map (older packages).
|
|
109
|
+
mainFields: ['browser', 'main'],
|
|
102
110
|
outfile: resolve(THEMES_DIR, `${shortName}.js`),
|
|
103
111
|
define: {
|
|
104
112
|
'process.env.NODE_ENV': '"production"',
|
|
105
113
|
'global': 'globalThis',
|
|
114
|
+
'__dirname': '"/"',
|
|
115
|
+
'__filename': '"/index.js"',
|
|
116
|
+
'process.browser': 'true',
|
|
117
|
+
'process.platform': '"browser"',
|
|
118
|
+
'process.version': '"v18.0.0"',
|
|
106
119
|
},
|
|
107
120
|
// Polyfill Node.js built-ins as no-ops for browser
|
|
108
121
|
alias: {
|
|
109
122
|
'path': resolve(__dirname, 'shims/path.js'),
|
|
110
123
|
'fs': resolve(__dirname, 'shims/fs.js'),
|
|
124
|
+
'url': resolve(__dirname, 'shims/url.js'),
|
|
125
|
+
'node:url': resolve(__dirname, 'shims/url.js'),
|
|
126
|
+
'node:crypto': resolve(__dirname, 'shims/crypto.js'),
|
|
127
|
+
'assert': resolve(__dirname, 'shims/assert.js'),
|
|
111
128
|
},
|
|
112
129
|
logLevel: 'silent',
|
|
113
130
|
});
|
|
@@ -145,6 +162,31 @@ async function main() {
|
|
|
145
162
|
export const existsSync = () => false;
|
|
146
163
|
export default { readFileSync, existsSync };
|
|
147
164
|
`);
|
|
165
|
+
writeFileSync(resolve(shimsDir, 'url.js'), `
|
|
166
|
+
export const URL = globalThis.URL;
|
|
167
|
+
export const URLSearchParams = globalThis.URLSearchParams;
|
|
168
|
+
export const fileURLToPath = (u) => u.replace(/^file:\\/\\//, '');
|
|
169
|
+
export const pathToFileURL = (p) => new globalThis.URL('file://' + p);
|
|
170
|
+
export const format = (u) => (typeof u === 'string' ? u : u.href);
|
|
171
|
+
export const parse = (u) => new globalThis.URL(u);
|
|
172
|
+
export default { URL, URLSearchParams, fileURLToPath, pathToFileURL, format, parse };
|
|
173
|
+
`);
|
|
174
|
+
writeFileSync(resolve(shimsDir, 'crypto.js'), `
|
|
175
|
+
export const createHash = () => ({ update: function() { return this; }, digest: () => '' });
|
|
176
|
+
export const randomBytes = (n) => new Uint8Array(n);
|
|
177
|
+
export const createHmac = () => ({ update: function() { return this; }, digest: () => '' });
|
|
178
|
+
export default { createHash, randomBytes, createHmac };
|
|
179
|
+
`);
|
|
180
|
+
writeFileSync(resolve(shimsDir, 'assert.js'), `
|
|
181
|
+
const assert = (v, msg) => { if (!v) throw new Error(msg || 'Assertion failed'); };
|
|
182
|
+
assert.ok = assert;
|
|
183
|
+
assert.strictEqual = (a, b) => { if (a !== b) throw new Error('Not equal'); };
|
|
184
|
+
assert.deepStrictEqual = () => {};
|
|
185
|
+
assert.fail = (msg) => { throw new Error(msg); };
|
|
186
|
+
export default assert;
|
|
187
|
+
export const ok = assert;
|
|
188
|
+
export const strictEqual = assert.strictEqual;
|
|
189
|
+
`);
|
|
148
190
|
|
|
149
191
|
let themes;
|
|
150
192
|
if (specificThemes) {
|
|
@@ -203,6 +245,7 @@ async function main() {
|
|
|
203
245
|
name: theme.name,
|
|
204
246
|
displayName: theme.name.charAt(0).toUpperCase() + theme.name.slice(1).replace(/-/g, ' '),
|
|
205
247
|
description: theme.description,
|
|
248
|
+
version: theme.version || '',
|
|
206
249
|
browserCompatible: true,
|
|
207
250
|
fileSize: stat,
|
|
208
251
|
});
|
|
@@ -212,6 +255,7 @@ async function main() {
|
|
|
212
255
|
name: theme.name,
|
|
213
256
|
displayName: theme.name.charAt(0).toUpperCase() + theme.name.slice(1).replace(/-/g, ' '),
|
|
214
257
|
description: theme.description,
|
|
258
|
+
version: theme.version || '',
|
|
215
259
|
browserCompatible: false,
|
|
216
260
|
fileSize: 0,
|
|
217
261
|
});
|