@symbiote-native/css-parser 0.2.1 → 0.2.3

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.
@@ -6,11 +6,11 @@
6
6
  // here has NO index signature: a typo in `styles.typo` is a genuine `error TS2339` under `tsc`/
7
7
  // `vue-tsc`, not a silent runtime miss. Named `<file>.d.ts` (full original filename, extension
8
8
  // appended rather than replaced — e.g. `Card.module.css.d.ts`) so TypeScript's own module
9
- // resolution picks it up for `import styles from './Card.module.css'` without a separate
9
+ // resolution picks it up for a default import of `Card.module.css` without a separate
10
10
  // registration step, the same convention typed-css-modules uses.
11
- import { parseCSS } from "./parser.js";
12
- import { compile, detectLanguage } from "./preprocessors.js";
13
- import { isCssModuleFile } from "./metro-css-module.js";
11
+ import { parseCSS } from "../parser/index.js";
12
+ import { compile, detectLanguage } from "../preprocessors/index.js";
13
+ import { isCssModuleFile } from "../metro-css-module/index.js";
14
14
  const IDENTIFIER_RE = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
15
15
  function formatKey(className) {
16
16
  return IDENTIFIER_RE.test(className) ? className : JSON.stringify(className);
@@ -14,9 +14,9 @@
14
14
  // `--watch` mode for live autocomplete while actively editing styles.
15
15
  import * as fs from 'node:fs/promises';
16
16
  import * as path from 'node:path';
17
- import { isStyleFile } from "./preprocessors.js";
18
- import { isCssModuleFile } from "./metro-css-module.js";
19
- import { generateModuleDts } from "./generate-dts.js";
17
+ import { isStyleFile } from "./preprocessors/index.js";
18
+ import { isCssModuleFile } from "./metro-css-module/index.js";
19
+ import { generateModuleDts } from "./generate-dts/index.js";
20
20
  const SKIPPED_DIR_NAMES = new Set(['node_modules', 'build', '.git']);
21
21
  async function collectModuleStyleFiles(root) {
22
22
  const stat = await fs.stat(root);
@@ -7,7 +7,7 @@
7
7
  // exempt these names, so it re-derives it here with its own minimal regex, independent of the
8
8
  // full CSS-to-style pipeline. Only the single-class form (`:global(.name)`) is recognized,
9
9
  // matching extractClassName's own documented narrower gap for partial/nested :global() wrapping.
10
- import { kebabToCamel } from "./parser.js";
10
+ import { kebabToCamel } from "./parser/index.js";
11
11
  const GLOBAL_SELECTOR_PATTERN = /:global\(\s*\.([a-zA-Z0-9_-]+)\s*\)/g;
12
12
  export function globalClassNamesIn(css) {
13
13
  const names = new Set();
package/build/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
- export { parseCSS, extractClassName, kebabToCamel } from './parser.ts';
2
- export type { ICssParserOptions } from './parser.ts';
1
+ export { parseCSS, extractClassName, kebabToCamel } from './parser/index.ts';
2
+ export type { ICssParserOptions } from './parser/index.ts';
3
3
  export { globalClassNamesIn } from './global-selectors.ts';
4
4
  export { hashFilePath } from './file-scope-id.ts';
5
- export { compileCssFile, isCssModuleFile } from './metro-css-module.ts';
6
- export type { ICompiledCssFile } from './metro-css-module.ts';
7
- export { classNamesToDtsSource, generateModuleDts } from './generate-dts.ts';
8
- export { createCssMetroTransformer, resolveUpstreamTransformer } from './metro-transformer.ts';
9
- export type { IMetroTransformer, IMetroTransformParams } from './metro-transformer.ts';
10
- export { compileScss, compileSass, compileLess, compileStylus, compile, detectLanguage, isStyleFile, } from './preprocessors.ts';
11
- export type { IPreprocessorLanguage } from './preprocessors.ts';
5
+ export { compileCssFile, isCssModuleFile } from './metro-css-module/index.ts';
6
+ export type { ICompiledCssFile } from './metro-css-module/index.ts';
7
+ export { classNamesToDtsSource, generateModuleDts } from './generate-dts/index.ts';
8
+ export { createCssMetroTransformer, resolveUpstreamTransformer, } from './metro-transformer/index.ts';
9
+ export type { IMetroTransformer, IMetroTransformParams } from './metro-transformer/index.ts';
10
+ export { compileScss, compileSass, compileLess, compileStylus, compile, detectLanguage, isStyleFile, } from './preprocessors/index.ts';
11
+ export type { IPreprocessorLanguage } from './preprocessors/index.ts';
package/build/index.js CHANGED
@@ -1,7 +1,7 @@
1
- export { parseCSS, extractClassName, kebabToCamel } from "./parser.js";
1
+ export { parseCSS, extractClassName, kebabToCamel } from "./parser/index.js";
2
2
  export { globalClassNamesIn } from "./global-selectors.js";
3
3
  export { hashFilePath } from "./file-scope-id.js";
4
- export { compileCssFile, isCssModuleFile } from "./metro-css-module.js";
5
- export { classNamesToDtsSource, generateModuleDts } from "./generate-dts.js";
6
- export { createCssMetroTransformer, resolveUpstreamTransformer } from "./metro-transformer.js";
7
- export { compileScss, compileSass, compileLess, compileStylus, compile, detectLanguage, isStyleFile, } from "./preprocessors.js";
4
+ export { compileCssFile, isCssModuleFile } from "./metro-css-module/index.js";
5
+ export { classNamesToDtsSource, generateModuleDts } from "./generate-dts/index.js";
6
+ export { createCssMetroTransformer, resolveUpstreamTransformer, } from "./metro-transformer/index.js";
7
+ export { compileScss, compileSass, compileLess, compileStylus, compile, detectLanguage, isStyleFile, } from "./preprocessors/index.js";
@@ -1,4 +1,4 @@
1
- import { type ICssParserOptions } from './parser.ts';
1
+ import { type ICssParserOptions } from '../parser/index.ts';
2
2
  export interface ICompiledCssFile {
3
3
  code: string;
4
4
  }
@@ -1,8 +1,8 @@
1
1
  // Compiles a standalone .css/.scss/.sass/.less/.styl (and their .module.* twins) file into a
2
2
  // plain JS module — the framework-agnostic twin of a Vue SFC's inline <style>/<style module>
3
3
  // block (examples/vue-sfc/metro-vue-transformer.js), usable from ANY adapter's own source file:
4
- // `import styles from './Card.module.scss'` works the same from a React .tsx, a Vue <script>, or
5
- // an Angular .ts.
4
+ // a default import of `Card.module.scss` works the same from a React .tsx, a Vue <script>, or an
5
+ // Angular .ts.
6
6
  //
7
7
  // A plain style file registers its classes globally, exactly like an unscoped Vue <style>
8
8
  // block — side-effect import only (`import './theme.scss'`), no default export. A `.module.*`
@@ -20,10 +20,10 @@
20
20
  // logic is entirely language-agnostic, it only ever sees `parseCSS`'s plain-CSS output, same as
21
21
  // it always did for a `.css` file.
22
22
  import * as path from 'node:path';
23
- import { parseCSS } from "./parser.js";
24
- import { globalClassNamesIn } from "./global-selectors.js";
25
- import { hashFilePath } from "./file-scope-id.js";
26
- import { compile, detectLanguage } from "./preprocessors.js";
23
+ import { parseCSS } from "../parser/index.js";
24
+ import { globalClassNamesIn } from "../global-selectors.js";
25
+ import { hashFilePath } from "../file-scope-id.js";
26
+ import { compile, detectLanguage } from "../preprocessors/index.js";
27
27
  export function isCssModuleFile(filename) {
28
28
  const ext = path.extname(filename);
29
29
  if (!ext)
@@ -23,8 +23,8 @@
23
23
  // forwards whatever it returns (Promise or not) as this function's own resolved value with no
24
24
  // extra `await` needed; Metro awaits the whole chain regardless.
25
25
  import { createRequire } from 'node:module';
26
- import { compileCssFile } from "./metro-css-module.js";
27
- import { isStyleFile } from "./preprocessors.js";
26
+ import { compileCssFile } from "../metro-css-module/index.js";
27
+ import { isStyleFile } from "../preprocessors/index.js";
28
28
  // @react-native/metro-babel-transformer is a real `dependency` of this package (not merely a
29
29
  // peer/dev dep), so it lands in css-parser's OWN resolvable node_modules under pnpm — no
30
30
  // hoisting or `paths`-anchored require.resolve trick needed, unlike the app-local workaround
@@ -5,8 +5,8 @@
5
5
  // targets RN's `ViewStyle`/`TextStyle`.
6
6
  import postcss from 'postcss';
7
7
  import valueParser from 'postcss-value-parser';
8
- import { mapCSSProperty } from "./properties.js";
9
- import { REM_TO_PX } from "./values.js";
8
+ import { mapCSSProperty } from "../properties.js";
9
+ import { REM_TO_PX } from "../values.js";
10
10
  //#region Selector utilities
11
11
  // Exported: the SFC style compiler (metro-vue-transformer.js) reuses this exact conversion to
12
12
  // normalize a template's kebab-case class="section-label" authoring to the camelCase key this
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@symbiote-native/css-parser",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "Build-time CSS/SCSS/Less/Stylus compiler for SymbioteNative — compiles stylesheets to React Native style objects, resolved at runtime via a cross-adapter class-name registry.",
5
+ "license": "MIT",
5
6
  "repository": {
6
7
  "type": "git",
7
8
  "url": "git+https://github.com/OneEyed1366/symbiote-native.git",
File without changes