@ui-doc/vite 0.3.1 → 0.3.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.cjs CHANGED
@@ -85,48 +85,71 @@ picocolors.exports.createColors = createColors;
85
85
  var picocolorsExports = picocolors.exports;
86
86
  var pc = /*@__PURE__*/getDefaultExportFromCjs(picocolorsExports);
87
87
 
88
- var version = "0.3.1";
88
+ var version = "0.3.2";
89
89
 
90
- /* eslint-disable sort-keys */
91
90
  const PLUGIN_NAME = 'ui-doc';
91
+ /**
92
+ * Delay in milliseconds before logging server ready message.
93
+ * Allows Vite's own logging to complete first for cleaner output.
94
+ */
95
+ const SERVER_READY_LOG_DELAY_MS = 300;
96
+ /**
97
+ * Resolves plugin options with defaults.
98
+ * Returns a new object to avoid mutating the input.
99
+ */
92
100
  function resolveOptions(options) {
93
- var _a, _b;
94
- options.output = (_a = options.output) !== null && _a !== void 0 ? _a : {};
95
- options.output.dir = (_b = options.output.dir) !== null && _b !== void 0 ? _b : 'ui-doc';
96
- return options;
101
+ return {
102
+ ...options,
103
+ output: {
104
+ ...options.output,
105
+ dir: options.output?.dir ?? 'ui-doc',
106
+ },
107
+ };
97
108
  }
