@bleedingdev/modern-js-create 3.2.0-ultramodern.73 → 3.2.0-ultramodern.74

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.
Files changed (2) hide show
  1. package/dist/index.js +26 -33
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -4507,9 +4507,8 @@ function createWorkspaceI18nBoundaryValidationScript() {
4507
4507
  return `#!/usr/bin/env node
4508
4508
  import fs from 'node:fs';
4509
4509
  import path from 'node:path';
4510
- import { fileURLToPath } from 'node:url';
4511
4510
 
4512
- const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
4511
+ const root = path.resolve(import.meta.dirname, '..');
4513
4512
  const sourceRoots = ['apps', 'verticals'];
4514
4513
  const languageConditionalPattern =
4515
4514
  /\\b(language|locale|lng|currentLanguage)\\s*={0,2}={1,2}\\s*['"][a-z-]+['"]\\s*\\?\\s*([^:;\\n]+)\\s*:\\s*([^;\\n})]+)/gu;
@@ -4529,11 +4528,11 @@ const visibleCopyAttributes = new Set([
4529
4528
  'title',
4530
4529
  ]);
4531
4530
 
4532
- function fail(message) {
4531
+ const fail = (message) => {
4533
4532
  throw new Error(message);
4534
- }
4533
+ };
4535
4534
 
4536
- function walk(directory, files = []) {
4535
+ const walk = (directory, files = []) => {
4537
4536
  if (!fs.existsSync(directory)) {
4538
4537
  return files;
4539
4538
  }
@@ -4549,43 +4548,37 @@ function walk(directory, files = []) {
4549
4548
  }
4550
4549
  }
4551
4550
  return files;
4552
- }
4551
+ };
4553
4552
 
4554
- function relative(filePath) {
4555
- return path.relative(root, filePath).replace(/\\\\/gu, '/');
4556
- }
4553
+ const relative = (filePath) => path.relative(root, filePath).replaceAll('\\\\', '/');
4557
4554
 
4558
- function isSourceFile(filePath) {
4559
- return /\\.(?:ts|tsx|js|jsx)$/u.test(filePath);
4560
- }
4555
+ const isSourceFile = (filePath) => /\\.(?:ts|tsx|js|jsx)$/u.test(filePath);
4561
4556
 
4562
- function isLocaleJson(filePath) {
4557
+ const isLocaleJson = (filePath) => {
4563
4558
  const normalized = relative(filePath);
4564
4559
  return /\\/locales\\/(en|cs)\\/[^/]+\\.json$/u.test(normalized);
4565
- }
4560
+ };
4566
4561
 
4567
- function readText(filePath) {
4568
- return fs.readFileSync(filePath, 'utf8');
4569
- }
4562
+ const readText = (filePath) => fs.readFileSync(filePath, 'utf-8');
4570
4563
 
4571
- function branchIsUserCopy(branch) {
4564
+ const branchIsUserCopy = (branch) => {
4572
4565
  const value = branch.trim().replace(/,$/u, '');
4573
4566
  if (allowedLanguageConditionalBranches.has(value)) {
4574
4567
  return false;
4575
4568
  }
4576
4569
  return /^['"][^'"]{2,}['"]$/u.test(value);
4577
- }
4570
+ };
4578
4571
 
4579
- function checkRuntimeResources(filePath, text) {
4572
+ const checkRuntimeResources = (filePath, text) => {
4580
4573
  if (!relative(filePath).endsWith('/src/modern.runtime.ts')) {
4581
4574
  return;
4582
4575
  }
4583
4576
  if (/initOptions\\s*:\\s*\\{[\\s\\S]*?\\bresources\\s*:/u.test(text)) {
4584
4577
  fail(\`\${relative(filePath)} must not inline i18n resources in modern.runtime.ts; use locale JSON files.\`);
4585
4578
  }
4586
- }
4579
+ };
4587
4580
 
4588
- function checkLanguageConditionals(filePath, text) {
4581
+ const checkLanguageConditionals = (filePath, text) => {
4589
4582
  for (const match of text.matchAll(languageConditionalPattern)) {
4590
4583
  const [, name, whenTrue = '', whenFalse = ''] = match;
4591
4584
  if (branchIsUserCopy(whenTrue) || branchIsUserCopy(whenFalse)) {
@@ -4594,9 +4587,9 @@ function checkLanguageConditionals(filePath, text) {
4594
4587
  );
4595
4588
  }
4596
4589
  }
4597
- }
4590
+ };
4598
4591
 
4599
- function checkLiteralVisibleAttributes(filePath, text) {
4592
+ const checkLiteralVisibleAttributes = (filePath, text) => {
4600
4593
  if (!filePath.endsWith('.tsx') && !filePath.endsWith('.jsx')) {
4601
4594
  return;
4602
4595
  }
@@ -4608,17 +4601,17 @@ function checkLiteralVisibleAttributes(filePath, text) {
4608
4601
  );
4609
4602
  }
4610
4603
  }
4611
- }
4604
+ };
4612
4605
 
4613
- function checkSplitPhraseKeys(filePath, text) {
4606
+ const checkSplitPhraseKeys = (filePath, text) => {
4614
4607
  if (/t\\(\\s*['"][^'"]+\\.(?:prefix|suffix|before|after)['"]\\s*\\)/u.test(text)) {
4615
4608
  fail(
4616
4609
  \`\${relative(filePath)} uses split phrase translation keys. Keep translator-owned phrases whole.\`,
4617
4610
  );
4618
4611
  }
4619
- }
4612
+ };
4620
4613
 
4621
- function checkBoundaryAttributes(filePath, text) {
4614
+ const checkBoundaryAttributes = (filePath, text) => {
4622
4615
  if (!filePath.endsWith('.tsx') && !filePath.endsWith('.jsx')) {
4623
4616
  return;
4624
4617
  }
@@ -4627,9 +4620,9 @@ function checkBoundaryAttributes(filePath, text) {
4627
4620
  \`\${relative(filePath)} uses legacy data-mf-* boundary attributes. Use data-modern-boundary-id and data-modern-mf-expose.\`,
4628
4621
  );
4629
4622
  }
4630
- }
4623
+ };
4631
4624
 
4632
- function visitLocaleKeys(value, visitor, pathParts = []) {
4625
+ const visitLocaleKeys = (value, visitor, pathParts = []) => {
4633
4626
  if (!value || typeof value !== 'object' || Array.isArray(value)) {
4634
4627
  return;
4635
4628
  }
@@ -4638,9 +4631,9 @@ function visitLocaleKeys(value, visitor, pathParts = []) {
4638
4631
  visitor(key, child, nextPath);
4639
4632
  visitLocaleKeys(child, visitor, nextPath);
4640
4633
  }
4641
- }
4634
+ };
4642
4635
 
4643
- function checkPluralResources(filePath, json) {
4636
+ const checkPluralResources = (filePath, json) => {
4644
4637
  const language = relative(filePath).split('/locales/')[1]?.split('/')[0];
4645
4638
  const requiredSuffixes =
4646
4639
  language === 'cs' ? ['one', 'few', 'many', 'other'] : ['one', 'other'];
@@ -4670,7 +4663,7 @@ function checkPluralResources(filePath, json) {
4670
4663
  }
4671
4664
  }
4672
4665
  }
4673
- }
4666
+ };
4674
4667
 
4675
4668
  const sourceFiles = sourceRoots.flatMap(sourceRoot =>
4676
4669
  walk(path.join(root, sourceRoot)).filter(filePath => isSourceFile(filePath)),
package/package.json CHANGED
@@ -21,7 +21,7 @@
21
21
  "engines": {
22
22
  "node": ">=20"
23
23
  },
24
- "version": "3.2.0-ultramodern.73",
24
+ "version": "3.2.0-ultramodern.74",
25
25
  "types": "./dist/types/index.d.ts",
26
26
  "main": "./dist/index.js",
27
27
  "bin": {
@@ -41,7 +41,7 @@
41
41
  "@types/node": "^25.9.1",
42
42
  "@typescript/native-preview": "7.0.0-dev.20260527.2",
43
43
  "tsx": "^4.22.3",
44
- "@modern-js/i18n-utils": "npm:@bleedingdev/modern-js-i18n-utils@3.2.0-ultramodern.73"
44
+ "@modern-js/i18n-utils": "npm:@bleedingdev/modern-js-i18n-utils@3.2.0-ultramodern.74"
45
45
  },
46
46
  "publishConfig": {
47
47
  "registry": "https://registry.npmjs.org/",
@@ -54,6 +54,6 @@
54
54
  "start": "node ./dist/index.js"
55
55
  },
56
56
  "ultramodern": {
57
- "frameworkVersion": "3.2.0-ultramodern.73"
57
+ "frameworkVersion": "3.2.0-ultramodern.74"
58
58
  }
59
59
  }