Home / Function/ testSourceInput() — vite Function Reference

testSourceInput() — vite Function Reference

Architecture documentation for the testSourceInput() function in lightningcss-plugins.js from the vite codebase.

Entity Profile

Dependency Diagram

graph TD
  e279821c_0f30_c98f_5f59_97b3f04cbb07["testSourceInput()"]
  c618defc_3b57_317d_60a6_8c85cb7f6060["lightningcss-plugins.js"]
  e279821c_0f30_c98f_5f59_97b3f04cbb07 -->|defined in| c618defc_3b57_317d_60a6_8c85cb7f6060
  style e279821c_0f30_c98f_5f59_97b3f04cbb07 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

playground/css/lightningcss-plugins.js lines 59–108

export function testSourceInput() {
  /** @type {string[]} */
  let currentStyleSheetSources
  return {
    StyleSheet(stylesheet) {
      currentStyleSheetSources = stylesheet.sources
    },
    Rule: {
      unknown: {
        'source-input': (rule) => {
          const location = rule.loc
          const from = currentStyleSheetSources[location.source_index]
          return [
            {
              type: 'style',
              value: {
                // .source-input::before
                selectors: [
                  [
                    { type: 'class', name: 'source-input' },
                    { type: 'pseudo-element', kind: 'before' },
                  ],
                ],
                // content: ${JSON.stringify(from)};
                declarations: {
                  declarations: [
                    {
                      property: 'custom',
                      value:
                        /** @satisfies {import('lightningcss').CustomProperty} */ ({
                          name: 'content',
                          value: [
                            {
                              type: 'token',
                              value: { type: 'string', value: from },
                            },
                          ],
                        }),
                    },
                  ],
                },
                loc: rule.loc,
              },
            },
          ]
        },
      },
    },
  }
}

Domain

Subdomains

Frequently Asked Questions

What does testSourceInput() do?
testSourceInput() is a function in the vite codebase, defined in playground/css/lightningcss-plugins.js.
Where is testSourceInput() defined?
testSourceInput() is defined in playground/css/lightningcss-plugins.js at line 59.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free