Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions scripts/check-keyed-text-bounds.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ import { dirname, join, relative, resolve, sep } from 'node:path';
import { fileURLToPath } from 'node:url';

import { isEntrypoint } from './invoked-as.mjs';
import { blank, scanSource } from './js-comment-mask.mjs';
import { blank, maskComments, maskCommentsAndLiterals, scanSource } from './js-comment-mask.mjs';

// ── The self-test's own battery roster and floor (#13489) ──────────────────
//
Expand Down Expand Up @@ -398,11 +398,13 @@ function unhintedFiles(relPaths) {
* READ from. `struct` additionally has literal CONTENT blanked, delimiters
* kept: it is what brackets are COUNTED on, so a `{` inside a string cannot
* move the parse.
*
* Both are `js-comment-mask.mjs`'s own exports (#15776) rather than a
* composition re-derived here.
*/
function project(source) {
const { comment, literal } = scanSource(source);
const masked = blank(source, comment);
return { masked, struct: blank(masked, literal) };
const masked = maskComments(source);
return { masked, struct: maskCommentsAndLiterals(source) };
}

const OPEN_TO_CLOSE = { '(': ')', '{': '}', '[': ']' };
Expand Down
11 changes: 6 additions & 5 deletions scripts/check-runner-env-posture.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ import { readFileSync, readdirSync, statSync, existsSync } from 'node:fs';
import { join, relative, resolve, sep } from 'node:path';
import { fileURLToPath } from 'node:url';

import { scanSource, blank } from './js-comment-mask.mjs';
import { maskComments, maskCommentsAndLiterals } from './js-comment-mask.mjs';
import { isEntrypoint } from './invoked-as.mjs';

// ── The self-test's own battery roster and floor (#13489) ──────────────────
Expand Down Expand Up @@ -254,12 +254,13 @@ export const RUNNER_ENV_BRACKET_PATTERN =
*
* Offsets are preserved by both maskings, so a reported line number still
* points at the real line.
*
* Both are `js-comment-mask.mjs`'s own exports (#15776) rather than a
* composition re-derived here.
*/
export function findRunnerEnvReads(source) {
const flags = scanSource(source);

const commentMasked = blank(source, flags.comment);
const bothMasked = blank(commentMasked, flags.literal);
const commentMasked = maskComments(source);
const bothMasked = maskCommentsAndLiterals(source);

const seen = new Set();
const out = [];
Expand Down
8 changes: 5 additions & 3 deletions scripts/check-widget-option-census.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ import { fileURLToPath } from 'node:url';
import process from 'node:process';

import { isEntrypoint } from './invoked-as.mjs';
import { blank, scanSource } from './js-comment-mask.mjs';
import { maskCommentsAndLiterals } from './js-comment-mask.mjs';

const HERE = dirname(fileURLToPath(import.meta.url));
const REPO_ROOT = resolve(HERE, '..');
Expand Down Expand Up @@ -179,10 +179,12 @@ const NON_DECLARED_MEMBERS = [
*
* Delimiters survive (the scanner flags literal content, not its quotes), so a
* quoted object key and an array of string literals are both still locatable.
*
* `js-comment-mask.mjs`'s own `maskCommentsAndLiterals` (#15776), not a
* composition re-derived here.
*/
export function structureMask(source) {
const flags = scanSource(source);
return blank(blank(source, flags.comment), flags.literal);
return maskCommentsAndLiterals(source);
}

/**
Expand Down
Loading