@immense/vue-pom-generator 1.0.21 → 1.0.22

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.ts CHANGED
@@ -1,4 +1,8 @@
1
- export { createVuePomGeneratorPlugins } from "./plugin/create-vue-pom-generator-plugins";
2
- export { default } from "./plugin/create-vue-pom-generator-plugins";
1
+ import createVuePomGeneratorPlugins from "./plugin/create-vue-pom-generator-plugins";
2
+ import type { VuePomGeneratorPluginOptions } from "./plugin/types";
3
+ export { createVuePomGeneratorPlugins };
4
+ export { createVuePomGeneratorPlugins as vuePomGenerator };
5
+ export default createVuePomGeneratorPlugins;
6
+ export declare function defineVuePomGeneratorConfig(options: VuePomGeneratorPluginOptions): VuePomGeneratorPluginOptions;
3
7
  export type { ExistingIdBehavior, PomNameCollisionBehavior, VuePomGeneratorPluginOptions } from "./plugin/types";
4
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,2CAA2C,CAAC;AACzF,OAAO,EAAE,OAAO,EAAE,MAAM,2CAA2C,CAAC;AACpE,YAAY,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,4BAA4B,EAAE,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,4BAA4B,MAAM,2CAA2C,CAAC;AAErF,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,gBAAgB,CAAC;AAEnE,OAAO,EAAE,4BAA4B,EAAE,CAAC;AACxC,OAAO,EAAE,4BAA4B,IAAI,eAAe,EAAE,CAAC;AAC3D,eAAe,4BAA4B,CAAC;AAE5C,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,4BAA4B,GAAG,4BAA4B,CAE/G;AAED,YAAY,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,4BAA4B,EAAE,MAAM,gBAAgB,CAAC"}
package/dist/index.mjs CHANGED
@@ -329,10 +329,8 @@ function toPascalCaseRouteKey(value) {
329
329
  for (let i = 0; i < value.length; i++) {
330
330
  const ch = value[i];
331
331
  const code = ch.charCodeAt(0);
332
- const isDigit = code >= 48 && code <= 57;
333
- const isUpper = code >= 65 && code <= 90;
334
- const isLower = code >= 97 && code <= 122;
335
- const isAlphaNum = isDigit || isUpper || isLower;
332
+ const isLower = isAsciiLowercaseLetterCode(code);
333
+ const isAlphaNum = isAsciiAlphaNumericCode(code);
336
334
  if (!isAlphaNum) {
337
335
  newWord = true;
338
336
  continue;
@@ -485,6 +483,21 @@ function upperFirst(value) {
485
483
  }
486
484
  return value.charAt(0).toUpperCase() + value.slice(1);
487
485
  }
486
+ function isAsciiUppercaseLetterCode(code) {
487
+ return code >= 65 && code <= 90;
488
+ }
489
+ function isAsciiLowercaseLetterCode(code) {
490
+ return code >= 97 && code <= 122;
491
+ }
492
+ function isAsciiLetterCode(code) {
493
+ return isAsciiUppercaseLetterCode(code) || isAsciiLowercaseLetterCode(code);
494
+ }
495
+ function isAsciiDigitCode(code) {
496
+ return code >= 48 && code <= 57;
497
+ }
498
+ function isAsciiAlphaNumericCode(code) {
499
+ return isAsciiLetterCode(code) || isAsciiDigitCode(code);
500
+ }
488
501
  function staticAttributeValue(value) {
489
502
  return { kind: "static", value };
490
503
  }
@@ -1516,8 +1529,8 @@ function isAllCapsOrDigits(value) {
1516
1529
  }
1517
1530
  for (let i = 0; i < value.length; i++) {
1518
1531
  const c = value.charCodeAt(i);
1519
- const isUpper = c >= 65 && c <= 90;
1520
- const isDigit = c >= 48 && c <= 57;
1532
+ const isUpper = isAsciiUppercaseLetterCode(c);
1533
+ const isDigit = isAsciiDigitCode(c);
1521
1534
  if (!isUpper && !isDigit) {
1522
1535
  return false;
1523
1536
  }
@@ -1529,17 +1542,14 @@ function startsWithDigit(value) {
1529
1542
  return false;
1530
1543
  }
1531
1544
  const c = value.charCodeAt(0);
1532
- return c >= 48 && c <= 57;
1545
+ return isAsciiDigitCode(c);
1533
1546
  }
1534
1547
  function stripNonIdentifierChars(value) {
1535
1548
  let out = "";
1536
1549
  for (let i = 0; i < value.length; i++) {
1537
1550
  const c = value.charCodeAt(i);
1538
- const isUpper = c >= 65 && c <= 90;
1539
- const isLower = c >= 97 && c <= 122;
1540
- const isDigit = c >= 48 && c <= 57;
1541
1551
  const isUnderscore = c === 95;
1542
- if (isUpper || isLower || isDigit || isUnderscore) {
1552
+ if (isAsciiAlphaNumericCode(c) || isUnderscore) {
1543
1553
  out += value[i];
1544
1554
  }
1545
1555
  }
@@ -2307,12 +2317,6 @@ function debugLog(message) {
2307
2317
  console.log(`[vue-pom-generator][router-introspection] ${message}`);
2308
2318
  }
2309
2319
  }
2310
- function isAsciiLetterCode(code) {
2311
- return code >= 65 && code <= 90 || code >= 97 && code <= 122;
2312
- }
2313
- function isAsciiDigitCode(code) {
2314
- return code >= 48 && code <= 57;
2315
- }
2316
2320
  function isIdentifierStartCode(code) {
2317
2321
  return code === 95 || code === 36 || isAsciiLetterCode(code);
2318
2322
  }
@@ -4114,15 +4118,13 @@ function tryExtractStableHintFromConditionalExpressionSource(source) {
4114
4118
  const v = value.trim();
4115
4119
  if (!v)
4116
4120
  return false;
4117
- const isAlpha = (ch) => ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122;
4118
- const isDigit = (ch) => ch >= 48 && ch <= 57;
4119
4121
  const isUnderscore = (ch) => ch === 95;
4120
4122
  const first = v.charCodeAt(0);
4121
- if (!isAlpha(first))
4123
+ if (!isAsciiLetterCode(first))
4122
4124
  return false;
4123
4125
  for (let i = 1; i < v.length; i += 1) {
4124
4126
  const ch = v.charCodeAt(i);
4125
- if (isAlpha(ch) || isDigit(ch) || isUnderscore(ch)) {
4127
+ if (isAsciiLetterCode(ch) || isAsciiDigitCode(ch) || isUnderscore(ch)) {
4126
4128
  continue;
4127
4129
  }
4128
4130
  return false;
@@ -4181,7 +4183,7 @@ function tryExtractStableHintFromConditionalExpressionSource(source) {
4181
4183
  }
4182
4184
  function tryInferNativeWrapperRoleFromSfc(tag, vueFilesPathMap) {
4183
4185
  const first = tag.charCodeAt(0);
4184
- const isUpper = first >= 65 && first <= 90;
4186
+ const isUpper = isAsciiUppercaseLetterCode(first);
4185
4187
  if (!isUpper)
4186
4188
  return null;
4187
4189
  const cached = inferredNativeWrapperConfigByTag.get(tag);
@@ -4500,7 +4502,7 @@ function createTestIdTransform(componentName, componentHierarchyMap, nativeWrapp
4500
4502
  const isComponentLikeTag = (tag) => {
4501
4503
  if (!tag) return false;
4502
4504
  const first = tag.charCodeAt(0);
4503
- const isUpper = first >= 65 && first <= 90;
4505
+ const isUpper = isAsciiUppercaseLetterCode(first);
4504
4506
  return isUpper || tag.includes("-");
4505
4507
  };
4506
4508
  if (isComponentLikeTag(element.tag)) {
@@ -5562,7 +5564,29 @@ function assertRouterModuleShims(value, name) {
5562
5564
  function resolveFromProjectRoot(projectRoot, maybePath) {
5563
5565
  return path.isAbsolute(maybePath) ? maybePath : path.resolve(projectRoot, maybePath);
5564
5566
  }
5567
+ function assertNotVitePluginInstance(options) {
5568
+ const candidate = options;
5569
+ const pluginLikeKeys = [
5570
+ "name",
5571
+ "enforce",
5572
+ "apply",
5573
+ "transform",
5574
+ "resolveId",
5575
+ "load",
5576
+ "config",
5577
+ "configResolved",
5578
+ "handleHotUpdate"
5579
+ ];
5580
+ const pluginLikeKey = pluginLikeKeys.find((key) => key in candidate);
5581
+ if (!pluginLikeKey) {
5582
+ return;
5583
+ }
5584
+ throw new TypeError(
5585
+ `[vue-pom-generator] Invalid options: received an object that looks like a Vite plugin (found key: "${pluginLikeKey}"). Do not pass vue() into createVuePomGeneratorPlugins(...). Pass Vue plugin options via { vueOptions: { ... } } instead.`
5586
+ );
5587
+ }
5565
5588
  function createVuePomGeneratorPlugins(options = {}) {
5589
+ assertNotVitePluginInstance(options);
5566
5590
  const injection = options.injection ?? {};
5567
5591
  const generationSetting = options.generation;
5568
5592
  const generationOptions = generationSetting === false ? null : generationSetting ?? {};
@@ -5679,8 +5703,13 @@ function createVuePomGeneratorPlugins(options = {}) {
5679
5703
  }
5680
5704
  return resultPlugins;
5681
5705
  }
5706
+ function defineVuePomGeneratorConfig(options) {
5707
+ return options;
5708
+ }
5682
5709
  export {
5683
5710
  createVuePomGeneratorPlugins,
5684
- createVuePomGeneratorPlugins as default
5711
+ createVuePomGeneratorPlugins as default,
5712
+ defineVuePomGeneratorConfig,
5713
+ createVuePomGeneratorPlugins as vuePomGenerator
5685
5714
  };
5686
5715
  //# sourceMappingURL=index.mjs.map