bitboss-ui 3.0.0-beta.49 → 3.0.0-beta.50

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.
@@ -209,6 +209,37 @@ export function readPluginOptions(projectRoot) {
209
209
  : { config: vite.name, nuxt: false, options, code: vite.code };
210
210
  }
211
211
 
212
+ /**
213
+ * The build config that installs the plugin, as written (comments blanked),
214
+ * whatever shape its options take: an inline object, a variable, a spread.
215
+ * `undefined` when there is none or it cannot be read.
216
+ * @returns {{ config: string, nuxt: boolean, code: string } | undefined}
217
+ */
218
+ export function readPluginConfig(projectRoot) {
219
+ for (const [names, nuxt] of [
220
+ [NUXT_CONFIGS, true],
221
+ [VITE_CONFIGS, false],
222
+ ]) {
223
+ for (const name of names) {
224
+ const path = join(projectRoot, name);
225
+ if (!existsSync(path)) continue;
226
+ let code;
227
+ try {
228
+ code = blankComments(readFileSync(path, 'utf-8'), {
229
+ lineComments: true,
230
+ });
231
+ } catch {
232
+ return undefined;
233
+ }
234
+ const installs = nuxt
235
+ ? /['"]bitboss-ui\/nuxt['"]/.test(code)
236
+ : /\bbitbossUi\s*\(/.test(code);
237
+ return installs ? { config: name, nuxt, code } : undefined;
238
+ }
239
+ }
240
+ return undefined;
241
+ }
242
+
212
243
  /** `injectStyles` written with anything but a literal `true` — `false`, a variable, a condition. */
213
244
  const NOT_LITERALLY_ON = /\binjectStyles\b(?!\s*:\s*true\b)/;
214
245
 
@@ -16,7 +16,10 @@
16
16
  */
17
17
 
18
18
  import { readFileSync } from 'node:fs';
19
- import { readPluginOptions } from './hand-imported-styles.mjs';
19
+ import {
20
+ readPluginConfig,
21
+ readPluginOptions,
22
+ } from './hand-imported-styles.mjs';
20
23
 
21
24
  export const UNKNOWN_LOCALE_KIND = 'unknown-locale';
22
25
 
@@ -139,9 +142,23 @@ export function unknownLocaleFindings(
139
142
  findings.push(
140
143
  finding(plugin.config, plugin.code, index, value, keys, where)
141
144
  );
145
+ } else if (plugin === null) {
146
+ // Options not one inline object (`bitbossUi(options)`, a spread): the
147
+ // literals anywhere in the config file that installs the plugin.
148
+ const config = readPluginConfig(projectRoot);
149
+ if (config)
150
+ for (const { value, index, where } of optionLiterals(config.code, 0))
151
+ if (!resolveLocale(value, keys))
152
+ findings.push(
153
+ finding(config.config, config.code, index, value, keys, where)
154
+ );
142
155
  }
143
156
  for (const { path, relPath } of files) {
144
- if (!/\.(?:vue|[cm]?[jt]sx?)$/.test(relPath) || relPath === plugin?.config)
157
+ if (
158
+ !/\.(?:vue|[cm]?[jt]sx?)$/.test(relPath) ||
159
+ relPath === plugin?.config ||
160
+ relPath === readPluginConfig(projectRoot)?.config
161
+ )
145
162
  continue;
146
163
  let code;
147
164
  try {