98
- function prepareServe(plugin) {
99
- var _a, _b, _c, _d;
100
- if ((_a = plugin.api) === null || _a === void 0 ? void 0 : _a.options.prefix.uri) {
101
- // replace resolveUrl to make sure that all urls (pages and assets) are generated correctly for vite server
102
- (_b = plugin.api) === null || _b === void 0 ? void 0 : _b.uidoc.replaceGenerate('resolve', (uri, type) => {
103
- var _a, _b;
109
+ function prepareServe(api) {
110
+ if (api.options.prefix.uri) {
111
+ // replace resolveUrl to make sure that all urls (pages and assets) are generated correctly
112
+ // for vite server
113
+ api.uidoc.replaceGenerate('resolve', (uri, type) => {
104
114
  // don't add prefix if asset is from vite
105
- return ['asset', 'asset-example'].includes(type) &&
106
- // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
107
- (((_a = plugin.api) === null || _a === void 0 ? void 0 : _a.isAssetFromInput(uri)) || uri.startsWith('@'))
115
+ return ['asset', 'asset-example'].includes(type) && (api.isAssetFromInput(uri) || uri.startsWith('@'))
108
116
  ? `/${uri}`
109
- : `/${(_b = plugin.api) === null || _b === void 0 ? void 0 : _b.options.prefix.uri}${uri}`;
117
+ : `/${api.options.prefix.uri}${uri}`;
110
118
  });
111
119
  }
112
120
  // register all assets to ui-doc
113
- (_c = plugin.api) === null || _c === void 0 ? void 0 : _c.options.assets.forEach(({ fileName, context, attrs, fromInput = false }) => {
114
- var _a;
115
- (_a = plugin.api) === null || _a === void 0 ? void 0 : _a.uidocAsset(fileName, context, { attrs, fromInput });
121
+ api.options.assets.forEach(({ fileName, context, attrs, fromInput = false }) => {
122
+ api.uidocAsset(fileName, context, { attrs, fromInput });
116
123
  });
117
124
  // add vite client script to ui-doc
118
- (_d = plugin.api) === null || _d === void 0 ? void 0 : _d.uidocAsset('@vite/client', 'page', { attrs: { type: 'module' }, type: 'script' });
125
+ api.uidocAsset('@vite/client', 'page', { attrs: { type: 'module' }, type: 'script' });
119
126
  }
127
+ /**
128
+ * Creates a UI-Doc Vite plugin for generating interactive UI documentation.
129
+ *
130
+ * @param rawOptions - Configuration options for the plugin
131
+ * @returns A configured Vite plugin instance
132
+ *
133
+ * @example
134
+ * ```ts
135
+ * import uidoc from '@ui-doc/vite'
136
+ *
137
+ * export default defineConfig({
138
+ * plugins: [uidoc({ source: 'src/**\/*.css' })]
139
+ * })
140
+ * ```
141
+ */
120
142
  async function uidocPlugin(rawOptions) {
121
143
  const options = resolveOptions(rawOptions);
122
144
  const plugin = (await createRollupPlugin(options));
123
145
  let serving = false;
124
146
  plugin.name = PLUGIN_NAME;
125
147
  plugin.version = version;
126
- if (!plugin.api) {
148
+ const api = plugin.api;
149
+ if (!api) {
127
150
  throw new Error('UI-Doc rollup plugin API is not available');
128
151
  }
129
- plugin.api.version = version;
152
+ api.version = version;
130
153
  plugin.onLog = (_level, log) => {
131
154
  // hide rollup output logs
132
155
  if (log.plugin === createRollupPlugin.PLUGIN_NAME && log.pluginCode === 'OUTPUT') {
@@ -143,41 +166,42 @@ async function uidocPlugin(rawOptions) {
143
166
  await orgBuildStart.call(this, inputOptions);
144
167
  }
145
168
  if (serving) {
146
- prepareServe(plugin);
169
+ prepareServe(api);
147
170
  }
148
171
  };
149
172
  plugin.generateBundle = async function (outputOptions, bundle, isWrite) {
150
- var _a;
151
173
  // find and set the correct file name for each asset
152
- (_a = plugin.api) === null || _a === void 0 ? void 0 : _a.options.assets.filter(asset => asset.fromInput).forEach(asset => {
153
- var _a, _b, _c;
174
+ api.options.assets
175
+ .filter(asset => asset.fromInput)
176
+ .forEach(asset => {
154
177
  const foundBundle = Object.values(bundle).find(({ name }) => name === asset.name);
155
178
  if (!foundBundle) {
156
179
  return;
157
180
  }
158
181
  // copy imported assets from vite into UI-Doc output
159
- if ((_a = foundBundle === null || foundBundle === void 0 ? void 0 : foundBundle.viteMetadata) === null || _a === void 0 ? void 0 : _a.importedAssets) {
182
+ if (foundBundle.viteMetadata?.importedAssets) {
160
183
  foundBundle.viteMetadata.importedAssets.forEach((importedAsset) => {
161
- var _a;
162
- (_a = plugin.api) === null || _a === void 0 ? void 0 : _a.addAssetFromInput(importedAsset);
184
+ api.addAssetFromInput(importedAsset);
163
185
  });
164
186
  }
165
187
  if (asset.type === 'script') {
166
- asset.fileName = foundBundle.fileName;
188
+ if (foundBundle.fileName !== undefined && foundBundle.fileName !== '') {
189
+ asset.fileName = foundBundle.fileName;
190
+ }
167
191
  // copy and register imported css files to ui-doc
168
- if ((_b = foundBundle === null || foundBundle === void 0 ? void 0 : foundBundle.viteMetadata) === null || _b === void 0 ? void 0 : _b.importedCss) {
192
+ if (foundBundle.viteMetadata?.importedCss) {
169
193
  foundBundle.viteMetadata.importedCss.forEach((imported) => {
170
- var _a, _b;
171
- (_a = plugin.api) === null || _a === void 0 ? void 0 : _a.addAssetFromInput(imported);
172
- (_b = plugin.api) === null || _b === void 0 ? void 0 : _b.uidocAsset(imported, asset.context, { type: 'style' });
194
+ api.addAssetFromInput(imported);
195
+ api.uidocAsset(imported, asset.context, { type: 'style' });
173
196
  });
174
197
  }
175
198
  return;
176
199
  }
177
- if (asset.type === 'style' &&
178
- ((_c = foundBundle === null || foundBundle === void 0 ? void 0 : foundBundle.viteMetadata) === null || _c === void 0 ? void 0 : _c.importedCss) &&
179
- foundBundle.viteMetadata.importedCss.size > 0) {
180
- asset.fileName = foundBundle.viteMetadata.importedCss.values().next().value;
200
+ if (asset.type === 'style'
201
+ && foundBundle.viteMetadata?.importedCss
202
+ && foundBundle.viteMetadata.importedCss.size > 0) {
203
+ const firstCss = foundBundle.viteMetadata.importedCss.values().next().value;
204
+ asset.fileName = firstCss;
181
205
  }
182
206
  });
183
207
  if (orgGenerateBundle) {
@@ -185,33 +209,26 @@ async function uidocPlugin(rawOptions) {
185
209
  }
186
210
  };
187
211
  plugin.configureServer = async function (server) {
188
- var _a, _b, _c, _d, _e, _f, _g;
189
- const uidoc = (_a = plugin.api) === null || _a === void 0 ? void 0 : _a.uidoc;
190
- const uriPrefix = (_b = plugin.api) === null || _b === void 0 ? void 0 : _b.options.prefix.uri;
191
- const assets = (_d = (_c = plugin.api) === null || _c === void 0 ? void 0 : _c.options.assets) !== null && _d !== void 0 ? _d : [];
192
- const staticAssets = (_f = (_e = plugin.api) === null || _e === void 0 ? void 0 : _e.options.staticAssets) !== null && _f !== void 0 ? _f : undefined;
193
- if (!uidoc) {
194
- throw new Error('UI-Doc API is not available');
195
- }
212
+ const uidoc = api.uidoc;
213
+ const uriPrefix = api.options.prefix.uri;
214
+ const assets = api.options.assets ?? [];
215
+ const staticAssets = api.options.staticAssets ?? undefined;
196
216
  if (!uriPrefix) {
197
217
  throw new Error('UI-Doc base url is not available. Please don\'t set "outputBaseUri" to "." in dev mode.');
198
218
  }
219
+ const regexIndex = new RegExp(`^/${uriPrefix}?$`);
199
220
  const regexPage = new RegExp(`^/${uriPrefix}([a-z0-9_\\-]+).html$`);
200
221
  const regexExample = new RegExp(`^/${uriPrefix}examples/([a-z0-9_\\-]+).html$`);
201
222
  const regexAsset = new RegExp(`^/${uriPrefix}([a-z0-9\\._\\-]+)$`);
202
223
  server.middlewares.use((req, res, next) => {
203
- var _a, _b;
224
+ const originalUrl = req.originalUrl ?? '';
204
225
  // only handle requests that start with the path prefix
205
- if (!((_a = req.originalUrl) === null || _a === void 0 ? void 0 : _a.startsWith(`/${uriPrefix}`))) {
226
+ if (!originalUrl.startsWith(`/${uriPrefix}`)) {
206
227
  return next();
207
228
  }
208
- if (req.originalUrl.match(new RegExp(`^/${uriPrefix}?$`))) {
209
- res.write(uidoc.page('index'));
210
- res.end();
211
- return;
212
- }
213
229
  const writeContent = (content) => {
214
- if (content) {
230
+ if (content !== null) {
231
+ res.setHeader('Content-Type', 'text/html; charset=utf-8');
215
232
  res.write(content);
216
233
  }
217
234
  else {
@@ -219,18 +236,22 @@ async function uidocPlugin(rawOptions) {
219
236
  }
220
237
  res.end();
221
238
  };
222
- const pageMatch = req.originalUrl.match(regexPage);
239
+ if (originalUrl.match(regexIndex)) {
240
+ writeContent(uidoc.page('index'));
241
+ return;
242
+ }
243
+ const pageMatch = originalUrl.match(regexPage);
223
244
  if (pageMatch) {
224
245
  writeContent(uidoc.page(pageMatch[1]));
225
246
  return;
226
247
  }
227
- const exampleMatch = req.originalUrl.match(regexExample);
248
+ const exampleMatch = originalUrl.match(regexExample);
228
249
  if (exampleMatch) {
229
250
  writeContent(uidoc.example(exampleMatch[1]));
230
251
  return;
231
252
  }
232
- if (req.originalUrl.match(regexAsset)) {
233
- const assetName = req.originalUrl.replace(`/${uriPrefix}`, '');
253
+ if (originalUrl.match(regexAsset)) {
254
+ const assetName = originalUrl.replace(`/${uriPrefix}`, '');
234
255
  const asset = assets.find(entry => entry.name === assetName);
235
256
  if (asset) {
236
257
  res.write(asset.source);
@@ -238,33 +259,35 @@ async function uidocPlugin(rawOptions) {
238
259
  return;
239
260
  }
240
261
  }
241
- const fileSystem = (_b = plugin.api) === null || _b === void 0 ? void 0 : _b.fileSystem;
242
- if (!staticAssets || !fileSystem) {
262
+ const fileSystem = api.fileSystem;
263
+ if (staticAssets === undefined || fileSystem === undefined) {
243
264
  return next();
244
265
  }
245
- const assetName = req.originalUrl.replace(`/${uriPrefix}`, '').split('?')[0];
266
+ const assetName = originalUrl.replace(`/${uriPrefix}`, '').split('?')[0];
246
267
  const assetFile = `${staticAssets}/${assetName}`;
247
268
  fileSystem
248
269
  .fileExists(assetFile)
249
- .then(exists => {
270
+ .then((exists) => {
250
271
  if (exists) {
251
272
  req.url = `/@fs${path.resolve(assetFile)}`;
252
273
  }
274
+ })
275
+ .catch((error) => {
276
+ server.config.logger.error(`UI-Doc: Error checking asset file: ${String(error)}`);
253
277
  })
254
278
  .finally(() => {
255
279
  next();
256
280
  });
257
281
  });
258
- (_g = server.httpServer) === null || _g === void 0 ? void 0 : _g.once('listening', () => {
282
+ server.httpServer?.once('listening', () => {
259
283
  setTimeout(() => {
260
- var _a;
261
284
  server.config.logger.info(`\n ${pc.green(`${pc.bold('UI-Doc')} v${version}`)} under /${pc.gray(uriPrefix)} \n`);
262
- if (Array.isArray((_a = server.resolvedUrls) === null || _a === void 0 ? void 0 : _a.local)) {
285
+ if (Array.isArray(server.resolvedUrls?.local)) {
263
286
  server.resolvedUrls.local.forEach(url => {
264
287
  server.config.logger.info(` ${pc.green('➜')} ${pc.bold('Local')}: ${pc.cyan(`${url}${uriPrefix}`)}`);
265
288
  });
266
289
  }
267
- }, 300);
290
+ }, SERVER_READY_LOG_DELAY_MS);
268
291
  uidoc.on('context-entry', () => {
269
292
  server.ws.send({ type: 'full-reload', path: `/${uriPrefix}*` });
270
293
  });
@@ -274,4 +297,5 @@ async function uidocPlugin(rawOptions) {
274
297
  }
275
298
 
276
299
  exports.default = uidocPlugin;
300
+ if (exports.default) { module.exports = Object.assign(exports.default, exports); }
277
301
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../../../node_modules/.pnpm/picocolors@1.0.1/node_modules/picocolors/picocolors.js","../src/index.ts"],"sourcesContent":["let argv = process.argv || [],\n\tenv = process.env\nlet isColorSupported =\n\t!(\"NO_COLOR\" in env || argv.includes(\"--no-color\")) &&\n\t(\"FORCE_COLOR\" in env ||\n\t\targv.includes(\"--color\") ||\n\t\tprocess.platform === \"win32\" ||\n\t\t(require != null && require(\"tty\").isatty(1) && env.TERM !== \"dumb\") ||\n\t\t\"CI\" in env)\n\nlet formatter =\n\t(open, close, replace = open) =>\n\tinput => {\n\t\tlet string = \"\" + input\n\t\tlet index = string.indexOf(close, open.length)\n\t\treturn ~index\n\t\t\t? open + replaceClose(string, close, replace, index) + close\n\t\t\t: open + string + close\n\t}\n\nlet replaceClose = (string, close, replace, index) => {\n\tlet result = \"\"\n\tlet cursor = 0\n\tdo {\n\t\tresult += string.substring(cursor, index) + replace\n\t\tcursor = index + close.length\n\t\tindex = string.indexOf(close, cursor)\n\t} while (~index)\n\treturn result + string.substring(cursor)\n}\n\nlet createColors = (enabled = isColorSupported) => {\n\tlet init = enabled ? formatter : () => String\n\treturn {\n\t\tisColorSupported: enabled,\n\t\treset: init(\"\\x1b[0m\", \"\\x1b[0m\"),\n\t\tbold: init(\"\\x1b[1m\", \"\\x1b[22m\", \"\\x1b[22m\\x1b[1m\"),\n\t\tdim: init(\"\\x1b[2m\", \"\\x1b[22m\", \"\\x1b[22m\\x1b[2m\"),\n\t\titalic: init(\"\\x1b[3m\", \"\\x1b[23m\"),\n\t\tunderline: init(\"\\x1b[4m\", \"\\x1b[24m\"),\n\t\tinverse: init(\"\\x1b[7m\", \"\\x1b[27m\"),\n\t\thidden: init(\"\\x1b[8m\", \"\\x1b[28m\"),\n\t\tstrikethrough: init(\"\\x1b[9m\", \"\\x1b[29m\"),\n\t\tblack: init(\"\\x1b[30m\", \"\\x1b[39m\"),\n\t\tred: init(\"\\x1b[31m\", \"\\x1b[39m\"),\n\t\tgreen: init(\"\\x1b[32m\", \"\\x1b[39m\"),\n\t\tyellow: init(\"\\x1b[33m\", \"\\x1b[39m\"),\n\t\tblue: init(\"\\x1b[34m\", \"\\x1b[39m\"),\n\t\tmagenta: init(\"\\x1b[35m\", \"\\x1b[39m\"),\n\t\tcyan: init(\"\\x1b[36m\", \"\\x1b[39m\"),\n\t\twhite: init(\"\\x1b[37m\", \"\\x1b[39m\"),\n\t\tgray: init(\"\\x1b[90m\", \"\\x1b[39m\"),\n\t\tbgBlack: init(\"\\x1b[40m\", \"\\x1b[49m\"),\n\t\tbgRed: init(\"\\x1b[41m\", \"\\x1b[49m\"),\n\t\tbgGreen: init(\"\\x1b[42m\", \"\\x1b[49m\"),\n\t\tbgYellow: init(\"\\x1b[43m\", \"\\x1b[49m\"),\n\t\tbgBlue: init(\"\\x1b[44m\", \"\\x1b[49m\"),\n\t\tbgMagenta: init(\"\\x1b[45m\", \"\\x1b[49m\"),\n\t\tbgCyan: init(\"\\x1b[46m\", \"\\x1b[49m\"),\n\t\tbgWhite: init(\"\\x1b[47m\", \"\\x1b[49m\"),\n\t}\n}\n\nmodule.exports = createColors()\nmodule.exports.createColors = createColors\n",null],"names":["require","picocolorsModule","ROLLUP_PLUGIN_NAME"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,EAAE;AAC7B,CAAC,GAAG,GAAG,OAAO,CAAC,IAAG;AAClB,IAAI,gBAAgB;AACpB,CAAC,EAAE,UAAU,IAAI,GAAG,IAAI,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;AACpD,EAAE,aAAa,IAAI,GAAG;AACtB,EAAE,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC;AAC1B,EAAE,OAAO,CAAC,QAAQ,KAAK,OAAO;AAC9B,GAAGA,eAAO,IAAI,IAAI,IAAI,UAAc,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,IAAI,K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A;AACJ,KAAC,CAAA;AAED,IAAA,OAAO,MAAqB,CAAA;AAC9B;;;;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"index.cjs","sources":["../../../node_modules/.pnpm/picocolors@1.0.1/node_modules/picocolors/picocolors.js","../src/index.ts"],"sourcesContent":["let argv = process.argv || [],\n\tenv = process.env\nlet isColorSupported =\n\t!(\"NO_COLOR\" in env || argv.includes(\"--no-color\")) &&\n\t(\"FORCE_COLOR\" in env ||\n\t\targv.includes(\"--color\") ||\n\t\tprocess.platform === \"win32\" ||\n\t\t(require != null && require(\"tty\").isatty(1) && env.TERM !== \"dumb\") ||\n\t\t\"CI\" in env)\n\nlet formatter =\n\t(open, close, replace = open) =>\n\tinput => {\n\t\tlet string = \"\" + input\n\t\tlet index = string.indexOf(close, open.length)\n\t\treturn ~index\n\t\t\t? open + replaceClose(string, close, replace, index) + close\n\t\t\t: open + string + close\n\t}\n\nlet replaceClose = (string, close, replace, index) => {\n\tlet result = \"\"\n\tlet cursor = 0\n\tdo {\n\t\tresult += string.substring(cursor, index) + replace\n\t\tcursor = index + close.length\n\t\tindex = string.indexOf(close, cursor)\n\t} while (~index)\n\treturn result + string.substring(cursor)\n}\n\nlet createColors = (enabled = isColorSupported) => {\n\tlet init = enabled ? formatter : () => String\n\treturn {\n\t\tisColorSupported: enabled,\n\t\treset: init(\"\\x1b[0m\", \"\\x1b[0m\"),\n\t\tbold: init(\"\\x1b[1m\", \"\\x1b[22m\", \"\\x1b[22m\\x1b[1m\"),\n\t\tdim: init(\"\\x1b[2m\", \"\\x1b[22m\", \"\\x1b[22m\\x1b[2m\"),\n\t\titalic: init(\"\\x1b[3m\", \"\\x1b[23m\"),\n\t\tunderline: init(\"\\x1b[4m\", \"\\x1b[24m\"),\n\t\tinverse: init(\"\\x1b[7m\", \"\\x1b[27m\"),\n\t\thidden: init(\"\\x1b[8m\", \"\\x1b[28m\"),\n\t\tstrikethrough: init(\"\\x1b[9m\", \"\\x1b[29m\"),\n\t\tblack: init(\"\\x1b[30m\", \"\\x1b[39m\"),\n\t\tred: init(\"\\x1b[31m\", \"\\x1b[39m\"),\n\t\tgreen: init(\"\\x1b[32m\", \"\\x1b[39m\"),\n\t\tyellow: init(\"\\x1b[33m\", \"\\x1b[39m\"),\n\t\tblue: init(\"\\x1b[34m\", \"\\x1b[39m\"),\n\t\tmagenta: init(\"\\x1b[35m\", \"\\x1b[39m\"),\n\t\tcyan: init(\"\\x1b[36m\", \"\\x1b[39m\"),\n\t\twhite: init(\"\\x1b[37m\", \"\\x1b[39m\"),\n\t\tgray: init(\"\\x1b[90m\", \"\\x1b[39m\"),\n\t\tbgBlack: init(\"\\x1b[40m\", \"\\x1b[49m\"),\n\t\tbgRed: init(\"\\x1b[41m\", \"\\x1b[49m\"),\n\t\tbgGreen: init(\"\\x1b[42m\", \"\\x1b[49m\"),\n\t\tbgYellow: init(\"\\x1b[43m\", \"\\x1b[49m\"),\n\t\tbgBlue: init(\"\\x1b[44m\", \"\\x1b[49m\"),\n\t\tbgMagenta: init(\"\\x1b[45m\", \"\\x1b[49m\"),\n\t\tbgCyan: init(\"\\x1b[46m\", \"\\x1b[49m\"),\n\t\tbgWhite: init(\"\\x1b[47m\", \"\\x1b[49m\"),\n\t}\n}\n\nmodule.exports = createColors()\nmodule.exports.createColors = createColors\n",null],"names":["require","picocolorsModule","ROLLUP_PLUGIN_NAME"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,EAAE;AAC7B,CAAC,GAAG,GAAG,OAAO,CAAC,IAAG;AAClB,IAAI,gBAAgB;AACpB,CAAC,EAAE,UAAU,IAAI,GAAG,IAAI,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;AACpD,EAAE,aAAa,IAAI,GAAG;AACtB,EAAE,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC;AAC1B,EAAE,OAAO,CAAC,QAAQ,KAAK,OAAO;AAC9B,GAAGA,eAAO,IAA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AA,EAAA,EAAE,CAAC,IAAI,CAAC,CAAG,EAAA,GAAG,GAAG,SAAS,CAAA,CAAE,CAAC,CAAA,CAAE,CAC5E,CAAA;AACH,qBAAC,CAAC,CAAA;iBACH;aACF,EAAE,yBAAyB,CAAC,CAAA;AAE7B,YAAA,KAAK,CAAC,EAAE,CAAC,eAAe,EAAE,MAAK;AAC7B,gBAAA,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,CAAA,CAAA,EAAI,SAAS,CAAG,CAAA,CAAA,EAAE,CAAC,CAAA;AACjE,aAAC,CAAC,CAAA;AACJ,SAAC,CAAC,CAAA;AACJ,KAAC,CAAA;AAED,IAAA,OAAO,MAAM,CAAA;AACf;;;;;;;","x_google_ignoreList":[0]}
package/dist/index.d.ts CHANGED
@@ -1,8 +1,30 @@
1
- import { type Api as RollupPluginApi, type Options as RollupPluginOptions } from '@ui-doc/rollup';
1
+ import type { Api as RollupPluginApi, Options as RollupPluginOptions } from '@ui-doc/rollup';
2
2
  import type { Plugin } from 'vite';
3
- export interface Options extends RollupPluginOptions {
4
- }
3
+ /**
4
+ * Options for configuring the UI-Doc Vite plugin.
5
+ * Extends all options from the Rollup plugin.
6
+ */
7
+ export type Options = RollupPluginOptions;
8
+ /**
9
+ * API exposed by the UI-Doc Vite plugin.
10
+ * Extends the Rollup plugin API with version information.
11
+ */
5
12
  export interface Api extends RollupPluginApi {
6
13
  version: string;
7
14
  }
15
+ /**
16
+ * Creates a UI-Doc Vite plugin for generating interactive UI documentation.
17
+ *
18
+ * @param rawOptions - Configuration options for the plugin
19
+ * @returns A configured Vite plugin instance
20
+ *
21
+ * @example
22
+ * ```ts
23
+ * import uidoc from '@ui-doc/vite'
24
+ *
25
+ * export default defineConfig({
26
+ * plugins: [uidoc({ source: 'src/**\/*.css' })]
27
+ * })
28
+ * ```
29
+ */
8
30
  export default function uidocPlugin(rawOptions: Options): Promise<Plugin<Api>>;
package/dist/index.mjs CHANGED
@@ -81,48 +81,71 @@ picocolors.exports.createColors = createColors;
81
81
  var picocolorsExports = picocolors.exports;
82
82
  var pc = /*@__PURE__*/getDefaultExportFromCjs(picocolorsExports);
83
83
 
84
- var version = "0.3.1";
84
+ var version = "0.3.2";
85
85
 
86
- /* eslint-disable sort-keys */
87
86
  const PLUGIN_NAME = 'ui-doc';
87
+ /**
88
+ * Delay in milliseconds before logging server ready message.
89
+ * Allows Vite's own logging to complete first for cleaner output.
90
+ */
91
+ const SERVER_READY_LOG_DELAY_MS = 300;
92
+ /**
93
+ * Resolves plugin options with defaults.
94
+ * Returns a new object to avoid mutating the input.
95
+ */
88
96
  function resolveOptions(options) {
89
- var _a, _b;
90
- options.output = (_a = options.output) !== null && _a !== void 0 ? _a : {};
91
- options.output.dir = (_b = options.output.dir) !== null && _b !== void 0 ? _b : 'ui-doc';
92
- return options;
97
+ return {
98
+ ...options,
99
+ output: {
100
+ ...options.output,
101
+ dir: options.output?.dir ?? 'ui-doc',
102
+ },
103
+ };
93
104
  }
94
- function prepareServe(plugin) {
95
- var _a, _b, _c, _d;
96
- if ((_a = plugin.api) === null || _a === void 0 ? void 0 : _a.options.prefix.uri) {
97
- // replace resolveUrl to make sure that all urls (pages and assets) are generated correctly for vite server
98
- (_b = plugin.api) === null || _b === void 0 ? void 0 : _b.uidoc.replaceGenerate('resolve', (uri, type) => {
99
- var _a, _b;
105
+ function prepareServe(api) {
106
+ if (api.options.prefix.uri) {
107
+ // replace resolveUrl to make sure that all urls (pages and assets) are generated correctly
108
+ // for vite server
109
+ api.uidoc.replaceGenerate('resolve', (uri, type) => {
100
110
  // don't add prefix if asset is from vite
101
- return ['asset', 'asset-example'].includes(type) &&
102
- // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
103
- (((_a = plugin.api) === null || _a === void 0 ? void 0 : _a.isAssetFromInput(uri)) || uri.startsWith('@'))
111
+ return ['asset', 'asset-example'].includes(type) && (api.isAssetFromInput(uri) || uri.startsWith('@'))
104
112
  ? `/${uri}`
105
- : `/${(_b = plugin.api) === null || _b === void 0 ? void 0 : _b.options.prefix.uri}${uri}`;
113
+ : `/${api.options.prefix.uri}${uri}`;
106
114
  });
107
115
  }
108
116
  // register all assets to ui-doc
109
- (_c = plugin.api) === null || _c === void 0 ? void 0 : _c.options.assets.forEach(({ fileName, context, attrs, fromInput = false }) => {
110
- var _a;
111
- (_a = plugin.api) === null || _a === void 0 ? void 0 : _a.uidocAsset(fileName, context, { attrs, fromInput });
117
+ api.options.assets.forEach(({ fileName, context, attrs, fromInput = false }) => {
118
+ api.uidocAsset(fileName, context, { attrs, fromInput });
112
119
  });
113
120
  // add vite client script to ui-doc
114
- (_d = plugin.api) === null || _d === void 0 ? void 0 : _d.uidocAsset('@vite/client', 'page', { attrs: { type: 'module' }, type: 'script' });
121
+ api.uidocAsset('@vite/client', 'page', { attrs: { type: 'module' }, type: 'script' });
115
122
  }
123
+ /**
124
+ * Creates a UI-Doc Vite plugin for generating interactive UI documentation.
125
+ *
126
+ * @param rawOptions - Configuration options for the plugin
127
+ * @returns A configured Vite plugin instance
128
+ *
129
+ * @example
130
+ * ```ts
131
+ * import uidoc from '@ui-doc/vite'
132
+ *
133
+ * export default defineConfig({
134
+ * plugins: [uidoc({ source: 'src/**\/*.css' })]
135
+ * })
136
+ * ```
137
+ */
116
138
  async function uidocPlugin(rawOptions) {
117
139
  const options = resolveOptions(rawOptions);
118
140
  const plugin = (await createRollupPlugin(options));
119
141
  let serving = false;
120
142
  plugin.name = PLUGIN_NAME;
121
143
  plugin.version = version;
122
- if (!plugin.api) {
144
+ const api = plugin.api;
145
+ if (!api) {
123
146
  throw new Error('UI-Doc rollup plugin API is not available');
124
147
  }
125
- plugin.api.version = version;
148
+ api.version = version;
126
149
  plugin.onLog = (_level, log) => {
127
150
  // hide rollup output logs
128
151
  if (log.plugin === PLUGIN_NAME$1 && log.pluginCode === 'OUTPUT') {
@@ -139,41 +162,42 @@ async function uidocPlugin(rawOptions) {
139
162
  await orgBuildStart.call(this, inputOptions);
140
163
  }
141
164
  if (serving) {
142
- prepareServe(plugin);
165
+ prepareServe(api);
143
166
  }
144
167
  };
145
168
  plugin.generateBundle = async function (outputOptions, bundle, isWrite) {
146
- var _a;
147
169
  // find and set the correct file name for each asset
148
- (_a = plugin.api) === null || _a === void 0 ? void 0 : _a.options.assets.filter(asset => asset.fromInput).forEach(asset => {
149
- var _a, _b, _c;
170
+ api.options.assets
171
+ .filter(asset => asset.fromInput)
172
+ .forEach(asset => {
150
173
  const foundBundle = Object.values(bundle).find(({ name }) => name === asset.name);
151
174
  if (!foundBundle) {
152
175
  return;
153
176
  }
154
177
  // copy imported assets from vite into UI-Doc output
155
- if ((_a = foundBundle === null || foundBundle === void 0 ? void 0 : foundBundle.viteMetadata) === null || _a === void 0 ? void 0 : _a.importedAssets) {
178
+ if (foundBundle.viteMetadata?.importedAssets) {
156
179
  foundBundle.viteMetadata.importedAssets.forEach((importedAsset) => {
157
- var _a;
158
- (_a = plugin.api) === null || _a === void 0 ? void 0 : _a.addAssetFromInput(importedAsset);
180
+ api.addAssetFromInput(importedAsset);
159
181
  });
160
182
  }
161
183
  if (asset.type === 'script') {
162
- asset.fileName = foundBundle.fileName;
184
+ if (foundBundle.fileName !== undefined && foundBundle.fileName !== '') {
185
+ asset.fileName = foundBundle.fileName;
186
+ }
163
187
  // copy and register imported css files to ui-doc
164
- if ((_b = foundBundle === null || foundBundle === void 0 ? void 0 : foundBundle.viteMetadata) === null || _b === void 0 ? void 0 : _b.importedCss) {
188
+ if (foundBundle.viteMetadata?.importedCss) {
165
189
  foundBundle.viteMetadata.importedCss.forEach((imported) => {
166
- var _a, _b;
167
- (_a = plugin.api) === null || _a === void 0 ? void 0 : _a.addAssetFromInput(imported);
168
- (_b = plugin.api) === null || _b === void 0 ? void 0 : _b.uidocAsset(imported, asset.context, { type: 'style' });
190
+ api.addAssetFromInput(imported);
191
+ api.uidocAsset(imported, asset.context, { type: 'style' });
169
192
  });
170
193
  }
171
194
  return;
172
195
  }
173
- if (asset.type === 'style' &&
174
- ((_c = foundBundle === null || foundBundle === void 0 ? void 0 : foundBundle.viteMetadata) === null || _c === void 0 ? void 0 : _c.importedCss) &&
175
- foundBundle.viteMetadata.importedCss.size > 0) {
176
- asset.fileName = foundBundle.viteMetadata.importedCss.values().next().value;
196
+ if (asset.type === 'style'
197
+ && foundBundle.viteMetadata?.importedCss
198
+ && foundBundle.viteMetadata.importedCss.size > 0) {
199
+ const firstCss = foundBundle.viteMetadata.importedCss.values().next().value;
200
+ asset.fileName = firstCss;
177
201
  }
178
202
  });
179
203
  if (orgGenerateBundle) {
@@ -181,33 +205,26 @@ async function uidocPlugin(rawOptions) {
181
205
  }
182
206
  };
183
207
  plugin.configureServer = async function (server) {
184
- var _a, _b, _c, _d, _e, _f, _g;
185
- const uidoc = (_a = plugin.api) === null || _a === void 0 ? void 0 : _a.uidoc;
186
- const uriPrefix = (_b = plugin.api) === null || _b === void 0 ? void 0 : _b.options.prefix.uri;
187
- const assets = (_d = (_c = plugin.api) === null || _c === void 0 ? void 0 : _c.options.assets) !== null && _d !== void 0 ? _d : [];
188
- const staticAssets = (_f = (_e = plugin.api) === null || _e === void 0 ? void 0 : _e.options.staticAssets) !== null && _f !== void 0 ? _f : undefined;
189
- if (!uidoc) {
190
- throw new Error('UI-Doc API is not available');
191
- }
208
+ const uidoc = api.uidoc;
209
+ const uriPrefix = api.options.prefix.uri;
210
+ const assets = api.options.assets ?? [];
211
+ const staticAssets = api.options.staticAssets ?? undefined;
192
212
  if (!uriPrefix) {
193
213
  throw new Error('UI-Doc base url is not available. Please don\'t set "outputBaseUri" to "." in dev mode.');
194
214
  }
215
+ const regexIndex = new RegExp(`^/${uriPrefix}?$`);
195
216
  const regexPage = new RegExp(`^/${uriPrefix}([a-z0-9_\\-]+).html$`);
196
217
  const regexExample = new RegExp(`^/${uriPrefix}examples/([a-z0-9_\\-]+).html$`);
197
218
  const regexAsset = new RegExp(`^/${uriPrefix}([a-z0-9\\._\\-]+)$`);
198
219
  server.middlewares.use((req, res, next) => {
199
- var _a, _b;
220
+ const originalUrl = req.originalUrl ?? '';
200
221
  // only handle requests that start with the path prefix
201
- if (!((_a = req.originalUrl) === null || _a === void 0 ? void 0 : _a.startsWith(`/${uriPrefix}`))) {
222
+ if (!originalUrl.startsWith(`/${uriPrefix}`)) {
202
223
  return next();
203
224
  }
204
- if (req.originalUrl.match(new RegExp(`^/${uriPrefix}?$`))) {
205
- res.write(uidoc.page('index'));
206
- res.end();
207
- return;
208
- }
209
225
  const writeContent = (content) => {
210
- if (content) {
226
+ if (content !== null) {
227
+ res.setHeader('Content-Type', 'text/html; charset=utf-8');
211
228
  res.write(content);
212
229
  }
213
230
  else {
@@ -215,18 +232,22 @@ async function uidocPlugin(rawOptions) {
215
232
  }
216
233
  res.end();
217
234
  };
218
- const pageMatch = req.originalUrl.match(regexPage);
235
+ if (originalUrl.match(regexIndex)) {
236
+ writeContent(uidoc.page('index'));
237
+ return;
238
+ }
239
+ const pageMatch = originalUrl.match(regexPage);
219
240
  if (pageMatch) {
220
241
  writeContent(uidoc.page(pageMatch[1]));
221
242
  return;
222
243
  }
223
- const exampleMatch = req.originalUrl.match(regexExample);
244
+ const exampleMatch = originalUrl.match(regexExample);
224
245
  if (exampleMatch) {
225
246
  writeContent(uidoc.example(exampleMatch[1]));
226
247
  return;
227
248
  }
228
- if (req.originalUrl.match(regexAsset)) {
229
- const assetName = req.originalUrl.replace(`/${uriPrefix}`, '');
249
+ if (originalUrl.match(regexAsset)) {
250
+ const assetName = originalUrl.replace(`/${uriPrefix}`, '');
230
251
  const asset = assets.find(entry => entry.name === assetName);
231
252
  if (asset) {
232
253
  res.write(asset.source);
@@ -234,33 +255,35 @@ async function uidocPlugin(rawOptions) {
234
255
  return;
235
256
  }
236
257
  }
237
- const fileSystem = (_b = plugin.api) === null || _b === void 0 ? void 0 : _b.fileSystem;
238
- if (!staticAssets || !fileSystem) {
258
+ const fileSystem = api.fileSystem;
259
+ if (staticAssets === undefined || fileSystem === undefined) {
239
260
  return next();
240
261
  }
241
- const assetName = req.originalUrl.replace(`/${uriPrefix}`, '').split('?')[0];
262
+ const assetName = originalUrl.replace(`/${uriPrefix}`, '').split('?')[0];
242
263
  const assetFile = `${staticAssets}/${assetName}`;
243
264
  fileSystem
244
265
  .fileExists(assetFile)
245
- .then(exists => {
266
+ .then((exists) => {
246
267
  if (exists) {
247
268
  req.url = `/@fs${path.resolve(assetFile)}`;
248
269
  }
270
+ })
271
+ .catch((error) => {
272
+ server.config.logger.error(`UI-Doc: Error checking asset file: ${String(error)}`);
249
273
  })
250
274
  .finally(() => {
251
275
  next();
252
276
  });
253
277
  });
254
- (_g = server.httpServer) === null || _g === void 0 ? void 0 : _g.once('listening', () => {
278
+ server.httpServer?.once('listening', () => {
255
279
  setTimeout(() => {
256
- var _a;
257
280
  server.config.logger.info(`\n ${pc.green(`${pc.bold('UI-Doc')} v${version}`)} under /${pc.gray(uriPrefix)} \n`);
258
- if (Array.isArray((_a = server.resolvedUrls) === null || _a === void 0 ? void 0 : _a.local)) {
281
+ if (Array.isArray(server.resolvedUrls?.local)) {
259
282
  server.resolvedUrls.local.forEach(url => {
260
283
  server.config.logger.info(` ${pc.green('➜')} ${pc.bold('Local')}: ${pc.cyan(`${url}${uriPrefix}`)}`);
261
284
  });
262
285
  }
263
- }, 300);
286
+ }, SERVER_READY_LOG_DELAY_MS);
264
287
  uidoc.on('context-entry', () => {
265
288
  server.ws.send({ type: 'full-reload', path: `/${uriPrefix}*` });
266
289
  });