(fn, type)
| 1504 | * @param {1 | 2} type 1 = local, 2 = global |
| 1505 | */ |
| 1506 | const processLocalOrGlobalFunction = (fn, type) => { |
| 1507 | // Replace `local(` / `global(` (and a leading `:` for the `:local(`/`:global(` selector form) with empty. |
| 1508 | const fnStart = A.start(fn); |
| 1509 | const isColon = input.charCodeAt(fnStart - 1) === CC_COLON; |
| 1510 | const openEnd = A.nameEnd(fn) + 1; |
| 1511 | module.addPresentationalDependency( |
| 1512 | new ConstDependency("", [isColon ? fnStart - 1 : fnStart, openEnd]) |
| 1513 | ); |
| 1514 | |
| 1515 | if (type === 1) { |
| 1516 | for (const cv of A.children(fn)) { |
| 1517 | if (A.type(cv) !== NodeType.Ident) continue; |
| 1518 | let identifier = A.unescaped(cv); |
| 1519 | const { |
| 1520 | start: { line: sl, column: sc }, |
| 1521 | end: { line: el, column: ec } |
| 1522 | } = A.loc(cv); |
| 1523 | const isDashedIdent = isDashedIdentifier(identifier); |
| 1524 | if (isDashedIdent) identifier = identifier.slice(2); |
| 1525 | addCssExport( |
| 1526 | sl, |
| 1527 | sc, |
| 1528 | el, |
| 1529 | ec, |
| 1530 | identifier, |
| 1531 | getReexport(identifier), |
| 1532 | [A.start(cv), A.end(cv)], |
| 1533 | true, |
| 1534 | CssIcssExportDependency.EXPORT_MODE.ONCE, |
| 1535 | isDashedIdent |
| 1536 | ? CssIcssExportDependency.EXPORT_TYPE.CUSTOM_VARIABLE |
| 1537 | : CssIcssExportDependency.EXPORT_TYPE.NORMAL |
| 1538 | ); |
| 1539 | } |
| 1540 | } |
| 1541 | |
| 1542 | // Replace the closing `)`. |
| 1543 | module.addPresentationalDependency( |
| 1544 | new ConstDependency("", [A.end(fn) - 1, A.end(fn)]) |
| 1545 | ); |
| 1546 | }; |
| 1547 | |
| 1548 | /** |
| 1549 | * Localize the prelude name of `@keyframes` / `@counter-style` / `@container`: `options.string` takes the first string, `options.identifier` the first ident (a `RegExp` skips matching keywords), `:local()`/`:global()` count as found; top-level `var()`/`style()` dashed idents are always ICSS-processed. |
nothing calls this directly
no test coverage detected