From 0a6a033d13336e71e152eca26d91cdb5442006fb Mon Sep 17 00:00:00 2001 From: Clovis Muneza Date: Thu, 18 Dec 2025 00:22:02 -0500 Subject: [PATCH 1/4] allows configuring inline slot name normalization --- src/document/transformOptions.ts | 1 + src/document/transformer.ts | 10 +++--- src/formatting/optionDiscovery.ts | 13 +++++-- src/test/formatter_component_tags.test.ts | 36 +++++++++++++++++++ .../formatter_pint_component_tags.test.ts | 36 +++++++++++++++++++ 5 files changed, 89 insertions(+), 7 deletions(-) diff --git a/src/document/transformOptions.ts b/src/document/transformOptions.ts index 00ec4e1..845ee5a 100644 --- a/src/document/transformOptions.ts +++ b/src/document/transformOptions.ts @@ -21,4 +21,5 @@ export interface TransformOptions { safeWrappingJsAttributes: string[], includeJsAttributes: string[], excludeJsAttributes: string[], + normalizeInlineSlotNames: boolean, } \ No newline at end of file diff --git a/src/document/transformer.ts b/src/document/transformer.ts index 7342b89..f2f1e3d 100644 --- a/src/document/transformer.ts +++ b/src/document/transformer.ts @@ -199,7 +199,8 @@ export class Transformer { ], includeJsAttributes: [ '^x-' - ] + ], + normalizeInlineSlotNames: true, } constructor(doc: BladeDocument) { @@ -615,9 +616,10 @@ export class Transformer { const open = ` { test('it formats simple component tags', async () => { @@ -58,6 +59,41 @@ suite('Component Tags', () => { ` ); }); + + test('it does not normalize closing tag name', async () => { + assert.strictEqual( + (await formatBladeString(` +

Content

+
`, {...defaultSettings, normalizeInlineSlotNames: false})).trim(), + ` +

Content

+
` + ); + + assert.strictEqual( + (await formatBladeString(` +

Content

+
`, {...defaultSettings, normalizeInlineSlotNames: false})).trim(), + ` +

Content

+
` + ); + + assert.strictEqual( + (await formatBladeString(` +

Content

+
`, {...defaultSettings, normalizeInlineSlotNames: false})).trim(), + ` +

Content

+
` + ); + }); test('it normalizes names', async () => { assert.strictEqual( diff --git a/src/test/formatter_pint_component_tags.test.ts b/src/test/formatter_pint_component_tags.test.ts index f9e14ed..c153098 100644 --- a/src/test/formatter_pint_component_tags.test.ts +++ b/src/test/formatter_pint_component_tags.test.ts @@ -1,5 +1,6 @@ import assert from 'assert'; import { formatBladeStringWithPint } from '../formatting/prettier/utils.js'; +import { defaultSettings } from '../formatting/optionDiscovery.js'; suite('Pint Transformer: Component Tags', () => { test('pint: it formats simple component tags', async () => { @@ -58,6 +59,41 @@ suite('Pint Transformer: Component Tags', () => { ` ); }); + + test('pint: it does not normalize inline name pairs', async () => { + assert.strictEqual( + (await formatBladeStringWithPint(` +

Content

+
`, {...defaultSettings, normalizeInlineSlotNames: false})).trim(), + ` +

Content

+
` + ); + + assert.strictEqual( + (await formatBladeStringWithPint(` +

Content

+
`, {...defaultSettings, normalizeInlineSlotNames: false})).trim(), + ` +

Content

+
` + ); + + assert.strictEqual( + (await formatBladeStringWithPint(` +

Content

+
`, {...defaultSettings, normalizeInlineSlotNames: false})).trim(), + ` +

Content

+
` + ); + }); test('pint: it normalizes names', async () => { assert.strictEqual( From d31ebdafc850401197adb5897ae24ffa92f9e95d Mon Sep 17 00:00:00 2001 From: Clovis Muneza Date: Thu, 18 Dec 2025 00:22:15 -0500 Subject: [PATCH 2/4] gh actions tests --- .github/workflow/test.yml | 40 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .github/workflow/test.yml diff --git a/.github/workflow/test.yml b/.github/workflow/test.yml new file mode 100644 index 0000000..6968c7f --- /dev/null +++ b/.github/workflow/test.yml @@ -0,0 +1,40 @@ +name: Test Parser + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +on: + push: + branches: [main] + pull_request: + branches: [main] + workflow_dispatch: + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Node.js 24 + uses: actions/setup-node@v4 + with: + node-version: "24" + cache: "npm" + + - name: Setup PHP 8.2 + uses: shivammathur/setup-php@v2 + with: + php-version: "8.2" + + - name: Install dependencies + run: npm install + + - name: Compile + run: npm run compile + + - name: Run parser tests + run: npx mocha ./out/test/**/*.test.js -u tdd --slow 10000 --timeout 20000 --parallel --colors --dot --reporter dot --colors From 43d9c60ea4144f83dca751c038eb21f714c7e924 Mon Sep 17 00:00:00 2001 From: Clovis Muneza Date: Thu, 18 Dec 2025 00:24:50 -0500 Subject: [PATCH 3/4] wrong directory. oops --- .github/{workflow => workflows}/test.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/{workflow => workflows}/test.yml (100%) diff --git a/.github/workflow/test.yml b/.github/workflows/test.yml similarity index 100% rename from .github/workflow/test.yml rename to .github/workflows/test.yml From 1f492d7ca2bdcc7ba517990dd99dadc54c38b1e0 Mon Sep 17 00:00:00 2001 From: Clovis Muneza Date: Thu, 18 Dec 2025 00:31:02 -0500 Subject: [PATCH 4/4] remove gh action --- .github/workflows/test.yml | 40 -------------------------------------- 1 file changed, 40 deletions(-) delete mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 6968c7f..0000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: Test Parser - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -on: - push: - branches: [main] - pull_request: - branches: [main] - workflow_dispatch: - -jobs: - test: - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Setup Node.js 24 - uses: actions/setup-node@v4 - with: - node-version: "24" - cache: "npm" - - - name: Setup PHP 8.2 - uses: shivammathur/setup-php@v2 - with: - php-version: "8.2" - - - name: Install dependencies - run: npm install - - - name: Compile - run: npm run compile - - - name: Run parser tests - run: npx mocha ./out/test/**/*.test.js -u tdd --slow 10000 --timeout 20000 --parallel --colors --dot --reporter dot --colors