@xaendar/cli 0.3.17 → 0.3.19

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 (3) hide show
  1. package/index.js +57 -27
  2. package/index.js.map +1 -1
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -3477,8 +3477,18 @@ var {
3477
3477
  } = import_index.default;
3478
3478
 
3479
3479
  // ../packages/cli/src/commands/generate/component/component.command.ts
3480
- import { mkdirSync, writeFileSync, existsSync, rmSync } from "fs";
3480
+ import { existsSync, mkdirSync, rmSync, writeFileSync } from "fs";
3481
3481
  import { join } from "path";
3482
+
3483
+ // ../packages/cli/src/utils/case.utils.ts
3484
+ function toPascalCase(str) {
3485
+ return str.replace(/[-_](.)/g, (_, c) => c.toUpperCase()).replace(/^(.)/, (_, c) => c.toUpperCase());
3486
+ }
3487
+ function toKebabCase(str) {
3488
+ return str.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/_/g, "-").toLowerCase();
3489
+ }
3490
+
3491
+ // ../packages/cli/src/commands/generate/component/component.command.ts
3482
3492
  function generateComponent(name, path, force, style) {
3483
3493
  const dir = join(path, name);
3484
3494
  style ??= "css";
@@ -3542,12 +3552,6 @@ describe('${className}Component', () => {
3542
3552
  });
3543
3553
  `;
3544
3554
  }
3545
- function toPascalCase(str) {
3546
- return str.replace(/[-_](.)/g, (_, c) => c.toUpperCase()).replace(/^(.)/, (_, c) => c.toUpperCase());
3547
- }
3548
- function toKebabCase(str) {
3549
- return str.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/_/g, "-").toLowerCase();
3550
- }
3551
3555
 
3552
3556
  // ../packages/cli/src/commands/generate/generate.command.ts
3553
3557
  function generateCommand() {
@@ -3569,7 +3573,6 @@ import { resolve } from "path";
3569
3573
 
3570
3574
  // ../packages/cli/src/commands/new/templates/index-html.ts
3571
3575
  function indexHtml(name) {
3572
- const selector = `${name}-root`;
3573
3576
  return `<!DOCTYPE html>
3574
3577
  <html lang="en">
3575
3578
  <head>
@@ -3578,11 +3581,10 @@ function indexHtml(name) {
3578
3581
  <title>${name}</title>
3579
3582
  </head>
3580
3583
  <body>
3581
- <${selector}></${selector}>
3584
+ <${name}></${name}>
3582
3585
  <script type="module" src="./main.ts"></script>
3583
3586
  </body>
3584
- </html>
3585
- `;
3587
+ </html>`;
3586
3588
  }
3587
3589
 
3588
3590
  // ../packages/cli/src/commands/new/templates/main-ts.ts
@@ -3592,8 +3594,7 @@ function mainTs(componentName) {
3592
3594
  import { ${componentClassName} } from './${componentName}/${componentName}.xd.component';
3593
3595
 
3594
3596
  console.log(${componentClassName});
3595
- loadSignals();
3596
- `;
3597
+ loadSignals();`;
3597
3598
  }
3598
3599
 
3599
3600
  // ../packages/cli/src/commands/new/templates/package-json.ts
@@ -3614,6 +3615,8 @@ function packageJson(name, version) {
3614
3615
  "@xaendar/types": "^${version}"
3615
3616
  },
3616
3617
  "devDependencies": {
3618
+ "@babel/plugin-proposal-decorators": "^7.29.0",
3619
+ "@rolldown/plugin-babel": "^0.2.3",
3617
3620
  "@vitest/coverage-v8": "^4.1.7",
3618
3621
  "@xaendar/build-tools": "^${version}",
3619
3622
  "@xaendar/cli": "^${version}",
@@ -3632,7 +3635,10 @@ function tsconfigJson() {
3632
3635
  "target": "ESNext",
3633
3636
  "module": "ESNext",
3634
3637
  "moduleResolution": "bundler",
3635
- "lib": ["ESNext", "DOM", "DOM.Iterable"],
3638
+ "lib": [
3639
+ "ESNext",
3640
+ "DOM"
3641
+ ],
3636
3642
  "outDir": "./dist",
3637
3643
  "rootDir": "./src",
3638
3644
  "declaration": true,
@@ -3648,15 +3654,19 @@ function tsconfigJson() {
3648
3654
  }
3649
3655
  },
3650
3656
  "include": ["src/**/*.ts"],
3651
- "exclude": ["dist", "node_modules", "**/*.spec.ts"]
3652
- }
3653
- `;
3657
+ "exclude": [
3658
+ "dist",
3659
+ "node_modules",
3660
+ "**/*.spec.ts"
3661
+ ]
3662
+ }`;
3654
3663
  }
3655
3664
 
3656
3665
  // ../packages/cli/src/commands/new/templates/vite-config-ts.ts
3657
3666
  function viteConfigTs() {
3658
- return `import { defineConfig } from 'vite';
3659
- import { xaendarPlugin } from '@xaendar/build-tools';
3667
+ return `import babel from "@rolldown/plugin-babel";
3668
+ import { xaendarPlugin } from "@xaendar/build-tools";
3669
+ import { defineConfig } from 'vite';
3660
3670
 
3661
3671
  export default defineConfig({
3662
3672
  root: 'src',
@@ -3664,9 +3674,29 @@ export default defineConfig({
3664
3674
  open: true,
3665
3675
  port: 4200
3666
3676
  },
3667
- plugins: [xaendarPlugin()],
3668
- });
3669
- `;
3677
+ plugins: [
3678
+ babel({
3679
+ presets: [
3680
+ {
3681
+ preset: () => ({
3682
+ plugins: [
3683
+ [
3684
+ "@babel/plugin-proposal-decorators",
3685
+ { version: "2023-11" }
3686
+ ]
3687
+ ]
3688
+ }),
3689
+ rolldown: {
3690
+ filter: {
3691
+ code: "@"
3692
+ }
3693
+ }
3694
+ }
3695
+ ]
3696
+ }),
3697
+ xaendarPlugin()
3698
+ ]
3699
+ });`;
3670
3700
  }
3671
3701
 
3672
3702
  // ../packages/cli/src/commands/new/templates/xaendar-json.ts
@@ -3681,8 +3711,7 @@ function xaendarJson(name, style) {
3681
3711
  "style": "${style}"
3682
3712
  }
3683
3713
  }
3684
- }
3685
- `;
3714
+ }`;
3686
3715
  }
3687
3716
 
3688
3717
  // ../packages/cli/src/commands/new/structure.ts
@@ -3700,17 +3729,18 @@ function readCliVersion() {
3700
3729
  }
3701
3730
  function buildStructure(context) {
3702
3731
  const version = readCliVersion();
3703
- const componentName = context.name;
3732
+ const name = context.name;
3733
+ const componentName = `${name}-root`;
3704
3734
  return [
3705
3735
  {
3706
3736
  type: "file",
3707
3737
  name: "package.json",
3708
- content: packageJson(componentName, version)
3738
+ content: packageJson(name, version)
3709
3739
  },
3710
3740
  {
3711
3741
  type: "file",
3712
3742
  name: "xaendar.json",
3713
- content: xaendarJson(componentName, context.style)
3743
+ content: xaendarJson(name, context.style)
3714
3744
  },
3715
3745
  {
3716
3746
  type: "file",