Add a process.exit after storing caches (#37)

Fixes #36
This commit is contained in:
Chris Gray 2024-09-23 12:50:02 -07:00 committed by GitHub
parent 0d27eba2b7
commit 5d804ff512
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 400 additions and 210 deletions

297
dist/main/index.js vendored
View file

@ -5140,7 +5140,7 @@ function hashFiles(patterns, currentWorkspace = '', options, verbose = false) {
followSymbolicLinks = options.followSymbolicLinks; followSymbolicLinks = options.followSymbolicLinks;
} }
const globber = yield create(patterns, { followSymbolicLinks }); const globber = yield create(patterns, { followSymbolicLinks });
return internal_hash_files_1.hashFiles(globber, currentWorkspace, verbose); return (0, internal_hash_files_1.hashFiles)(globber, currentWorkspace, verbose);
}); });
} }
exports.hashFiles = hashFiles; exports.hashFiles = hashFiles;
@ -5155,7 +5155,11 @@ exports.hashFiles = hashFiles;
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k; if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) { }) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k; if (k2 === undefined) k2 = k;
o[k2] = m[k]; o[k2] = m[k];
@ -5168,7 +5172,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
var __importStar = (this && this.__importStar) || function (mod) { var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod; if (mod && mod.__esModule) return mod;
var result = {}; var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod); __setModuleDefault(result, mod);
return result; return result;
}; };
@ -5183,7 +5187,8 @@ function getOptions(copy) {
followSymbolicLinks: true, followSymbolicLinks: true,
implicitDescendants: true, implicitDescendants: true,
matchDirectories: true, matchDirectories: true,
omitBrokenSymbolicLinks: true omitBrokenSymbolicLinks: true,
excludeHiddenFiles: false
}; };
if (copy) { if (copy) {
if (typeof copy.followSymbolicLinks === 'boolean') { if (typeof copy.followSymbolicLinks === 'boolean') {
@ -5202,6 +5207,10 @@ function getOptions(copy) {
result.omitBrokenSymbolicLinks = copy.omitBrokenSymbolicLinks; result.omitBrokenSymbolicLinks = copy.omitBrokenSymbolicLinks;
core.debug(`omitBrokenSymbolicLinks '${result.omitBrokenSymbolicLinks}'`); core.debug(`omitBrokenSymbolicLinks '${result.omitBrokenSymbolicLinks}'`);
} }
if (typeof copy.excludeHiddenFiles === 'boolean') {
result.excludeHiddenFiles = copy.excludeHiddenFiles;
core.debug(`excludeHiddenFiles '${result.excludeHiddenFiles}'`);
}
} }
return result; return result;
} }
@ -5217,7 +5226,11 @@ exports.getOptions = getOptions;
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k; if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) { }) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k; if (k2 === undefined) k2 = k;
o[k2] = m[k]; o[k2] = m[k];
@ -5230,7 +5243,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
var __importStar = (this && this.__importStar) || function (mod) { var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod; if (mod && mod.__esModule) return mod;
var result = {}; var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod); __setModuleDefault(result, mod);
return result; return result;
}; };
@ -5284,19 +5297,21 @@ class DefaultGlobber {
return this.searchPaths.slice(); return this.searchPaths.slice();
} }
glob() { glob() {
var e_1, _a; var _a, e_1, _b, _c;
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const result = []; const result = [];
try { try {
for (var _b = __asyncValues(this.globGenerator()), _c; _c = yield _b.next(), !_c.done;) { for (var _d = true, _e = __asyncValues(this.globGenerator()), _f; _f = yield _e.next(), _a = _f.done, !_a; _d = true) {
const itemPath = _c.value; _c = _f.value;
_d = false;
const itemPath = _c;
result.push(itemPath); result.push(itemPath);
} }
} }
catch (e_1_1) { e_1 = { error: e_1_1 }; } catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally { finally {
try { try {
if (_c && !_c.done && (_a = _b.return)) yield _a.call(_b); if (!_d && !_a && (_b = _e.return)) yield _b.call(_e);
} }
finally { if (e_1) throw e_1.error; } finally { if (e_1) throw e_1.error; }
} }
@ -5354,6 +5369,10 @@ class DefaultGlobber {
if (!stats) { if (!stats) {
continue; continue;
} }
// Hidden file or directory?
if (options.excludeHiddenFiles && path.basename(item.path).match(/^\./)) {
continue;
}
// Directory // Directory
if (stats.isDirectory()) { if (stats.isDirectory()) {
// Matched // Matched
@ -5459,7 +5478,11 @@ exports.DefaultGlobber = DefaultGlobber;
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k; if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) { }) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k; if (k2 === undefined) k2 = k;
o[k2] = m[k]; o[k2] = m[k];
@ -5472,7 +5495,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
var __importStar = (this && this.__importStar) || function (mod) { var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod; if (mod && mod.__esModule) return mod;
var result = {}; var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod); __setModuleDefault(result, mod);
return result; return result;
}; };
@ -5501,19 +5524,21 @@ const stream = __importStar(__nccwpck_require__(2781));
const util = __importStar(__nccwpck_require__(3837)); const util = __importStar(__nccwpck_require__(3837));
const path = __importStar(__nccwpck_require__(1017)); const path = __importStar(__nccwpck_require__(1017));
function hashFiles(globber, currentWorkspace, verbose = false) { function hashFiles(globber, currentWorkspace, verbose = false) {
var e_1, _a; var _a, e_1, _b, _c;
var _b; var _d;
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const writeDelegate = verbose ? core.info : core.debug; const writeDelegate = verbose ? core.info : core.debug;
let hasMatch = false; let hasMatch = false;
const githubWorkspace = currentWorkspace const githubWorkspace = currentWorkspace
? currentWorkspace ? currentWorkspace
: (_b = process.env['GITHUB_WORKSPACE']) !== null && _b !== void 0 ? _b : process.cwd(); : (_d = process.env['GITHUB_WORKSPACE']) !== null && _d !== void 0 ? _d : process.cwd();
const result = crypto.createHash('sha256'); const result = crypto.createHash('sha256');
let count = 0; let count = 0;
try { try {
for (var _c = __asyncValues(globber.globGenerator()), _d; _d = yield _c.next(), !_d.done;) { for (var _e = true, _f = __asyncValues(globber.globGenerator()), _g; _g = yield _f.next(), _a = _g.done, !_a; _e = true) {
const file = _d.value; _c = _g.value;
_e = false;
const file = _c;
writeDelegate(file); writeDelegate(file);
if (!file.startsWith(`${githubWorkspace}${path.sep}`)) { if (!file.startsWith(`${githubWorkspace}${path.sep}`)) {
writeDelegate(`Ignore '${file}' since it is not under GITHUB_WORKSPACE.`); writeDelegate(`Ignore '${file}' since it is not under GITHUB_WORKSPACE.`);
@ -5536,7 +5561,7 @@ function hashFiles(globber, currentWorkspace, verbose = false) {
catch (e_1_1) { e_1 = { error: e_1_1 }; } catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally { finally {
try { try {
if (_d && !_d.done && (_a = _c.return)) yield _a.call(_c); if (!_e && !_a && (_b = _f.return)) yield _b.call(_f);
} }
finally { if (e_1) throw e_1.error; } finally { if (e_1) throw e_1.error; }
} }
@ -5576,7 +5601,7 @@ var MatchKind;
MatchKind[MatchKind["File"] = 2] = "File"; MatchKind[MatchKind["File"] = 2] = "File";
/** Matched */ /** Matched */
MatchKind[MatchKind["All"] = 3] = "All"; MatchKind[MatchKind["All"] = 3] = "All";
})(MatchKind = exports.MatchKind || (exports.MatchKind = {})); })(MatchKind || (exports.MatchKind = MatchKind = {}));
//# sourceMappingURL=internal-match-kind.js.map //# sourceMappingURL=internal-match-kind.js.map
/***/ }), /***/ }),
@ -5588,7 +5613,11 @@ var MatchKind;
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k; if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) { }) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k; if (k2 === undefined) k2 = k;
o[k2] = m[k]; o[k2] = m[k];
@ -5601,7 +5630,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
var __importStar = (this && this.__importStar) || function (mod) { var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod; if (mod && mod.__esModule) return mod;
var result = {}; var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod); __setModuleDefault(result, mod);
return result; return result;
}; };
@ -5651,8 +5680,8 @@ exports.dirname = dirname;
* or `C:` are expanded based on the current working directory. * or `C:` are expanded based on the current working directory.
*/ */
function ensureAbsoluteRoot(root, itemPath) { function ensureAbsoluteRoot(root, itemPath) {
assert_1.default(root, `ensureAbsoluteRoot parameter 'root' must not be empty`); (0, assert_1.default)(root, `ensureAbsoluteRoot parameter 'root' must not be empty`);
assert_1.default(itemPath, `ensureAbsoluteRoot parameter 'itemPath' must not be empty`); (0, assert_1.default)(itemPath, `ensureAbsoluteRoot parameter 'itemPath' must not be empty`);
// Already rooted // Already rooted
if (hasAbsoluteRoot(itemPath)) { if (hasAbsoluteRoot(itemPath)) {
return itemPath; return itemPath;
@ -5662,7 +5691,7 @@ function ensureAbsoluteRoot(root, itemPath) {
// Check for itemPath like C: or C:foo // Check for itemPath like C: or C:foo
if (itemPath.match(/^[A-Z]:[^\\/]|^[A-Z]:$/i)) { if (itemPath.match(/^[A-Z]:[^\\/]|^[A-Z]:$/i)) {
let cwd = process.cwd(); let cwd = process.cwd();
assert_1.default(cwd.match(/^[A-Z]:\\/i), `Expected current directory to start with an absolute drive root. Actual '${cwd}'`); (0, assert_1.default)(cwd.match(/^[A-Z]:\\/i), `Expected current directory to start with an absolute drive root. Actual '${cwd}'`);
// Drive letter matches cwd? Expand to cwd // Drive letter matches cwd? Expand to cwd
if (itemPath[0].toUpperCase() === cwd[0].toUpperCase()) { if (itemPath[0].toUpperCase() === cwd[0].toUpperCase()) {
// Drive only, e.g. C: // Drive only, e.g. C:
@ -5687,11 +5716,11 @@ function ensureAbsoluteRoot(root, itemPath) {
// Check for itemPath like \ or \foo // Check for itemPath like \ or \foo
else if (normalizeSeparators(itemPath).match(/^\\$|^\\[^\\]/)) { else if (normalizeSeparators(itemPath).match(/^\\$|^\\[^\\]/)) {
const cwd = process.cwd(); const cwd = process.cwd();
assert_1.default(cwd.match(/^[A-Z]:\\/i), `Expected current directory to start with an absolute drive root. Actual '${cwd}'`); (0, assert_1.default)(cwd.match(/^[A-Z]:\\/i), `Expected current directory to start with an absolute drive root. Actual '${cwd}'`);
return `${cwd[0]}:\\${itemPath.substr(1)}`; return `${cwd[0]}:\\${itemPath.substr(1)}`;
} }
} }
assert_1.default(hasAbsoluteRoot(root), `ensureAbsoluteRoot parameter 'root' must have an absolute root`); (0, assert_1.default)(hasAbsoluteRoot(root), `ensureAbsoluteRoot parameter 'root' must have an absolute root`);
// Otherwise ensure root ends with a separator // Otherwise ensure root ends with a separator
if (root.endsWith('/') || (IS_WINDOWS && root.endsWith('\\'))) { if (root.endsWith('/') || (IS_WINDOWS && root.endsWith('\\'))) {
// Intentionally empty // Intentionally empty
@ -5708,7 +5737,7 @@ exports.ensureAbsoluteRoot = ensureAbsoluteRoot;
* `\\hello\share` and `C:\hello` (and using alternate separator). * `\\hello\share` and `C:\hello` (and using alternate separator).
*/ */
function hasAbsoluteRoot(itemPath) { function hasAbsoluteRoot(itemPath) {
assert_1.default(itemPath, `hasAbsoluteRoot parameter 'itemPath' must not be empty`); (0, assert_1.default)(itemPath, `hasAbsoluteRoot parameter 'itemPath' must not be empty`);
// Normalize separators // Normalize separators
itemPath = normalizeSeparators(itemPath); itemPath = normalizeSeparators(itemPath);
// Windows // Windows
@ -5725,7 +5754,7 @@ exports.hasAbsoluteRoot = hasAbsoluteRoot;
* `\`, `\hello`, `\\hello\share`, `C:`, and `C:\hello` (and using alternate separator). * `\`, `\hello`, `\\hello\share`, `C:`, and `C:\hello` (and using alternate separator).
*/ */
function hasRoot(itemPath) { function hasRoot(itemPath) {
assert_1.default(itemPath, `isRooted parameter 'itemPath' must not be empty`); (0, assert_1.default)(itemPath, `isRooted parameter 'itemPath' must not be empty`);
// Normalize separators // Normalize separators
itemPath = normalizeSeparators(itemPath); itemPath = normalizeSeparators(itemPath);
// Windows // Windows
@ -5793,7 +5822,11 @@ exports.safeTrimTrailingSeparator = safeTrimTrailingSeparator;
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k; if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) { }) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k; if (k2 === undefined) k2 = k;
o[k2] = m[k]; o[k2] = m[k];
@ -5806,7 +5839,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
var __importStar = (this && this.__importStar) || function (mod) { var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod; if (mod && mod.__esModule) return mod;
var result = {}; var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod); __setModuleDefault(result, mod);
return result; return result;
}; };
@ -5831,7 +5864,7 @@ class Path {
this.segments = []; this.segments = [];
// String // String
if (typeof itemPath === 'string') { if (typeof itemPath === 'string') {
assert_1.default(itemPath, `Parameter 'itemPath' must not be empty`); (0, assert_1.default)(itemPath, `Parameter 'itemPath' must not be empty`);
// Normalize slashes and trim unnecessary trailing slash // Normalize slashes and trim unnecessary trailing slash
itemPath = pathHelper.safeTrimTrailingSeparator(itemPath); itemPath = pathHelper.safeTrimTrailingSeparator(itemPath);
// Not rooted // Not rooted
@ -5858,24 +5891,24 @@ class Path {
// Array // Array
else { else {
// Must not be empty // Must not be empty
assert_1.default(itemPath.length > 0, `Parameter 'itemPath' must not be an empty array`); (0, assert_1.default)(itemPath.length > 0, `Parameter 'itemPath' must not be an empty array`);
// Each segment // Each segment
for (let i = 0; i < itemPath.length; i++) { for (let i = 0; i < itemPath.length; i++) {
let segment = itemPath[i]; let segment = itemPath[i];
// Must not be empty // Must not be empty
assert_1.default(segment, `Parameter 'itemPath' must not contain any empty segments`); (0, assert_1.default)(segment, `Parameter 'itemPath' must not contain any empty segments`);
// Normalize slashes // Normalize slashes
segment = pathHelper.normalizeSeparators(itemPath[i]); segment = pathHelper.normalizeSeparators(itemPath[i]);
// Root segment // Root segment
if (i === 0 && pathHelper.hasRoot(segment)) { if (i === 0 && pathHelper.hasRoot(segment)) {
segment = pathHelper.safeTrimTrailingSeparator(segment); segment = pathHelper.safeTrimTrailingSeparator(segment);
assert_1.default(segment === pathHelper.dirname(segment), `Parameter 'itemPath' root segment contains information for multiple segments`); (0, assert_1.default)(segment === pathHelper.dirname(segment), `Parameter 'itemPath' root segment contains information for multiple segments`);
this.segments.push(segment); this.segments.push(segment);
} }
// All other segments // All other segments
else { else {
// Must not contain slash // Must not contain slash
assert_1.default(!segment.includes(path.sep), `Parameter 'itemPath' contains unexpected path separators`); (0, assert_1.default)(!segment.includes(path.sep), `Parameter 'itemPath' contains unexpected path separators`);
this.segments.push(segment); this.segments.push(segment);
} }
} }
@ -5913,7 +5946,11 @@ exports.Path = Path;
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k; if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) { }) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k; if (k2 === undefined) k2 = k;
o[k2] = m[k]; o[k2] = m[k];
@ -5926,7 +5963,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
var __importStar = (this && this.__importStar) || function (mod) { var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod; if (mod && mod.__esModule) return mod;
var result = {}; var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod); __setModuleDefault(result, mod);
return result; return result;
}; };
@ -6014,7 +6051,11 @@ exports.partialMatch = partialMatch;
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k; if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) { }) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k; if (k2 === undefined) k2 = k;
o[k2] = m[k]; o[k2] = m[k];
@ -6027,7 +6068,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
var __importStar = (this && this.__importStar) || function (mod) { var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod; if (mod && mod.__esModule) return mod;
var result = {}; var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod); __setModuleDefault(result, mod);
return result; return result;
}; };
@ -6059,9 +6100,9 @@ class Pattern {
else { else {
// Convert to pattern // Convert to pattern
segments = segments || []; segments = segments || [];
assert_1.default(segments.length, `Parameter 'segments' must not empty`); (0, assert_1.default)(segments.length, `Parameter 'segments' must not empty`);
const root = Pattern.getLiteral(segments[0]); const root = Pattern.getLiteral(segments[0]);
assert_1.default(root && pathHelper.hasAbsoluteRoot(root), `Parameter 'segments' first element must be a root path`); (0, assert_1.default)(root && pathHelper.hasAbsoluteRoot(root), `Parameter 'segments' first element must be a root path`);
pattern = new internal_path_1.Path(segments).toString().trim(); pattern = new internal_path_1.Path(segments).toString().trim();
if (patternOrNegate) { if (patternOrNegate) {
pattern = `!${pattern}`; pattern = `!${pattern}`;
@ -6155,13 +6196,13 @@ class Pattern {
*/ */
static fixupPattern(pattern, homedir) { static fixupPattern(pattern, homedir) {
// Empty // Empty
assert_1.default(pattern, 'pattern cannot be empty'); (0, assert_1.default)(pattern, 'pattern cannot be empty');
// Must not contain `.` segment, unless first segment // Must not contain `.` segment, unless first segment
// Must not contain `..` segment // Must not contain `..` segment
const literalSegments = new internal_path_1.Path(pattern).segments.map(x => Pattern.getLiteral(x)); const literalSegments = new internal_path_1.Path(pattern).segments.map(x => Pattern.getLiteral(x));
assert_1.default(literalSegments.every((x, i) => (x !== '.' || i === 0) && x !== '..'), `Invalid pattern '${pattern}'. Relative pathing '.' and '..' is not allowed.`); (0, assert_1.default)(literalSegments.every((x, i) => (x !== '.' || i === 0) && x !== '..'), `Invalid pattern '${pattern}'. Relative pathing '.' and '..' is not allowed.`);
// Must not contain globs in root, e.g. Windows UNC path \\foo\b*r // Must not contain globs in root, e.g. Windows UNC path \\foo\b*r
assert_1.default(!pathHelper.hasRoot(pattern) || literalSegments[0], `Invalid pattern '${pattern}'. Root segment must not contain globs.`); (0, assert_1.default)(!pathHelper.hasRoot(pattern) || literalSegments[0], `Invalid pattern '${pattern}'. Root segment must not contain globs.`);
// Normalize slashes // Normalize slashes
pattern = pathHelper.normalizeSeparators(pattern); pattern = pathHelper.normalizeSeparators(pattern);
// Replace leading `.` segment // Replace leading `.` segment
@ -6171,8 +6212,8 @@ class Pattern {
// Replace leading `~` segment // Replace leading `~` segment
else if (pattern === '~' || pattern.startsWith(`~${path.sep}`)) { else if (pattern === '~' || pattern.startsWith(`~${path.sep}`)) {
homedir = homedir || os.homedir(); homedir = homedir || os.homedir();
assert_1.default(homedir, 'Unable to determine HOME directory'); (0, assert_1.default)(homedir, 'Unable to determine HOME directory');
assert_1.default(pathHelper.hasAbsoluteRoot(homedir), `Expected HOME directory to be a rooted path. Actual '${homedir}'`); (0, assert_1.default)(pathHelper.hasAbsoluteRoot(homedir), `Expected HOME directory to be a rooted path. Actual '${homedir}'`);
pattern = Pattern.globEscape(homedir) + pattern.substr(1); pattern = Pattern.globEscape(homedir) + pattern.substr(1);
} }
// Replace relative drive root, e.g. pattern is C: or C:foo // Replace relative drive root, e.g. pattern is C: or C:foo
@ -88406,10 +88447,23 @@ function resolveCollection(CN, ctx, token, onError, tagName, tag) {
coll.tag = tagName; coll.tag = tagName;
return coll; return coll;
} }
function composeCollection(CN, ctx, token, tagToken, onError) { function composeCollection(CN, ctx, token, props, onError) {
const tagToken = props.tag;
const tagName = !tagToken const tagName = !tagToken
? null ? null
: ctx.directives.tagName(tagToken.source, msg => onError(tagToken, 'TAG_RESOLVE_FAILED', msg)); : ctx.directives.tagName(tagToken.source, msg => onError(tagToken, 'TAG_RESOLVE_FAILED', msg));
if (token.type === 'block-seq') {
const { anchor, newlineAfterProp: nl } = props;
const lastProp = anchor && tagToken
? anchor.offset > tagToken.offset
? anchor
: tagToken
: (anchor ?? tagToken);
if (lastProp && (!nl || nl.offset < lastProp.offset)) {
const message = 'Missing newline after block sequence props';
onError(lastProp, 'MISSING_CHAR', message);
}
}
const expType = token.type === 'block-map' const expType = token.type === 'block-map'
? 'map' ? 'map'
: token.type === 'block-seq' : token.type === 'block-seq'
@ -88423,8 +88477,7 @@ function composeCollection(CN, ctx, token, tagToken, onError) {
!tagName || !tagName ||
tagName === '!' || tagName === '!' ||
(tagName === YAMLMap.YAMLMap.tagName && expType === 'map') || (tagName === YAMLMap.YAMLMap.tagName && expType === 'map') ||
(tagName === YAMLSeq.YAMLSeq.tagName && expType === 'seq') || (tagName === YAMLSeq.YAMLSeq.tagName && expType === 'seq')) {
!expType) {
return resolveCollection(CN, ctx, token, onError, tagName); return resolveCollection(CN, ctx, token, onError, tagName);
} }
let tag = ctx.schema.tags.find(t => t.tag === tagName && t.collection === expType); let tag = ctx.schema.tags.find(t => t.tag === tagName && t.collection === expType);
@ -88486,6 +88539,7 @@ function composeDoc(options, directives, { offset, start, value, end }, onError)
next: value ?? end?.[0], next: value ?? end?.[0],
offset, offset,
onError, onError,
parentIndent: 0,
startOnNewline: true startOnNewline: true
}); });
if (props.found) { if (props.found) {
@ -88546,7 +88600,7 @@ function composeNode(ctx, token, props, onError) {
case 'block-map': case 'block-map':
case 'block-seq': case 'block-seq':
case 'flow-collection': case 'flow-collection':
node = composeCollection.composeCollection(CN, ctx, token, tag, onError); node = composeCollection.composeCollection(CN, ctx, token, props, onError);
if (anchor) if (anchor)
node.anchor = anchor.source.substring(1); node.anchor = anchor.source.substring(1);
break; break;
@ -88628,7 +88682,7 @@ var resolveFlowScalar = __nccwpck_require__(261);
function composeScalar(ctx, token, tagToken, onError) { function composeScalar(ctx, token, tagToken, onError) {
const { value, type, comment, range } = token.type === 'block-scalar' const { value, type, comment, range } = token.type === 'block-scalar'
? resolveBlockScalar.resolveBlockScalar(token, ctx.options.strict, onError) ? resolveBlockScalar.resolveBlockScalar(ctx, token, onError)
: resolveFlowScalar.resolveFlowScalar(token, ctx.options.strict, onError); : resolveFlowScalar.resolveFlowScalar(token, ctx.options.strict, onError);
const tagName = tagToken const tagName = tagToken
? ctx.directives.tagName(tagToken.source, msg => onError(tagToken, 'TAG_RESOLVE_FAILED', msg)) ? ctx.directives.tagName(tagToken.source, msg => onError(tagToken, 'TAG_RESOLVE_FAILED', msg))
@ -88963,6 +89017,7 @@ function resolveBlockMap({ composeNode, composeEmptyNode }, ctx, bm, onError, ta
next: key ?? sep?.[0], next: key ?? sep?.[0],
offset, offset,
onError, onError,
parentIndent: bm.indent,
startOnNewline: true startOnNewline: true
}); });
const implicitKey = !keyProps.found; const implicitKey = !keyProps.found;
@ -88983,7 +89038,7 @@ function resolveBlockMap({ composeNode, composeEmptyNode }, ctx, bm, onError, ta
} }
continue; continue;
} }
if (keyProps.hasNewlineAfterProp || utilContainsNewline.containsNewline(key)) { if (keyProps.newlineAfterProp || utilContainsNewline.containsNewline(key)) {
onError(key ?? start[start.length - 1], 'MULTILINE_IMPLICIT_KEY', 'Implicit keys need to be on a single line'); onError(key ?? start[start.length - 1], 'MULTILINE_IMPLICIT_KEY', 'Implicit keys need to be on a single line');
} }
} }
@ -89005,6 +89060,7 @@ function resolveBlockMap({ composeNode, composeEmptyNode }, ctx, bm, onError, ta
next: value, next: value,
offset: keyNode.range[2], offset: keyNode.range[2],
onError, onError,
parentIndent: bm.indent,
startOnNewline: !key || key.type === 'block-scalar' startOnNewline: !key || key.type === 'block-scalar'
}); });
offset = valueProps.end; offset = valueProps.end;
@ -89063,9 +89119,9 @@ exports.resolveBlockMap = resolveBlockMap;
var Scalar = __nccwpck_require__(9338); var Scalar = __nccwpck_require__(9338);
function resolveBlockScalar(scalar, strict, onError) { function resolveBlockScalar(ctx, scalar, onError) {
const start = scalar.offset; const start = scalar.offset;
const header = parseBlockScalarHeader(scalar, strict, onError); const header = parseBlockScalarHeader(scalar, ctx.options.strict, onError);
if (!header) if (!header)
return { value: '', type: null, comment: '', range: [start, start, start] }; return { value: '', type: null, comment: '', range: [start, start, start] };
const type = header.mode === '>' ? Scalar.Scalar.BLOCK_FOLDED : Scalar.Scalar.BLOCK_LITERAL; const type = header.mode === '>' ? Scalar.Scalar.BLOCK_FOLDED : Scalar.Scalar.BLOCK_LITERAL;
@ -89107,6 +89163,10 @@ function resolveBlockScalar(scalar, strict, onError) {
if (header.indent === 0) if (header.indent === 0)
trimIndent = indent.length; trimIndent = indent.length;
contentStart = i; contentStart = i;
if (trimIndent === 0 && !ctx.atRoot) {
const message = 'Block scalar values in collections must be indented';
onError(offset, 'BAD_INDENT', message);
}
break; break;
} }
offset += indent.length + content.length + 1; offset += indent.length + content.length + 1;
@ -89282,6 +89342,7 @@ function resolveBlockSeq({ composeNode, composeEmptyNode }, ctx, bs, onError, ta
next: value, next: value,
offset, offset,
onError, onError,
parentIndent: bs.indent,
startOnNewline: true startOnNewline: true
}); });
if (!props.found) { if (!props.found) {
@ -89398,6 +89459,7 @@ function resolveFlowCollection({ composeNode, composeEmptyNode }, ctx, fc, onErr
next: key ?? sep?.[0], next: key ?? sep?.[0],
offset, offset,
onError, onError,
parentIndent: fc.indent,
startOnNewline: false startOnNewline: false
}); });
if (!props.found) { if (!props.found) {
@ -89479,6 +89541,7 @@ function resolveFlowCollection({ composeNode, composeEmptyNode }, ctx, fc, onErr
next: value, next: value,
offset: keyNode.range[2], offset: keyNode.range[2],
onError, onError,
parentIndent: fc.indent,
startOnNewline: false startOnNewline: false
}); });
if (valueProps.found) { if (valueProps.found) {
@ -89531,6 +89594,8 @@ function resolveFlowCollection({ composeNode, composeEmptyNode }, ctx, fc, onErr
const map = new YAMLMap.YAMLMap(ctx.schema); const map = new YAMLMap.YAMLMap(ctx.schema);
map.flow = true; map.flow = true;
map.items.push(pair); map.items.push(pair);
const endRange = (valueNode ?? keyNode).range;
map.range = [keyNode.range[0], endRange[1], endRange[2]];
coll.items.push(map); coll.items.push(map);
} }
offset = valueNode ? valueNode.range[2] : valueProps.end; offset = valueNode ? valueNode.range[2] : valueProps.end;
@ -89663,7 +89728,7 @@ function foldLines(source) {
first = new RegExp('(.*?)(?<![ \t])[ \t]*\r?\n', 'sy'); first = new RegExp('(.*?)(?<![ \t])[ \t]*\r?\n', 'sy');
line = new RegExp('[ \t]*(.*?)(?:(?<![ \t])[ \t]*)?\r?\n', 'sy'); line = new RegExp('[ \t]*(.*?)(?:(?<![ \t])[ \t]*)?\r?\n', 'sy');
} }
catch (_) { catch {
first = /(.*?)[ \t]*\r?\n/sy; first = /(.*?)[ \t]*\r?\n/sy;
line = /[ \t]*(.*?)[ \t]*\r?\n/sy; line = /[ \t]*(.*?)[ \t]*\r?\n/sy;
} }
@ -89810,17 +89875,18 @@ exports.resolveFlowScalar = resolveFlowScalar;
"use strict"; "use strict";
function resolveProps(tokens, { flow, indicator, next, offset, onError, startOnNewline }) { function resolveProps(tokens, { flow, indicator, next, offset, onError, parentIndent, startOnNewline }) {
let spaceBefore = false; let spaceBefore = false;
let atNewline = startOnNewline; let atNewline = startOnNewline;
let hasSpace = startOnNewline; let hasSpace = startOnNewline;
let comment = ''; let comment = '';
let commentSep = ''; let commentSep = '';
let hasNewline = false; let hasNewline = false;
let hasNewlineAfterProp = false;
let reqSpace = false; let reqSpace = false;
let tab = null;
let anchor = null; let anchor = null;
let tag = null; let tag = null;
let newlineAfterProp = null;
let comma = null; let comma = null;
let found = null; let found = null;
let start = null; let start = null;
@ -89832,16 +89898,22 @@ function resolveProps(tokens, { flow, indicator, next, offset, onError, startOnN
onError(token.offset, 'MISSING_CHAR', 'Tags and anchors must be separated from the next token by white space'); onError(token.offset, 'MISSING_CHAR', 'Tags and anchors must be separated from the next token by white space');
reqSpace = false; reqSpace = false;
} }
if (tab) {
if (atNewline && token.type !== 'comment' && token.type !== 'newline') {
onError(tab, 'TAB_AS_INDENT', 'Tabs are not allowed as indentation');
}
tab = null;
}
switch (token.type) { switch (token.type) {
case 'space': case 'space':
// At the doc level, tabs at line start may be parsed // At the doc level, tabs at line start may be parsed
// as leading white space rather than indentation. // as leading white space rather than indentation.
// In a flow collection, only the parser handles indent. // In a flow collection, only the parser handles indent.
if (!flow && if (!flow &&
atNewline && (indicator !== 'doc-start' || next?.type !== 'flow-collection') &&
indicator !== 'doc-start' && token.source.includes('\t')) {
token.source[0] === '\t') tab = token;
onError(token, 'TAB_AS_INDENT', 'Tabs are not allowed as indentation'); }
hasSpace = true; hasSpace = true;
break; break;
case 'comment': { case 'comment': {
@ -89868,7 +89940,7 @@ function resolveProps(tokens, { flow, indicator, next, offset, onError, startOnN
atNewline = true; atNewline = true;
hasNewline = true; hasNewline = true;
if (anchor || tag) if (anchor || tag)
hasNewlineAfterProp = true; newlineAfterProp = token;
hasSpace = true; hasSpace = true;
break; break;
case 'anchor': case 'anchor':
@ -89901,7 +89973,8 @@ function resolveProps(tokens, { flow, indicator, next, offset, onError, startOnN
if (found) if (found)
onError(token, 'UNEXPECTED_TOKEN', `Unexpected ${token.source} in ${flow ?? 'collection'}`); onError(token, 'UNEXPECTED_TOKEN', `Unexpected ${token.source} in ${flow ?? 'collection'}`);
found = token; found = token;
atNewline = false; atNewline =
indicator === 'seq-item-ind' || indicator === 'explicit-key-ind';
hasSpace = false; hasSpace = false;
break; break;
case 'comma': case 'comma':
@ -89927,17 +90000,23 @@ function resolveProps(tokens, { flow, indicator, next, offset, onError, startOnN
next.type !== 'space' && next.type !== 'space' &&
next.type !== 'newline' && next.type !== 'newline' &&
next.type !== 'comma' && next.type !== 'comma' &&
(next.type !== 'scalar' || next.source !== '')) (next.type !== 'scalar' || next.source !== '')) {
onError(next.offset, 'MISSING_CHAR', 'Tags and anchors must be separated from the next token by white space'); onError(next.offset, 'MISSING_CHAR', 'Tags and anchors must be separated from the next token by white space');
}
if (tab &&
((atNewline && tab.indent <= parentIndent) ||
next?.type === 'block-map' ||
next?.type === 'block-seq'))
onError(tab, 'TAB_AS_INDENT', 'Tabs are not allowed as indentation');
return { return {
comma, comma,
found, found,
spaceBefore, spaceBefore,
comment, comment,
hasNewline, hasNewline,
hasNewlineAfterProp,
anchor, anchor,
tag, tag,
newlineAfterProp,
end, end,
start: start ?? end start: start ?? end
}; };
@ -90529,6 +90608,7 @@ function applyReviver(reviver, obj, key, val) {
for (let i = 0, len = val.length; i < len; ++i) { for (let i = 0, len = val.length; i < len; ++i) {
const v0 = val[i]; const v0 = val[i];
const v1 = applyReviver(reviver, val, String(i), v0); const v1 = applyReviver(reviver, val, String(i), v0);
// eslint-disable-next-line @typescript-eslint/no-array-delete
if (v1 === undefined) if (v1 === undefined)
delete val[i]; delete val[i];
else if (v1 !== v0) else if (v1 !== v0)
@ -90999,8 +91079,6 @@ function debug(logLevel, ...messages) {
} }
function warn(logLevel, warning) { function warn(logLevel, warning) {
if (logLevel === 'debug' || logLevel === 'warn') { if (logLevel === 'debug' || logLevel === 'warn') {
// https://github.com/typescript-eslint/typescript-eslint/issues/7478
// eslint-disable-next-line @typescript-eslint/prefer-optional-chain
if (typeof process !== 'undefined' && process.emitWarning) if (typeof process !== 'undefined' && process.emitWarning)
process.emitWarning(warning); process.emitWarning(warning);
else else
@ -91276,7 +91354,6 @@ class Collection extends Node.NodeBase {
} }
} }
} }
Collection.maxFlowStringSingleLineLength = 60;
exports.Collection = Collection; exports.Collection = Collection;
exports.collectionFromPath = collectionFromPath; exports.collectionFromPath = collectionFromPath;
@ -91941,7 +92018,7 @@ function resolveAsScalar(token, strict = true, onError) {
case 'double-quoted-scalar': case 'double-quoted-scalar':
return resolveFlowScalar.resolveFlowScalar(token, strict, _onError); return resolveFlowScalar.resolveFlowScalar(token, strict, _onError);
case 'block-scalar': case 'block-scalar':
return resolveBlockScalar.resolveBlockScalar(token, strict, _onError); return resolveBlockScalar.resolveBlockScalar({ options: { strict } }, token, _onError);
} }
} }
return null; return null;
@ -92526,11 +92603,11 @@ function isEmpty(ch) {
return false; return false;
} }
} }
const hexDigits = '0123456789ABCDEFabcdef'.split(''); const hexDigits = new Set('0123456789ABCDEFabcdef');
const tagChars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()".split(''); const tagChars = new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()");
const invalidFlowScalarChars = ',[]{}'.split(''); const flowIndicatorChars = new Set(',[]{}');
const invalidAnchorChars = ' ,[]{}\n\r\t'.split(''); const invalidAnchorChars = new Set(' ,[]{}\n\r\t');
const isNotAnchorChar = (ch) => !ch || invalidAnchorChars.includes(ch); const isNotAnchorChar = (ch) => !ch || invalidAnchorChars.has(ch);
/** /**
* Splits an input string into lexical tokens, i.e. smaller strings that are * Splits an input string into lexical tokens, i.e. smaller strings that are
* easily identifiable by `tokens.tokenType()`. * easily identifiable by `tokens.tokenType()`.
@ -92737,15 +92814,11 @@ class Lexer {
if (!this.atEnd && !this.hasChars(4)) if (!this.atEnd && !this.hasChars(4))
return this.setNext('line-start'); return this.setNext('line-start');
const s = this.peek(3); const s = this.peek(3);
if (s === '---' && isEmpty(this.charAt(3))) { if ((s === '---' || s === '...') && isEmpty(this.charAt(3))) {
yield* this.pushCount(3); yield* this.pushCount(3);
this.indentValue = 0; this.indentValue = 0;
this.indentNext = 0; this.indentNext = 0;
return 'doc'; return s === '---' ? 'doc' : 'stream';
}
else if (s === '...' && isEmpty(this.charAt(3))) {
yield* this.pushCount(3);
return 'stream';
} }
} }
this.indentValue = yield* this.pushSpaces(false); this.indentValue = yield* this.pushSpaces(false);
@ -92972,8 +93045,10 @@ class Lexer {
if (indent >= this.indentNext) { if (indent >= this.indentNext) {
if (this.blockScalarIndent === -1) if (this.blockScalarIndent === -1)
this.indentNext = indent; this.indentNext = indent;
else else {
this.indentNext += this.blockScalarIndent; this.indentNext =
this.blockScalarIndent + (this.indentNext === 0 ? 1 : this.indentNext);
}
do { do {
const cs = this.continueScalar(nl + 1); const cs = this.continueScalar(nl + 1);
if (cs === -1) if (cs === -1)
@ -92986,14 +93061,25 @@ class Lexer {
nl = this.buffer.length; nl = this.buffer.length;
} }
} }
if (!this.blockScalarKeep) { // Trailing insufficiently indented tabs are invalid.
// To catch that during parsing, we include them in the block scalar value.
let i = nl + 1;
ch = this.buffer[i];
while (ch === ' ')
ch = this.buffer[++i];
if (ch === '\t') {
while (ch === '\t' || ch === ' ' || ch === '\r' || ch === '\n')
ch = this.buffer[++i];
nl = i - 1;
}
else if (!this.blockScalarKeep) {
do { do {
let i = nl - 1; let i = nl - 1;
let ch = this.buffer[i]; let ch = this.buffer[i];
if (ch === '\r') if (ch === '\r')
ch = this.buffer[--i]; ch = this.buffer[--i];
const lastChar = i; // Drop the line if last char not more indented const lastChar = i; // Drop the line if last char not more indented
while (ch === ' ' || ch === '\t') while (ch === ' ')
ch = this.buffer[--i]; ch = this.buffer[--i];
if (ch === '\n' && i >= this.pos && i + 1 + indent > lastChar) if (ch === '\n' && i >= this.pos && i + 1 + indent > lastChar)
nl = i; nl = i;
@ -93013,7 +93099,7 @@ class Lexer {
while ((ch = this.buffer[++i])) { while ((ch = this.buffer[++i])) {
if (ch === ':') { if (ch === ':') {
const next = this.buffer[i + 1]; const next = this.buffer[i + 1];
if (isEmpty(next) || (inFlow && next === ',')) if (isEmpty(next) || (inFlow && flowIndicatorChars.has(next)))
break; break;
end = i; end = i;
} }
@ -93028,7 +93114,7 @@ class Lexer {
else else
end = i; end = i;
} }
if (next === '#' || (inFlow && invalidFlowScalarChars.includes(next))) if (next === '#' || (inFlow && flowIndicatorChars.has(next)))
break; break;
if (ch === '\n') { if (ch === '\n') {
const cs = this.continueScalar(i + 1); const cs = this.continueScalar(i + 1);
@ -93038,7 +93124,7 @@ class Lexer {
} }
} }
else { else {
if (inFlow && invalidFlowScalarChars.includes(ch)) if (inFlow && flowIndicatorChars.has(ch))
break; break;
end = i; end = i;
} }
@ -93083,7 +93169,7 @@ class Lexer {
case ':': { case ':': {
const inFlow = this.flowLevel > 0; const inFlow = this.flowLevel > 0;
const ch1 = this.charAt(1); const ch1 = this.charAt(1);
if (isEmpty(ch1) || (inFlow && invalidFlowScalarChars.includes(ch1))) { if (isEmpty(ch1) || (inFlow && flowIndicatorChars.has(ch1))) {
if (!inFlow) if (!inFlow)
this.indentNext = this.indentValue + 1; this.indentNext = this.indentValue + 1;
else if (this.flowKey) else if (this.flowKey)
@ -93108,11 +93194,11 @@ class Lexer {
let i = this.pos + 1; let i = this.pos + 1;
let ch = this.buffer[i]; let ch = this.buffer[i];
while (ch) { while (ch) {
if (tagChars.includes(ch)) if (tagChars.has(ch))
ch = this.buffer[++i]; ch = this.buffer[++i];
else if (ch === '%' && else if (ch === '%' &&
hexDigits.includes(this.buffer[i + 1]) && hexDigits.has(this.buffer[i + 1]) &&
hexDigits.includes(this.buffer[i + 2])) { hexDigits.has(this.buffer[i + 2])) {
ch = this.buffer[(i += 3)]; ch = this.buffer[(i += 3)];
} }
else else
@ -93520,7 +93606,7 @@ class Parser {
} }
else { else {
Object.assign(it, { key: token, sep: [] }); Object.assign(it, { key: token, sep: [] });
this.onKeyLine = !includesToken(it.start, 'explicit-key-ind'); this.onKeyLine = !it.explicitKey;
return; return;
} }
break; break;
@ -93729,9 +93815,9 @@ class Parser {
return; return;
} }
if (this.indent >= map.indent) { if (this.indent >= map.indent) {
const atNextItem = !this.onKeyLine && const atMapIndent = !this.onKeyLine && this.indent === map.indent;
this.indent === map.indent && const atNextItem = atMapIndent &&
it.sep && (it.sep || it.explicitKey) &&
this.type !== 'seq-item-ind'; this.type !== 'seq-item-ind';
// For empty nodes, assign newline-separated not indented empty tokens to following node // For empty nodes, assign newline-separated not indented empty tokens to following node
let start = []; let start = [];
@ -93772,25 +93858,26 @@ class Parser {
} }
return; return;
case 'explicit-key-ind': case 'explicit-key-ind':
if (!it.sep && !includesToken(it.start, 'explicit-key-ind')) { if (!it.sep && !it.explicitKey) {
it.start.push(this.sourceToken); it.start.push(this.sourceToken);
it.explicitKey = true;
} }
else if (atNextItem || it.value) { else if (atNextItem || it.value) {
start.push(this.sourceToken); start.push(this.sourceToken);
map.items.push({ start }); map.items.push({ start, explicitKey: true });
} }
else { else {
this.stack.push({ this.stack.push({
type: 'block-map', type: 'block-map',
offset: this.offset, offset: this.offset,
indent: this.indent, indent: this.indent,
items: [{ start: [this.sourceToken] }] items: [{ start: [this.sourceToken], explicitKey: true }]
}); });
} }
this.onKeyLine = true; this.onKeyLine = true;
return; return;
case 'map-value-ind': case 'map-value-ind':
if (includesToken(it.start, 'explicit-key-ind')) { if (it.explicitKey) {
if (!it.sep) { if (!it.sep) {
if (includesToken(it.start, 'newline')) { if (includesToken(it.start, 'newline')) {
Object.assign(it, { key: null, sep: [this.sourceToken] }); Object.assign(it, { key: null, sep: [this.sourceToken] });
@ -93823,7 +93910,9 @@ class Parser {
const sep = it.sep; const sep = it.sep;
sep.push(this.sourceToken); sep.push(this.sourceToken);
// @ts-expect-error type guard is wrong here // @ts-expect-error type guard is wrong here
delete it.key, delete it.sep; delete it.key;
// @ts-expect-error type guard is wrong here
delete it.sep;
this.stack.push({ this.stack.push({
type: 'block-map', type: 'block-map',
offset: this.offset, offset: this.offset,
@ -93881,9 +93970,7 @@ class Parser {
default: { default: {
const bv = this.startBlockValue(map); const bv = this.startBlockValue(map);
if (bv) { if (bv) {
if (atNextItem && if (atMapIndent && bv.type !== 'block-seq') {
bv.type !== 'block-seq' &&
includesToken(it.start, 'explicit-key-ind')) {
map.items.push({ start }); map.items.push({ start });
} }
this.stack.push(bv); this.stack.push(bv);
@ -94104,7 +94191,7 @@ class Parser {
type: 'block-map', type: 'block-map',
offset: this.offset, offset: this.offset,
indent: this.indent, indent: this.indent,
items: [{ start }] items: [{ start, explicitKey: true }]
}; };
} }
case 'map-value-ind': { case 'map-value-ind': {
@ -95478,6 +95565,8 @@ const FOLD_QUOTED = 'quoted';
function foldFlowLines(text, indent, mode = 'flow', { indentAtStart, lineWidth = 80, minContentWidth = 20, onFold, onOverflow } = {}) { function foldFlowLines(text, indent, mode = 'flow', { indentAtStart, lineWidth = 80, minContentWidth = 20, onFold, onOverflow } = {}) {
if (!lineWidth || lineWidth < 0) if (!lineWidth || lineWidth < 0)
return text; return text;
if (lineWidth < minContentWidth)
minContentWidth = 0;
const endStep = Math.max(1 + minContentWidth, 1 + lineWidth - indent.length); const endStep = Math.max(1 + minContentWidth, 1 + lineWidth - indent.length);
if (text.length <= endStep) if (text.length <= endStep)
return text; return text;

File diff suppressed because one or more lines are too long

307
dist/post/index.js vendored
View file

@ -5140,7 +5140,7 @@ function hashFiles(patterns, currentWorkspace = '', options, verbose = false) {
followSymbolicLinks = options.followSymbolicLinks; followSymbolicLinks = options.followSymbolicLinks;
} }
const globber = yield create(patterns, { followSymbolicLinks }); const globber = yield create(patterns, { followSymbolicLinks });
return internal_hash_files_1.hashFiles(globber, currentWorkspace, verbose); return (0, internal_hash_files_1.hashFiles)(globber, currentWorkspace, verbose);
}); });
} }
exports.hashFiles = hashFiles; exports.hashFiles = hashFiles;
@ -5155,7 +5155,11 @@ exports.hashFiles = hashFiles;
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k; if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) { }) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k; if (k2 === undefined) k2 = k;
o[k2] = m[k]; o[k2] = m[k];
@ -5168,7 +5172,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
var __importStar = (this && this.__importStar) || function (mod) { var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod; if (mod && mod.__esModule) return mod;
var result = {}; var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod); __setModuleDefault(result, mod);
return result; return result;
}; };
@ -5183,7 +5187,8 @@ function getOptions(copy) {
followSymbolicLinks: true, followSymbolicLinks: true,
implicitDescendants: true, implicitDescendants: true,
matchDirectories: true, matchDirectories: true,
omitBrokenSymbolicLinks: true omitBrokenSymbolicLinks: true,
excludeHiddenFiles: false
}; };
if (copy) { if (copy) {
if (typeof copy.followSymbolicLinks === 'boolean') { if (typeof copy.followSymbolicLinks === 'boolean') {
@ -5202,6 +5207,10 @@ function getOptions(copy) {
result.omitBrokenSymbolicLinks = copy.omitBrokenSymbolicLinks; result.omitBrokenSymbolicLinks = copy.omitBrokenSymbolicLinks;
core.debug(`omitBrokenSymbolicLinks '${result.omitBrokenSymbolicLinks}'`); core.debug(`omitBrokenSymbolicLinks '${result.omitBrokenSymbolicLinks}'`);
} }
if (typeof copy.excludeHiddenFiles === 'boolean') {
result.excludeHiddenFiles = copy.excludeHiddenFiles;
core.debug(`excludeHiddenFiles '${result.excludeHiddenFiles}'`);
}
} }
return result; return result;
} }
@ -5217,7 +5226,11 @@ exports.getOptions = getOptions;
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k; if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) { }) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k; if (k2 === undefined) k2 = k;
o[k2] = m[k]; o[k2] = m[k];
@ -5230,7 +5243,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
var __importStar = (this && this.__importStar) || function (mod) { var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod; if (mod && mod.__esModule) return mod;
var result = {}; var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod); __setModuleDefault(result, mod);
return result; return result;
}; };
@ -5284,19 +5297,21 @@ class DefaultGlobber {
return this.searchPaths.slice(); return this.searchPaths.slice();
} }
glob() { glob() {
var e_1, _a; var _a, e_1, _b, _c;
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const result = []; const result = [];
try { try {
for (var _b = __asyncValues(this.globGenerator()), _c; _c = yield _b.next(), !_c.done;) { for (var _d = true, _e = __asyncValues(this.globGenerator()), _f; _f = yield _e.next(), _a = _f.done, !_a; _d = true) {
const itemPath = _c.value; _c = _f.value;
_d = false;
const itemPath = _c;
result.push(itemPath); result.push(itemPath);
} }
} }
catch (e_1_1) { e_1 = { error: e_1_1 }; } catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally { finally {
try { try {
if (_c && !_c.done && (_a = _b.return)) yield _a.call(_b); if (!_d && !_a && (_b = _e.return)) yield _b.call(_e);
} }
finally { if (e_1) throw e_1.error; } finally { if (e_1) throw e_1.error; }
} }
@ -5354,6 +5369,10 @@ class DefaultGlobber {
if (!stats) { if (!stats) {
continue; continue;
} }
// Hidden file or directory?
if (options.excludeHiddenFiles && path.basename(item.path).match(/^\./)) {
continue;
}
// Directory // Directory
if (stats.isDirectory()) { if (stats.isDirectory()) {
// Matched // Matched
@ -5459,7 +5478,11 @@ exports.DefaultGlobber = DefaultGlobber;
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k; if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) { }) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k; if (k2 === undefined) k2 = k;
o[k2] = m[k]; o[k2] = m[k];
@ -5472,7 +5495,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
var __importStar = (this && this.__importStar) || function (mod) { var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod; if (mod && mod.__esModule) return mod;
var result = {}; var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod); __setModuleDefault(result, mod);
return result; return result;
}; };
@ -5501,19 +5524,21 @@ const stream = __importStar(__nccwpck_require__(2781));
const util = __importStar(__nccwpck_require__(3837)); const util = __importStar(__nccwpck_require__(3837));
const path = __importStar(__nccwpck_require__(1017)); const path = __importStar(__nccwpck_require__(1017));
function hashFiles(globber, currentWorkspace, verbose = false) { function hashFiles(globber, currentWorkspace, verbose = false) {
var e_1, _a; var _a, e_1, _b, _c;
var _b; var _d;
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const writeDelegate = verbose ? core.info : core.debug; const writeDelegate = verbose ? core.info : core.debug;
let hasMatch = false; let hasMatch = false;
const githubWorkspace = currentWorkspace const githubWorkspace = currentWorkspace
? currentWorkspace ? currentWorkspace
: (_b = process.env['GITHUB_WORKSPACE']) !== null && _b !== void 0 ? _b : process.cwd(); : (_d = process.env['GITHUB_WORKSPACE']) !== null && _d !== void 0 ? _d : process.cwd();
const result = crypto.createHash('sha256'); const result = crypto.createHash('sha256');
let count = 0; let count = 0;
try { try {
for (var _c = __asyncValues(globber.globGenerator()), _d; _d = yield _c.next(), !_d.done;) { for (var _e = true, _f = __asyncValues(globber.globGenerator()), _g; _g = yield _f.next(), _a = _g.done, !_a; _e = true) {
const file = _d.value; _c = _g.value;
_e = false;
const file = _c;
writeDelegate(file); writeDelegate(file);
if (!file.startsWith(`${githubWorkspace}${path.sep}`)) { if (!file.startsWith(`${githubWorkspace}${path.sep}`)) {
writeDelegate(`Ignore '${file}' since it is not under GITHUB_WORKSPACE.`); writeDelegate(`Ignore '${file}' since it is not under GITHUB_WORKSPACE.`);
@ -5536,7 +5561,7 @@ function hashFiles(globber, currentWorkspace, verbose = false) {
catch (e_1_1) { e_1 = { error: e_1_1 }; } catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally { finally {
try { try {
if (_d && !_d.done && (_a = _c.return)) yield _a.call(_c); if (!_e && !_a && (_b = _f.return)) yield _b.call(_f);
} }
finally { if (e_1) throw e_1.error; } finally { if (e_1) throw e_1.error; }
} }
@ -5576,7 +5601,7 @@ var MatchKind;
MatchKind[MatchKind["File"] = 2] = "File"; MatchKind[MatchKind["File"] = 2] = "File";
/** Matched */ /** Matched */
MatchKind[MatchKind["All"] = 3] = "All"; MatchKind[MatchKind["All"] = 3] = "All";
})(MatchKind = exports.MatchKind || (exports.MatchKind = {})); })(MatchKind || (exports.MatchKind = MatchKind = {}));
//# sourceMappingURL=internal-match-kind.js.map //# sourceMappingURL=internal-match-kind.js.map
/***/ }), /***/ }),
@ -5588,7 +5613,11 @@ var MatchKind;
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k; if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) { }) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k; if (k2 === undefined) k2 = k;
o[k2] = m[k]; o[k2] = m[k];
@ -5601,7 +5630,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
var __importStar = (this && this.__importStar) || function (mod) { var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod; if (mod && mod.__esModule) return mod;
var result = {}; var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod); __setModuleDefault(result, mod);
return result; return result;
}; };
@ -5651,8 +5680,8 @@ exports.dirname = dirname;
* or `C:` are expanded based on the current working directory. * or `C:` are expanded based on the current working directory.
*/ */
function ensureAbsoluteRoot(root, itemPath) { function ensureAbsoluteRoot(root, itemPath) {
assert_1.default(root, `ensureAbsoluteRoot parameter 'root' must not be empty`); (0, assert_1.default)(root, `ensureAbsoluteRoot parameter 'root' must not be empty`);
assert_1.default(itemPath, `ensureAbsoluteRoot parameter 'itemPath' must not be empty`); (0, assert_1.default)(itemPath, `ensureAbsoluteRoot parameter 'itemPath' must not be empty`);
// Already rooted // Already rooted
if (hasAbsoluteRoot(itemPath)) { if (hasAbsoluteRoot(itemPath)) {
return itemPath; return itemPath;
@ -5662,7 +5691,7 @@ function ensureAbsoluteRoot(root, itemPath) {
// Check for itemPath like C: or C:foo // Check for itemPath like C: or C:foo
if (itemPath.match(/^[A-Z]:[^\\/]|^[A-Z]:$/i)) { if (itemPath.match(/^[A-Z]:[^\\/]|^[A-Z]:$/i)) {
let cwd = process.cwd(); let cwd = process.cwd();
assert_1.default(cwd.match(/^[A-Z]:\\/i), `Expected current directory to start with an absolute drive root. Actual '${cwd}'`); (0, assert_1.default)(cwd.match(/^[A-Z]:\\/i), `Expected current directory to start with an absolute drive root. Actual '${cwd}'`);
// Drive letter matches cwd? Expand to cwd // Drive letter matches cwd? Expand to cwd
if (itemPath[0].toUpperCase() === cwd[0].toUpperCase()) { if (itemPath[0].toUpperCase() === cwd[0].toUpperCase()) {
// Drive only, e.g. C: // Drive only, e.g. C:
@ -5687,11 +5716,11 @@ function ensureAbsoluteRoot(root, itemPath) {
// Check for itemPath like \ or \foo // Check for itemPath like \ or \foo
else if (normalizeSeparators(itemPath).match(/^\\$|^\\[^\\]/)) { else if (normalizeSeparators(itemPath).match(/^\\$|^\\[^\\]/)) {
const cwd = process.cwd(); const cwd = process.cwd();
assert_1.default(cwd.match(/^[A-Z]:\\/i), `Expected current directory to start with an absolute drive root. Actual '${cwd}'`); (0, assert_1.default)(cwd.match(/^[A-Z]:\\/i), `Expected current directory to start with an absolute drive root. Actual '${cwd}'`);
return `${cwd[0]}:\\${itemPath.substr(1)}`; return `${cwd[0]}:\\${itemPath.substr(1)}`;
} }
} }
assert_1.default(hasAbsoluteRoot(root), `ensureAbsoluteRoot parameter 'root' must have an absolute root`); (0, assert_1.default)(hasAbsoluteRoot(root), `ensureAbsoluteRoot parameter 'root' must have an absolute root`);
// Otherwise ensure root ends with a separator // Otherwise ensure root ends with a separator
if (root.endsWith('/') || (IS_WINDOWS && root.endsWith('\\'))) { if (root.endsWith('/') || (IS_WINDOWS && root.endsWith('\\'))) {
// Intentionally empty // Intentionally empty
@ -5708,7 +5737,7 @@ exports.ensureAbsoluteRoot = ensureAbsoluteRoot;
* `\\hello\share` and `C:\hello` (and using alternate separator). * `\\hello\share` and `C:\hello` (and using alternate separator).
*/ */
function hasAbsoluteRoot(itemPath) { function hasAbsoluteRoot(itemPath) {
assert_1.default(itemPath, `hasAbsoluteRoot parameter 'itemPath' must not be empty`); (0, assert_1.default)(itemPath, `hasAbsoluteRoot parameter 'itemPath' must not be empty`);
// Normalize separators // Normalize separators
itemPath = normalizeSeparators(itemPath); itemPath = normalizeSeparators(itemPath);
// Windows // Windows
@ -5725,7 +5754,7 @@ exports.hasAbsoluteRoot = hasAbsoluteRoot;
* `\`, `\hello`, `\\hello\share`, `C:`, and `C:\hello` (and using alternate separator). * `\`, `\hello`, `\\hello\share`, `C:`, and `C:\hello` (and using alternate separator).
*/ */
function hasRoot(itemPath) { function hasRoot(itemPath) {
assert_1.default(itemPath, `isRooted parameter 'itemPath' must not be empty`); (0, assert_1.default)(itemPath, `isRooted parameter 'itemPath' must not be empty`);
// Normalize separators // Normalize separators
itemPath = normalizeSeparators(itemPath); itemPath = normalizeSeparators(itemPath);
// Windows // Windows
@ -5793,7 +5822,11 @@ exports.safeTrimTrailingSeparator = safeTrimTrailingSeparator;
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k; if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) { }) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k; if (k2 === undefined) k2 = k;
o[k2] = m[k]; o[k2] = m[k];
@ -5806,7 +5839,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
var __importStar = (this && this.__importStar) || function (mod) { var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod; if (mod && mod.__esModule) return mod;
var result = {}; var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod); __setModuleDefault(result, mod);
return result; return result;
}; };
@ -5831,7 +5864,7 @@ class Path {
this.segments = []; this.segments = [];
// String // String
if (typeof itemPath === 'string') { if (typeof itemPath === 'string') {
assert_1.default(itemPath, `Parameter 'itemPath' must not be empty`); (0, assert_1.default)(itemPath, `Parameter 'itemPath' must not be empty`);
// Normalize slashes and trim unnecessary trailing slash // Normalize slashes and trim unnecessary trailing slash
itemPath = pathHelper.safeTrimTrailingSeparator(itemPath); itemPath = pathHelper.safeTrimTrailingSeparator(itemPath);
// Not rooted // Not rooted
@ -5858,24 +5891,24 @@ class Path {
// Array // Array
else { else {
// Must not be empty // Must not be empty
assert_1.default(itemPath.length > 0, `Parameter 'itemPath' must not be an empty array`); (0, assert_1.default)(itemPath.length > 0, `Parameter 'itemPath' must not be an empty array`);
// Each segment // Each segment
for (let i = 0; i < itemPath.length; i++) { for (let i = 0; i < itemPath.length; i++) {
let segment = itemPath[i]; let segment = itemPath[i];
// Must not be empty // Must not be empty
assert_1.default(segment, `Parameter 'itemPath' must not contain any empty segments`); (0, assert_1.default)(segment, `Parameter 'itemPath' must not contain any empty segments`);
// Normalize slashes // Normalize slashes
segment = pathHelper.normalizeSeparators(itemPath[i]); segment = pathHelper.normalizeSeparators(itemPath[i]);
// Root segment // Root segment
if (i === 0 && pathHelper.hasRoot(segment)) { if (i === 0 && pathHelper.hasRoot(segment)) {
segment = pathHelper.safeTrimTrailingSeparator(segment); segment = pathHelper.safeTrimTrailingSeparator(segment);
assert_1.default(segment === pathHelper.dirname(segment), `Parameter 'itemPath' root segment contains information for multiple segments`); (0, assert_1.default)(segment === pathHelper.dirname(segment), `Parameter 'itemPath' root segment contains information for multiple segments`);
this.segments.push(segment); this.segments.push(segment);
} }
// All other segments // All other segments
else { else {
// Must not contain slash // Must not contain slash
assert_1.default(!segment.includes(path.sep), `Parameter 'itemPath' contains unexpected path separators`); (0, assert_1.default)(!segment.includes(path.sep), `Parameter 'itemPath' contains unexpected path separators`);
this.segments.push(segment); this.segments.push(segment);
} }
} }
@ -5913,7 +5946,11 @@ exports.Path = Path;
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k; if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) { }) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k; if (k2 === undefined) k2 = k;
o[k2] = m[k]; o[k2] = m[k];
@ -5926,7 +5963,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
var __importStar = (this && this.__importStar) || function (mod) { var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod; if (mod && mod.__esModule) return mod;
var result = {}; var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod); __setModuleDefault(result, mod);
return result; return result;
}; };
@ -6014,7 +6051,11 @@ exports.partialMatch = partialMatch;
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k; if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) { }) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k; if (k2 === undefined) k2 = k;
o[k2] = m[k]; o[k2] = m[k];
@ -6027,7 +6068,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
var __importStar = (this && this.__importStar) || function (mod) { var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod; if (mod && mod.__esModule) return mod;
var result = {}; var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod); __setModuleDefault(result, mod);
return result; return result;
}; };
@ -6059,9 +6100,9 @@ class Pattern {
else { else {
// Convert to pattern // Convert to pattern
segments = segments || []; segments = segments || [];
assert_1.default(segments.length, `Parameter 'segments' must not empty`); (0, assert_1.default)(segments.length, `Parameter 'segments' must not empty`);
const root = Pattern.getLiteral(segments[0]); const root = Pattern.getLiteral(segments[0]);
assert_1.default(root && pathHelper.hasAbsoluteRoot(root), `Parameter 'segments' first element must be a root path`); (0, assert_1.default)(root && pathHelper.hasAbsoluteRoot(root), `Parameter 'segments' first element must be a root path`);
pattern = new internal_path_1.Path(segments).toString().trim(); pattern = new internal_path_1.Path(segments).toString().trim();
if (patternOrNegate) { if (patternOrNegate) {
pattern = `!${pattern}`; pattern = `!${pattern}`;
@ -6155,13 +6196,13 @@ class Pattern {
*/ */
static fixupPattern(pattern, homedir) { static fixupPattern(pattern, homedir) {
// Empty // Empty
assert_1.default(pattern, 'pattern cannot be empty'); (0, assert_1.default)(pattern, 'pattern cannot be empty');
// Must not contain `.` segment, unless first segment // Must not contain `.` segment, unless first segment
// Must not contain `..` segment // Must not contain `..` segment
const literalSegments = new internal_path_1.Path(pattern).segments.map(x => Pattern.getLiteral(x)); const literalSegments = new internal_path_1.Path(pattern).segments.map(x => Pattern.getLiteral(x));
assert_1.default(literalSegments.every((x, i) => (x !== '.' || i === 0) && x !== '..'), `Invalid pattern '${pattern}'. Relative pathing '.' and '..' is not allowed.`); (0, assert_1.default)(literalSegments.every((x, i) => (x !== '.' || i === 0) && x !== '..'), `Invalid pattern '${pattern}'. Relative pathing '.' and '..' is not allowed.`);
// Must not contain globs in root, e.g. Windows UNC path \\foo\b*r // Must not contain globs in root, e.g. Windows UNC path \\foo\b*r
assert_1.default(!pathHelper.hasRoot(pattern) || literalSegments[0], `Invalid pattern '${pattern}'. Root segment must not contain globs.`); (0, assert_1.default)(!pathHelper.hasRoot(pattern) || literalSegments[0], `Invalid pattern '${pattern}'. Root segment must not contain globs.`);
// Normalize slashes // Normalize slashes
pattern = pathHelper.normalizeSeparators(pattern); pattern = pathHelper.normalizeSeparators(pattern);
// Replace leading `.` segment // Replace leading `.` segment
@ -6171,8 +6212,8 @@ class Pattern {
// Replace leading `~` segment // Replace leading `~` segment
else if (pattern === '~' || pattern.startsWith(`~${path.sep}`)) { else if (pattern === '~' || pattern.startsWith(`~${path.sep}`)) {
homedir = homedir || os.homedir(); homedir = homedir || os.homedir();
assert_1.default(homedir, 'Unable to determine HOME directory'); (0, assert_1.default)(homedir, 'Unable to determine HOME directory');
assert_1.default(pathHelper.hasAbsoluteRoot(homedir), `Expected HOME directory to be a rooted path. Actual '${homedir}'`); (0, assert_1.default)(pathHelper.hasAbsoluteRoot(homedir), `Expected HOME directory to be a rooted path. Actual '${homedir}'`);
pattern = Pattern.globEscape(homedir) + pattern.substr(1); pattern = Pattern.globEscape(homedir) + pattern.substr(1);
} }
// Replace relative drive root, e.g. pattern is C: or C:foo // Replace relative drive root, e.g. pattern is C: or C:foo
@ -85689,6 +85730,14 @@ module.exports = require("node:events");
/***/ }), /***/ }),
/***/ 7742:
/***/ ((module) => {
"use strict";
module.exports = require("node:process");
/***/ }),
/***/ 4492: /***/ 4492:
/***/ ((module) => { /***/ ((module) => {
@ -87475,10 +87524,23 @@ function resolveCollection(CN, ctx, token, onError, tagName, tag) {
coll.tag = tagName; coll.tag = tagName;
return coll; return coll;
} }
function composeCollection(CN, ctx, token, tagToken, onError) { function composeCollection(CN, ctx, token, props, onError) {
const tagToken = props.tag;
const tagName = !tagToken const tagName = !tagToken
? null ? null
: ctx.directives.tagName(tagToken.source, msg => onError(tagToken, 'TAG_RESOLVE_FAILED', msg)); : ctx.directives.tagName(tagToken.source, msg => onError(tagToken, 'TAG_RESOLVE_FAILED', msg));
if (token.type === 'block-seq') {
const { anchor, newlineAfterProp: nl } = props;
const lastProp = anchor && tagToken
? anchor.offset > tagToken.offset
? anchor
: tagToken
: (anchor ?? tagToken);
if (lastProp && (!nl || nl.offset < lastProp.offset)) {
const message = 'Missing newline after block sequence props';
onError(lastProp, 'MISSING_CHAR', message);
}
}
const expType = token.type === 'block-map' const expType = token.type === 'block-map'
? 'map' ? 'map'
: token.type === 'block-seq' : token.type === 'block-seq'
@ -87492,8 +87554,7 @@ function composeCollection(CN, ctx, token, tagToken, onError) {
!tagName || !tagName ||
tagName === '!' || tagName === '!' ||
(tagName === YAMLMap.YAMLMap.tagName && expType === 'map') || (tagName === YAMLMap.YAMLMap.tagName && expType === 'map') ||
(tagName === YAMLSeq.YAMLSeq.tagName && expType === 'seq') || (tagName === YAMLSeq.YAMLSeq.tagName && expType === 'seq')) {
!expType) {
return resolveCollection(CN, ctx, token, onError, tagName); return resolveCollection(CN, ctx, token, onError, tagName);
} }
let tag = ctx.schema.tags.find(t => t.tag === tagName && t.collection === expType); let tag = ctx.schema.tags.find(t => t.tag === tagName && t.collection === expType);
@ -87555,6 +87616,7 @@ function composeDoc(options, directives, { offset, start, value, end }, onError)
next: value ?? end?.[0], next: value ?? end?.[0],
offset, offset,
onError, onError,
parentIndent: 0,
startOnNewline: true startOnNewline: true
}); });
if (props.found) { if (props.found) {
@ -87615,7 +87677,7 @@ function composeNode(ctx, token, props, onError) {
case 'block-map': case 'block-map':
case 'block-seq': case 'block-seq':
case 'flow-collection': case 'flow-collection':
node = composeCollection.composeCollection(CN, ctx, token, tag, onError); node = composeCollection.composeCollection(CN, ctx, token, props, onError);
if (anchor) if (anchor)
node.anchor = anchor.source.substring(1); node.anchor = anchor.source.substring(1);
break; break;
@ -87697,7 +87759,7 @@ var resolveFlowScalar = __nccwpck_require__(261);
function composeScalar(ctx, token, tagToken, onError) { function composeScalar(ctx, token, tagToken, onError) {
const { value, type, comment, range } = token.type === 'block-scalar' const { value, type, comment, range } = token.type === 'block-scalar'
? resolveBlockScalar.resolveBlockScalar(token, ctx.options.strict, onError) ? resolveBlockScalar.resolveBlockScalar(ctx, token, onError)
: resolveFlowScalar.resolveFlowScalar(token, ctx.options.strict, onError); : resolveFlowScalar.resolveFlowScalar(token, ctx.options.strict, onError);
const tagName = tagToken const tagName = tagToken
? ctx.directives.tagName(tagToken.source, msg => onError(tagToken, 'TAG_RESOLVE_FAILED', msg)) ? ctx.directives.tagName(tagToken.source, msg => onError(tagToken, 'TAG_RESOLVE_FAILED', msg))
@ -88032,6 +88094,7 @@ function resolveBlockMap({ composeNode, composeEmptyNode }, ctx, bm, onError, ta
next: key ?? sep?.[0], next: key ?? sep?.[0],
offset, offset,
onError, onError,
parentIndent: bm.indent,
startOnNewline: true startOnNewline: true
}); });
const implicitKey = !keyProps.found; const implicitKey = !keyProps.found;
@ -88052,7 +88115,7 @@ function resolveBlockMap({ composeNode, composeEmptyNode }, ctx, bm, onError, ta
} }
continue; continue;
} }
if (keyProps.hasNewlineAfterProp || utilContainsNewline.containsNewline(key)) { if (keyProps.newlineAfterProp || utilContainsNewline.containsNewline(key)) {
onError(key ?? start[start.length - 1], 'MULTILINE_IMPLICIT_KEY', 'Implicit keys need to be on a single line'); onError(key ?? start[start.length - 1], 'MULTILINE_IMPLICIT_KEY', 'Implicit keys need to be on a single line');
} }
} }
@ -88074,6 +88137,7 @@ function resolveBlockMap({ composeNode, composeEmptyNode }, ctx, bm, onError, ta
next: value, next: value,
offset: keyNode.range[2], offset: keyNode.range[2],
onError, onError,
parentIndent: bm.indent,
startOnNewline: !key || key.type === 'block-scalar' startOnNewline: !key || key.type === 'block-scalar'
}); });
offset = valueProps.end; offset = valueProps.end;
@ -88132,9 +88196,9 @@ exports.resolveBlockMap = resolveBlockMap;
var Scalar = __nccwpck_require__(9338); var Scalar = __nccwpck_require__(9338);
function resolveBlockScalar(scalar, strict, onError) { function resolveBlockScalar(ctx, scalar, onError) {
const start = scalar.offset; const start = scalar.offset;
const header = parseBlockScalarHeader(scalar, strict, onError); const header = parseBlockScalarHeader(scalar, ctx.options.strict, onError);
if (!header) if (!header)
return { value: '', type: null, comment: '', range: [start, start, start] }; return { value: '', type: null, comment: '', range: [start, start, start] };
const type = header.mode === '>' ? Scalar.Scalar.BLOCK_FOLDED : Scalar.Scalar.BLOCK_LITERAL; const type = header.mode === '>' ? Scalar.Scalar.BLOCK_FOLDED : Scalar.Scalar.BLOCK_LITERAL;
@ -88176,6 +88240,10 @@ function resolveBlockScalar(scalar, strict, onError) {
if (header.indent === 0) if (header.indent === 0)
trimIndent = indent.length; trimIndent = indent.length;
contentStart = i; contentStart = i;
if (trimIndent === 0 && !ctx.atRoot) {
const message = 'Block scalar values in collections must be indented';
onError(offset, 'BAD_INDENT', message);
}
break; break;
} }
offset += indent.length + content.length + 1; offset += indent.length + content.length + 1;
@ -88351,6 +88419,7 @@ function resolveBlockSeq({ composeNode, composeEmptyNode }, ctx, bs, onError, ta
next: value, next: value,
offset, offset,
onError, onError,
parentIndent: bs.indent,
startOnNewline: true startOnNewline: true
}); });
if (!props.found) { if (!props.found) {
@ -88467,6 +88536,7 @@ function resolveFlowCollection({ composeNode, composeEmptyNode }, ctx, fc, onErr
next: key ?? sep?.[0], next: key ?? sep?.[0],
offset, offset,
onError, onError,
parentIndent: fc.indent,
startOnNewline: false startOnNewline: false
}); });
if (!props.found) { if (!props.found) {
@ -88548,6 +88618,7 @@ function resolveFlowCollection({ composeNode, composeEmptyNode }, ctx, fc, onErr
next: value, next: value,
offset: keyNode.range[2], offset: keyNode.range[2],
onError, onError,
parentIndent: fc.indent,
startOnNewline: false startOnNewline: false
}); });
if (valueProps.found) { if (valueProps.found) {
@ -88600,6 +88671,8 @@ function resolveFlowCollection({ composeNode, composeEmptyNode }, ctx, fc, onErr
const map = new YAMLMap.YAMLMap(ctx.schema); const map = new YAMLMap.YAMLMap(ctx.schema);
map.flow = true; map.flow = true;
map.items.push(pair); map.items.push(pair);
const endRange = (valueNode ?? keyNode).range;
map.range = [keyNode.range[0], endRange[1], endRange[2]];
coll.items.push(map); coll.items.push(map);
} }
offset = valueNode ? valueNode.range[2] : valueProps.end; offset = valueNode ? valueNode.range[2] : valueProps.end;
@ -88732,7 +88805,7 @@ function foldLines(source) {
first = new RegExp('(.*?)(?<![ \t])[ \t]*\r?\n', 'sy'); first = new RegExp('(.*?)(?<![ \t])[ \t]*\r?\n', 'sy');
line = new RegExp('[ \t]*(.*?)(?:(?<![ \t])[ \t]*)?\r?\n', 'sy'); line = new RegExp('[ \t]*(.*?)(?:(?<![ \t])[ \t]*)?\r?\n', 'sy');
} }
catch (_) { catch {
first = /(.*?)[ \t]*\r?\n/sy; first = /(.*?)[ \t]*\r?\n/sy;
line = /[ \t]*(.*?)[ \t]*\r?\n/sy; line = /[ \t]*(.*?)[ \t]*\r?\n/sy;
} }
@ -88879,17 +88952,18 @@ exports.resolveFlowScalar = resolveFlowScalar;
"use strict"; "use strict";
function resolveProps(tokens, { flow, indicator, next, offset, onError, startOnNewline }) { function resolveProps(tokens, { flow, indicator, next, offset, onError, parentIndent, startOnNewline }) {
let spaceBefore = false; let spaceBefore = false;
let atNewline = startOnNewline; let atNewline = startOnNewline;
let hasSpace = startOnNewline; let hasSpace = startOnNewline;
let comment = ''; let comment = '';
let commentSep = ''; let commentSep = '';
let hasNewline = false; let hasNewline = false;
let hasNewlineAfterProp = false;
let reqSpace = false; let reqSpace = false;
let tab = null;
let anchor = null; let anchor = null;
let tag = null; let tag = null;
let newlineAfterProp = null;
let comma = null; let comma = null;
let found = null; let found = null;
let start = null; let start = null;
@ -88901,16 +88975,22 @@ function resolveProps(tokens, { flow, indicator, next, offset, onError, startOnN
onError(token.offset, 'MISSING_CHAR', 'Tags and anchors must be separated from the next token by white space'); onError(token.offset, 'MISSING_CHAR', 'Tags and anchors must be separated from the next token by white space');
reqSpace = false; reqSpace = false;
} }
if (tab) {
if (atNewline && token.type !== 'comment' && token.type !== 'newline') {
onError(tab, 'TAB_AS_INDENT', 'Tabs are not allowed as indentation');
}
tab = null;
}
switch (token.type) { switch (token.type) {
case 'space': case 'space':
// At the doc level, tabs at line start may be parsed // At the doc level, tabs at line start may be parsed
// as leading white space rather than indentation. // as leading white space rather than indentation.
// In a flow collection, only the parser handles indent. // In a flow collection, only the parser handles indent.
if (!flow && if (!flow &&
atNewline && (indicator !== 'doc-start' || next?.type !== 'flow-collection') &&
indicator !== 'doc-start' && token.source.includes('\t')) {
token.source[0] === '\t') tab = token;
onError(token, 'TAB_AS_INDENT', 'Tabs are not allowed as indentation'); }
hasSpace = true; hasSpace = true;
break; break;
case 'comment': { case 'comment': {
@ -88937,7 +89017,7 @@ function resolveProps(tokens, { flow, indicator, next, offset, onError, startOnN
atNewline = true; atNewline = true;
hasNewline = true; hasNewline = true;
if (anchor || tag) if (anchor || tag)
hasNewlineAfterProp = true; newlineAfterProp = token;
hasSpace = true; hasSpace = true;
break; break;
case 'anchor': case 'anchor':
@ -88970,7 +89050,8 @@ function resolveProps(tokens, { flow, indicator, next, offset, onError, startOnN
if (found) if (found)
onError(token, 'UNEXPECTED_TOKEN', `Unexpected ${token.source} in ${flow ?? 'collection'}`); onError(token, 'UNEXPECTED_TOKEN', `Unexpected ${token.source} in ${flow ?? 'collection'}`);
found = token; found = token;
atNewline = false; atNewline =
indicator === 'seq-item-ind' || indicator === 'explicit-key-ind';
hasSpace = false; hasSpace = false;
break; break;
case 'comma': case 'comma':
@ -88996,17 +89077,23 @@ function resolveProps(tokens, { flow, indicator, next, offset, onError, startOnN
next.type !== 'space' && next.type !== 'space' &&
next.type !== 'newline' && next.type !== 'newline' &&
next.type !== 'comma' && next.type !== 'comma' &&
(next.type !== 'scalar' || next.source !== '')) (next.type !== 'scalar' || next.source !== '')) {
onError(next.offset, 'MISSING_CHAR', 'Tags and anchors must be separated from the next token by white space'); onError(next.offset, 'MISSING_CHAR', 'Tags and anchors must be separated from the next token by white space');
}
if (tab &&
((atNewline && tab.indent <= parentIndent) ||
next?.type === 'block-map' ||
next?.type === 'block-seq'))
onError(tab, 'TAB_AS_INDENT', 'Tabs are not allowed as indentation');
return { return {
comma, comma,
found, found,
spaceBefore, spaceBefore,
comment, comment,
hasNewline, hasNewline,
hasNewlineAfterProp,
anchor, anchor,
tag, tag,
newlineAfterProp,
end, end,
start: start ?? end start: start ?? end
}; };
@ -89598,6 +89685,7 @@ function applyReviver(reviver, obj, key, val) {
for (let i = 0, len = val.length; i < len; ++i) { for (let i = 0, len = val.length; i < len; ++i) {
const v0 = val[i]; const v0 = val[i];
const v1 = applyReviver(reviver, val, String(i), v0); const v1 = applyReviver(reviver, val, String(i), v0);
// eslint-disable-next-line @typescript-eslint/no-array-delete
if (v1 === undefined) if (v1 === undefined)
delete val[i]; delete val[i];
else if (v1 !== v0) else if (v1 !== v0)
@ -90068,8 +90156,6 @@ function debug(logLevel, ...messages) {
} }
function warn(logLevel, warning) { function warn(logLevel, warning) {
if (logLevel === 'debug' || logLevel === 'warn') { if (logLevel === 'debug' || logLevel === 'warn') {
// https://github.com/typescript-eslint/typescript-eslint/issues/7478
// eslint-disable-next-line @typescript-eslint/prefer-optional-chain
if (typeof process !== 'undefined' && process.emitWarning) if (typeof process !== 'undefined' && process.emitWarning)
process.emitWarning(warning); process.emitWarning(warning);
else else
@ -90345,7 +90431,6 @@ class Collection extends Node.NodeBase {
} }
} }
} }
Collection.maxFlowStringSingleLineLength = 60;
exports.Collection = Collection; exports.Collection = Collection;
exports.collectionFromPath = collectionFromPath; exports.collectionFromPath = collectionFromPath;
@ -91010,7 +91095,7 @@ function resolveAsScalar(token, strict = true, onError) {
case 'double-quoted-scalar': case 'double-quoted-scalar':
return resolveFlowScalar.resolveFlowScalar(token, strict, _onError); return resolveFlowScalar.resolveFlowScalar(token, strict, _onError);
case 'block-scalar': case 'block-scalar':
return resolveBlockScalar.resolveBlockScalar(token, strict, _onError); return resolveBlockScalar.resolveBlockScalar({ options: { strict } }, token, _onError);
} }
} }
return null; return null;
@ -91595,11 +91680,11 @@ function isEmpty(ch) {
return false; return false;
} }
} }
const hexDigits = '0123456789ABCDEFabcdef'.split(''); const hexDigits = new Set('0123456789ABCDEFabcdef');
const tagChars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()".split(''); const tagChars = new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()");
const invalidFlowScalarChars = ',[]{}'.split(''); const flowIndicatorChars = new Set(',[]{}');
const invalidAnchorChars = ' ,[]{}\n\r\t'.split(''); const invalidAnchorChars = new Set(' ,[]{}\n\r\t');
const isNotAnchorChar = (ch) => !ch || invalidAnchorChars.includes(ch); const isNotAnchorChar = (ch) => !ch || invalidAnchorChars.has(ch);
/** /**
* Splits an input string into lexical tokens, i.e. smaller strings that are * Splits an input string into lexical tokens, i.e. smaller strings that are
* easily identifiable by `tokens.tokenType()`. * easily identifiable by `tokens.tokenType()`.
@ -91806,15 +91891,11 @@ class Lexer {
if (!this.atEnd && !this.hasChars(4)) if (!this.atEnd && !this.hasChars(4))
return this.setNext('line-start'); return this.setNext('line-start');
const s = this.peek(3); const s = this.peek(3);
if (s === '---' && isEmpty(this.charAt(3))) { if ((s === '---' || s === '...') && isEmpty(this.charAt(3))) {
yield* this.pushCount(3); yield* this.pushCount(3);
this.indentValue = 0; this.indentValue = 0;
this.indentNext = 0; this.indentNext = 0;
return 'doc'; return s === '---' ? 'doc' : 'stream';
}
else if (s === '...' && isEmpty(this.charAt(3))) {
yield* this.pushCount(3);
return 'stream';
} }
} }
this.indentValue = yield* this.pushSpaces(false); this.indentValue = yield* this.pushSpaces(false);
@ -92041,8 +92122,10 @@ class Lexer {
if (indent >= this.indentNext) { if (indent >= this.indentNext) {
if (this.blockScalarIndent === -1) if (this.blockScalarIndent === -1)
this.indentNext = indent; this.indentNext = indent;
else else {
this.indentNext += this.blockScalarIndent; this.indentNext =
this.blockScalarIndent + (this.indentNext === 0 ? 1 : this.indentNext);
}
do { do {
const cs = this.continueScalar(nl + 1); const cs = this.continueScalar(nl + 1);
if (cs === -1) if (cs === -1)
@ -92055,14 +92138,25 @@ class Lexer {
nl = this.buffer.length; nl = this.buffer.length;
} }
} }
if (!this.blockScalarKeep) { // Trailing insufficiently indented tabs are invalid.
// To catch that during parsing, we include them in the block scalar value.
let i = nl + 1;
ch = this.buffer[i];
while (ch === ' ')
ch = this.buffer[++i];
if (ch === '\t') {
while (ch === '\t' || ch === ' ' || ch === '\r' || ch === '\n')
ch = this.buffer[++i];
nl = i - 1;
}
else if (!this.blockScalarKeep) {
do { do {
let i = nl - 1; let i = nl - 1;
let ch = this.buffer[i]; let ch = this.buffer[i];
if (ch === '\r') if (ch === '\r')
ch = this.buffer[--i]; ch = this.buffer[--i];
const lastChar = i; // Drop the line if last char not more indented const lastChar = i; // Drop the line if last char not more indented
while (ch === ' ' || ch === '\t') while (ch === ' ')
ch = this.buffer[--i]; ch = this.buffer[--i];
if (ch === '\n' && i >= this.pos && i + 1 + indent > lastChar) if (ch === '\n' && i >= this.pos && i + 1 + indent > lastChar)
nl = i; nl = i;
@ -92082,7 +92176,7 @@ class Lexer {
while ((ch = this.buffer[++i])) { while ((ch = this.buffer[++i])) {
if (ch === ':') { if (ch === ':') {
const next = this.buffer[i + 1]; const next = this.buffer[i + 1];
if (isEmpty(next) || (inFlow && next === ',')) if (isEmpty(next) || (inFlow && flowIndicatorChars.has(next)))
break; break;
end = i; end = i;
} }
@ -92097,7 +92191,7 @@ class Lexer {
else else
end = i; end = i;
} }
if (next === '#' || (inFlow && invalidFlowScalarChars.includes(next))) if (next === '#' || (inFlow && flowIndicatorChars.has(next)))
break; break;
if (ch === '\n') { if (ch === '\n') {
const cs = this.continueScalar(i + 1); const cs = this.continueScalar(i + 1);
@ -92107,7 +92201,7 @@ class Lexer {
} }
} }
else { else {
if (inFlow && invalidFlowScalarChars.includes(ch)) if (inFlow && flowIndicatorChars.has(ch))
break; break;
end = i; end = i;
} }
@ -92152,7 +92246,7 @@ class Lexer {
case ':': { case ':': {
const inFlow = this.flowLevel > 0; const inFlow = this.flowLevel > 0;
const ch1 = this.charAt(1); const ch1 = this.charAt(1);
if (isEmpty(ch1) || (inFlow && invalidFlowScalarChars.includes(ch1))) { if (isEmpty(ch1) || (inFlow && flowIndicatorChars.has(ch1))) {
if (!inFlow) if (!inFlow)
this.indentNext = this.indentValue + 1; this.indentNext = this.indentValue + 1;
else if (this.flowKey) else if (this.flowKey)
@ -92177,11 +92271,11 @@ class Lexer {
let i = this.pos + 1; let i = this.pos + 1;
let ch = this.buffer[i]; let ch = this.buffer[i];
while (ch) { while (ch) {
if (tagChars.includes(ch)) if (tagChars.has(ch))
ch = this.buffer[++i]; ch = this.buffer[++i];
else if (ch === '%' && else if (ch === '%' &&
hexDigits.includes(this.buffer[i + 1]) && hexDigits.has(this.buffer[i + 1]) &&
hexDigits.includes(this.buffer[i + 2])) { hexDigits.has(this.buffer[i + 2])) {
ch = this.buffer[(i += 3)]; ch = this.buffer[(i += 3)];
} }
else else
@ -92589,7 +92683,7 @@ class Parser {
} }
else { else {
Object.assign(it, { key: token, sep: [] }); Object.assign(it, { key: token, sep: [] });
this.onKeyLine = !includesToken(it.start, 'explicit-key-ind'); this.onKeyLine = !it.explicitKey;
return; return;
} }
break; break;
@ -92798,9 +92892,9 @@ class Parser {
return; return;
} }
if (this.indent >= map.indent) { if (this.indent >= map.indent) {
const atNextItem = !this.onKeyLine && const atMapIndent = !this.onKeyLine && this.indent === map.indent;
this.indent === map.indent && const atNextItem = atMapIndent &&
it.sep && (it.sep || it.explicitKey) &&
this.type !== 'seq-item-ind'; this.type !== 'seq-item-ind';
// For empty nodes, assign newline-separated not indented empty tokens to following node // For empty nodes, assign newline-separated not indented empty tokens to following node
let start = []; let start = [];
@ -92841,25 +92935,26 @@ class Parser {
} }
return; return;
case 'explicit-key-ind': case 'explicit-key-ind':
if (!it.sep && !includesToken(it.start, 'explicit-key-ind')) { if (!it.sep && !it.explicitKey) {
it.start.push(this.sourceToken); it.start.push(this.sourceToken);
it.explicitKey = true;
} }
else if (atNextItem || it.value) { else if (atNextItem || it.value) {
start.push(this.sourceToken); start.push(this.sourceToken);
map.items.push({ start }); map.items.push({ start, explicitKey: true });
} }
else { else {
this.stack.push({ this.stack.push({
type: 'block-map', type: 'block-map',
offset: this.offset, offset: this.offset,
indent: this.indent, indent: this.indent,
items: [{ start: [this.sourceToken] }] items: [{ start: [this.sourceToken], explicitKey: true }]
}); });
} }
this.onKeyLine = true; this.onKeyLine = true;
return; return;
case 'map-value-ind': case 'map-value-ind':
if (includesToken(it.start, 'explicit-key-ind')) { if (it.explicitKey) {
if (!it.sep) { if (!it.sep) {
if (includesToken(it.start, 'newline')) { if (includesToken(it.start, 'newline')) {
Object.assign(it, { key: null, sep: [this.sourceToken] }); Object.assign(it, { key: null, sep: [this.sourceToken] });
@ -92892,7 +92987,9 @@ class Parser {
const sep = it.sep; const sep = it.sep;
sep.push(this.sourceToken); sep.push(this.sourceToken);
// @ts-expect-error type guard is wrong here // @ts-expect-error type guard is wrong here
delete it.key, delete it.sep; delete it.key;
// @ts-expect-error type guard is wrong here
delete it.sep;
this.stack.push({ this.stack.push({
type: 'block-map', type: 'block-map',
offset: this.offset, offset: this.offset,
@ -92950,9 +93047,7 @@ class Parser {
default: { default: {
const bv = this.startBlockValue(map); const bv = this.startBlockValue(map);
if (bv) { if (bv) {
if (atNextItem && if (atMapIndent && bv.type !== 'block-seq') {
bv.type !== 'block-seq' &&
includesToken(it.start, 'explicit-key-ind')) {
map.items.push({ start }); map.items.push({ start });
} }
this.stack.push(bv); this.stack.push(bv);
@ -93173,7 +93268,7 @@ class Parser {
type: 'block-map', type: 'block-map',
offset: this.offset, offset: this.offset,
indent: this.indent, indent: this.indent,
items: [{ start }] items: [{ start, explicitKey: true }]
}; };
} }
case 'map-value-ind': { case 'map-value-ind': {
@ -94547,6 +94642,8 @@ const FOLD_QUOTED = 'quoted';
function foldFlowLines(text, indent, mode = 'flow', { indentAtStart, lineWidth = 80, minContentWidth = 20, onFold, onOverflow } = {}) { function foldFlowLines(text, indent, mode = 'flow', { indentAtStart, lineWidth = 80, minContentWidth = 20, onFold, onOverflow } = {}) {
if (!lineWidth || lineWidth < 0) if (!lineWidth || lineWidth < 0)
return text; return text;
if (lineWidth < minContentWidth)
minContentWidth = 0;
const endStep = Math.max(1 + minContentWidth, 1 + lineWidth - indent.length); const endStep = Math.max(1 + minContentWidth, 1 + lineWidth - indent.length);
if (text.length <= endStep) if (text.length <= endStep)
return text; return text;
@ -95942,9 +96039,11 @@ const core = __nccwpck_require__(2186)
const glob = __nccwpck_require__(8090) const glob = __nccwpck_require__(8090)
const config = __nccwpck_require__(5532) const config = __nccwpck_require__(5532)
const { getFolderSize } = __nccwpck_require__(4962) const { getFolderSize } = __nccwpck_require__(4962)
const process = __nccwpck_require__(7742);
async function run() { async function run() {
await saveCaches() await saveCaches()
process.exit(0)
} }
async function saveCaches() { async function saveCaches() {

File diff suppressed because one or more lines are too long

View file

@ -5,9 +5,11 @@ const core = require('@actions/core')
const glob = require('@actions/glob') const glob = require('@actions/glob')
const config = require('./config') const config = require('./config')
const { getFolderSize } = require('./util') const { getFolderSize } = require('./util')
const process = require('node:process');
async function run() { async function run() {
await saveCaches() await saveCaches()
process.exit(0)
} }
async function saveCaches() { async function saveCaches() {