index int64 0 0 | repo_id stringlengths 16 181 | file_path stringlengths 28 270 | content stringlengths 1 11.6M | __index_level_0__ int64 0 10k |
|---|---|---|---|---|
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/semver | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/semver/functions/sort.d.ts | import SemVer = require('../classes/semver');
import semver = require('../index');
/**
* Sorts an array of semver entries in ascending order using `compareBuild()`.
*/
declare function sort<T extends string | SemVer>(list: T[], optionsOrLoose?: boolean | semver.Options): T[];
export = sort;
| 200 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/semver | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/semver/functions/valid.d.ts | import semver = require('../index');
import SemVer = require('../classes/semver');
/**
* Return the parsed version as a string, or null if it's not valid.
*/
declare function valid(
version: string | SemVer | null | undefined,
optionsOrLoose?: boolean | semver.Options,
): string | null;
export = valid;
| 201 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/semver | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/semver/internals/identifiers.d.ts | /**
* Compares two identifiers, must be numeric strings or truthy/falsy values.
*
* Sorts in ascending order when passed to `Array.sort()`.
*/
export function compareIdentifiers(a: string | null | undefined, b: string | null | undefined): 1 | 0 | -1;
/**
* The reverse of compareIdentifiers.
*
* Sorts in descend... | 202 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/semver | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/semver/ranges/gtr.d.ts | import Range = require('../classes/range');
import SemVer = require('../classes/semver');
import semver = require('../index');
/**
* Return true if version is greater than all the versions possible in the range.
*/
declare function gtr(
version: string | SemVer,
range: string | Range,
optionsOrLoose?: bo... | 203 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/semver | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/semver/ranges/intersects.d.ts | import Range = require('../classes/range');
import semver = require('../index');
/**
* Return true if any of the ranges comparators intersect
*/
declare function intersects(
range1: string | Range,
range2: string | Range,
optionsOrLoose?: boolean | semver.Options,
): boolean;
export = intersects;
| 204 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/semver | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/semver/ranges/ltr.d.ts | import Range = require('../classes/range');
import SemVer = require('../classes/semver');
import semver = require('../index');
/**
* Return true if version is less than all the versions possible in the range.
*/
declare function ltr(
version: string | SemVer,
range: string | Range,
optionsOrLoose?: boole... | 205 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/semver | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/semver/ranges/max-satisfying.d.ts | import Range = require('../classes/range');
import SemVer = require('../classes/semver');
import semver = require('../index');
/**
* Return the highest version in the list that satisfies the range, or null if none of them do.
*/
declare function maxSatisfying<T extends string | SemVer>(
versions: ReadonlyArray<T... | 206 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/semver | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/semver/ranges/min-satisfying.d.ts | import Range = require('../classes/range');
import SemVer = require('../classes/semver');
import semver = require('../index');
/**
* Return the lowest version in the list that satisfies the range, or null if none of them do.
*/
declare function minSatisfying<T extends string | SemVer>(
versions: ReadonlyArray<T>... | 207 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/semver | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/semver/ranges/min-version.d.ts | import Range = require('../classes/range');
import SemVer = require('../classes/semver');
import semver = require('../index');
/**
* Return the lowest version that can possibly match the given range.
*/
declare function minVersion(range: string | Range, optionsOrLoose?: boolean | semver.Options): SemVer | null;
exp... | 208 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/semver | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/semver/ranges/outside.d.ts | import Range = require('../classes/range');
import SemVer = require('../classes/semver');
import semver = require('../index');
/**
* Return true if the version is outside the bounds of the range in either the high or low direction.
* The hilo argument must be either the string '>' or '<'. (This is the function calle... | 209 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/semver | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/semver/ranges/simplify.d.ts | import Range = require('../classes/range');
import semver = require('../index');
/**
* Return a "simplified" range that matches the same items in `versions` list as the range specified.
* Note that it does *not* guarantee that it would match the same versions in all cases,
* only for the set of versions provided.
... | 210 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/semver | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/semver/ranges/subset.d.ts | import Range = require('../classes/range');
import semver = require('../index');
/**
* Return true if the subRange range is entirely contained by the superRange range.
*/
declare function subset(
sub: string | Range,
dom: string | Range,
options?: semver.Options,
): boolean;
export = subset;
| 211 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/semver | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/semver/ranges/to-comparators.d.ts | import Range = require('../classes/range');
import semver = require('../index');
/**
* Mostly just for testing and legacy API reasons
*/
declare function toComparators(range: string | Range, optionsOrLoose?: boolean | semver.Options): string[][];
export = toComparators;
| 212 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/semver | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/semver/ranges/valid.d.ts | import Range = require('../classes/range');
import semver = require('../index');
/**
* Return the valid range or null if it's not valid
*/
declare function validRange(
range: string | Range | null | undefined,
optionsOrLoose?: boolean | semver.Options,
): string | null;
export = validRange;
| 213 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/signale/index.d.ts | // Type definitions for signale 1.4
// Project: https://github.com/klaussinani/signale
// Definitions by: Resi Respati <https://github.com/resir014>
// Joydip Roy <https://github.com/rjoydip>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.7
/// <reference ty... | 214 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/signale/index.js | (()=>{var e={305:(e,t,r)=>{"use strict";var n=r(837);var i=r(589);var s=function errorEx(e,t){if(!e||e.constructor!==String){t=e||{};e=Error.name}var r=function ErrorEXError(n){if(!this){return new ErrorEXError(n)}n=n instanceof Error?n.message:n||this.message;Error.call(this,n);Error.captureStackTrace(this,r);this.nam... | 215 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/signale/package.json | {"name":"signale","author":{"name":"Klaus Sinani","email":"klaussinani@gmail.com","url":"https://klaussinani.github.io"},"version":"1.4.0","license":"MIT","options":{"default":{"displayScope":true,"displayBadge":true,"displayDate":false,"displayFilename":false,"displayLabel":true,"displayTimestamp":false,"underlineLabe... | 216 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/slash/index.d.ts | /**
Convert Windows backslash paths to slash paths: `foo\\bar` ➔ `foo/bar`.
[Forward-slash paths can be used in Windows](http://superuser.com/a/176395/6877) as long as they're not extended-length paths and don't contain any non-ascii characters.
@param path - A Windows backslash path.
@returns A path with forward sla... | 217 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/slash/index.js | (()=>{"use strict";var e={398:e=>{e.exports=e=>{const r=/^\\\\\?\\/.test(e);const _=/[^\u0000-\u0080]+/.test(e);if(r||_){return e}return e.replace(/\\/g,"/")}}};var r={};function __nccwpck_require__(_){var t=r[_];if(t!==undefined){return t.exports}var u=r[_]={exports:{}};var a=true;try{e[_](u,u.exports,__nccwpck_requir... | 218 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/slash/license | MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to... | 219 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/slash/package.json | {"name":"slash","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"version":"3.0.0","license":"MIT"}
| 220 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/strip-ansi/index.d.ts | /**
Strip [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) from a string.
@example
```
import stripAnsi = require('./strip-ansi');
stripAnsi('\u001B[4mUnicorn\u001B[0m');
//=> 'Unicorn'
stripAnsi('\u001B]8;;https://github.com\u0007Click\u001B]8;;\u0007');
//=> 'Click'
```
*/
declare function strip... | 221 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/strip-ansi/index.js | (()=>{"use strict";var e={275:e=>{e.exports=({onlyFirst:e=false}={})=>{const r=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(r,e?undefined:"g")}},647:... | 222 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/strip-ansi/license | MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to... | 223 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/strip-ansi/package.json | {"name":"strip-ansi","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"version":"6.0.1","license":"MIT"}
| 224 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/tsconfig-paths/index.js | (()=>{"use strict";var e={308:e=>{e.exports=e=>{if(typeof e!=="string"){throw new TypeError("Expected a string, got "+typeof e)}if(e.charCodeAt(0)===65279){return e.slice(1)}return e}},154:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:true});t.configLoader=t.loadConfig=void 0;var n=r(131);var i=r(17);function l... | 225 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/tsconfig-paths/license | The MIT License (MIT)
Copyright (c) 2016 Jonas Kello
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publ... | 226 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/tsconfig-paths/package.json | {"name":"tsconfig-paths","author":"Jonas Kello","version":"4.1.1","license":"MIT","types":"lib/index.d.ts"}
| 227 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/tsconfig-paths | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/tsconfig-paths/lib/config-loader.d.ts | import * as TsConfigLoader2 from "./tsconfig-loader";
export interface ExplicitParams {
baseUrl: string;
paths: {
[key: string]: Array<string>;
};
mainFields?: (string | string[])[];
addMatchAll?: boolean;
}
export declare type TsConfigLoader = (params: TsConfigLoader2.TsConfigLoaderParams) ... | 228 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/tsconfig-paths | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/tsconfig-paths/lib/filesystem.d.ts | /**
* Typing for the fields of package.json we care about
*/
export interface PackageJson {
[key: string]: string | PackageJson;
}
/**
* A function that json from a file
*/
export interface ReadJsonSync {
(packageJsonPath: string): any | undefined;
}
export interface FileExistsSync {
(name: string): boo... | 229 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/tsconfig-paths | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/tsconfig-paths/lib/index.d.ts | export { createMatchPath, matchFromAbsolutePaths, MatchPath, } from "./match-path-sync";
export { createMatchPathAsync, matchFromAbsolutePathsAsync, MatchPathAsync, } from "./match-path-async";
export { register } from "./register";
export { loadConfig, ConfigLoaderResult, ConfigLoaderSuccessResult, ConfigLoaderFailRes... | 230 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/tsconfig-paths | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/tsconfig-paths/lib/mapping-entry.d.ts | export interface MappingEntry {
readonly pattern: string;
readonly paths: ReadonlyArray<string>;
}
export interface Paths {
readonly [key: string]: ReadonlyArray<string>;
}
/**
* Converts an absolute baseUrl and paths to an array of absolute mapping entries.
* The array is sorted by longest prefix.
* Hav... | 231 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/tsconfig-paths | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/tsconfig-paths/lib/match-path-async.d.ts | import * as MappingEntry from "./mapping-entry";
import * as Filesystem from "./filesystem";
/**
* Function that can match a path async
*/
export interface MatchPathAsync {
(requestedModule: string, readJson: Filesystem.ReadJsonAsync | undefined, fileExists: Filesystem.FileExistsAsync | undefined, extensions: Rea... | 232 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/tsconfig-paths | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/tsconfig-paths/lib/match-path-sync.d.ts | import * as Filesystem from "./filesystem";
import * as MappingEntry from "./mapping-entry";
/**
* Function that can match a path
*/
export interface MatchPath {
(requestedModule: string, readJson?: Filesystem.ReadJsonSync, fileExists?: (name: string) => boolean, extensions?: ReadonlyArray<string>): string | unde... | 233 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/tsconfig-paths | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/tsconfig-paths/lib/register.d.ts | import { ExplicitParams } from "./config-loader";
export interface RegisterParams extends ExplicitParams {
/**
* Defaults to `--project` CLI flag or `process.cwd()`
*/
cwd?: string;
}
/**
* Installs a custom module load function that can adhere to paths in tsconfig.
* Returns a function to undo path... | 234 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/tsconfig-paths | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/tsconfig-paths/lib/try-path.d.ts | import { MappingEntry } from "./mapping-entry";
export interface TryPath {
readonly type: "file" | "extension" | "index" | "package";
readonly path: string;
}
/**
* Builds a list of all physical paths to try by:
* 1. Check for file named exactly as request.
* 2. Check for files named as request ending in any... | 235 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/tsconfig-paths | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/tsconfig-paths/lib/tsconfig-loader.d.ts | /**
* Typing for the parts of tsconfig that we care about
*/
export interface Tsconfig {
extends?: string;
compilerOptions?: {
baseUrl?: string;
paths?: {
[key: string]: Array<string>;
};
strict?: boolean;
};
}
export interface TsConfigLoaderResult {
tsConfi... | 236 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/upath/index.js | (()=>{var e={472:(e,t,r)=>{var n="2.0.1";var i,u,a,f,l,s,o,c,h,p,_,x=[].slice,d=[].indexOf||function(e){for(var t=0,r=this.length;t<r;t++){if(t in this&&this[t]===e)return t}return-1},m={}.hasOwnProperty;o=r(17);a=function(e){return typeof e==="function"};f=function(e){return typeof e==="string"||!!e&&typeof e==="objec... | 237 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/upath/license | Copyright(c) 2014-2020 Angelos Pikoulas (agelos.pikoulas@gmail.com)
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modif... | 238 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/upath/package.json | {"name":"upath","author":{"name":"Angelos Pikoulas","email":"agelos.pikoulas@gmail.com"},"version":"2.0.1","license":"MIT","types":"./upath.d.ts"}
| 239 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/upath/upath.d.ts | declare namespace upath {
/**
* A parsed path object generated by path.parse() or consumed by path.format().
*/
export interface ParsedPath {
/**
* The root of the path such as '/' or 'c:\'
*/
root: string;
/**
* The full directory path such as '/home/user/dir' or 'c:\path\dir'
... | 240 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/url-join/index.d.ts | // Type definitions for url-join 4.0
// Project: https://github.com/jfromaniello/url-join
// Definitions by: Rogier Schouten <https://github.com/rogierschouten>
// Mike Deverell <https://github.com/devrelm>
// BendingBender <https://github.com/BendingBender>
// Definitions: https://githu... | 241 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/url-join/index.js | (()=>{var e={670:function(e){(function(r,i,t){if(true&&e.exports)e.exports=t();else if(typeof define==="function"&&define.amd)define(t);else i[r]=t()})("urljoin",this,(function(){function normalize(e){var r=[];if(e.length===0){return""}if(typeof e[0]!=="string"){throw new TypeError("Url must be a string. Received "+e[0... | 242 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/url-join/license | MIT License
Copyright (c) 2015 José F. Romaniello
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish... | 243 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/url-join/package.json | {"name":"url-join","author":"José F. Romaniello <jfromaniello@gmail.com> (http://joseoncode.com)","version":"4.0.1","license":"MIT"}
| 244 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/webpack-chain/index.js | (()=>{var e={256:function(e){(function(t,s){true?e.exports=s():0})(this,(function(){"use strict";var e=function isMergeableObject(e){return isNonNullObject(e)&&!isSpecial(e)};function isNonNullObject(e){return!!e&&typeof e==="object"}function isSpecial(e){var t=Object.prototype.toString.call(e);return t==="[object RegE... | 245 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/webpack-chain/license | Mozilla Public License Version 2.0
==================================
1. Definitions
--------------
1.1. "Contributor"
means each individual or legal entity that creates, contributes to
the creation of, or owns Covered Software.
1.2. "Contributor Version"
means the combination of the Contributions of oth... | 246 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/webpack-chain/package.json | {"name":"webpack-chain","author":"Eli Perelman <eli@eliperelman.com>","version":"8.0.1","license":"MPL-2.0","typings":"types/index.d.ts"}
| 247 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/webpack-chain | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/compiled/webpack-chain/types/index.d.ts | import {
Configuration,
Compiler,
WebpackPluginInstance,
RuleSetRule,
ResolveOptions,
} from 'webpack';
import * as https from 'https';
export = Config;
declare namespace __Config {
class Chained<Parent> {
batch(handler: (chained: this) => void): this;
end(): Parent;
}
class TypedChainedMap<Pa... | 248 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/src/compiled.ts | import { Import } from './import';
export { default as fs } from '../compiled/fs-extra';
export { default as ora } from '../compiled/ora';
export { default as glob } from '../compiled/glob';
export { default as yaml } from '../compiled/js-yaml';
export { default as chalk } from '../compiled/chalk';
export { default as... | 249 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/src/import.ts | // cover: https://rushstack.io/pages/api/node-core-library.import.lazy/
const lazy = (moduleName: string, requireFn: (id: string) => unknown): any => {
const importLazyLocal: (moduleName: string) => unknown =
require('../compiled/import-lazy')(requireFn);
return importLazyLocal(moduleName);
};
export { lazy as... | 250 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/src/index.ts | export * from './compiled';
export * from './cli';
export * from './import';
| 251 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/src | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/src/cli/alias.ts | import fs from 'fs';
import path from 'path';
import { readTsConfigByFile } from './get';
import { applyOptionsChain } from './applyOptionsChain';
export type Alias = Record<string, string | string[]>;
export type AliasOption = Alias | ((aliases: Alias) => Alias | void);
interface NormalizedConfig {
source: {
... | 252 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/src | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/src/cli/applyOptionsChain.ts | import { isFunction, isPlainObject } from './is';
import { logger } from './logger';
export type Falsy = false | null | undefined | 0 | '';
export function applyOptionsChain<T, U>(
defaults: T,
options?:
| T
| ((config: T, utils?: U) => T | void)
| Array<T | ((config: T, utils?: U) => T | void)>
|... | 253 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/src | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/src/cli/babel.ts | import { isAbsolute, sep } from 'path';
import {
BabelConfig,
BabelConfigUtils,
BabelTransformOptions,
BabelPlugin,
PresetEnvOptions,
PresetReactOptions,
BabelPluginOptions,
} from '@modern-js/types';
import { applyOptionsChain } from './applyOptionsChain';
import { ensureArray } from './ensure';
import {... | 254 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/src | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/src/cli/commands.ts | export const getFullArgv = () => {
return process.env.MODERN_ARGV?.split(' ') || process.argv;
};
export const getArgv = () => {
return getFullArgv().slice(2);
};
export const getCommand = () => {
const args = getArgv();
const command = args[0];
return command;
};
export const isDevCommand = () => {
cons... | 255 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/src | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/src/cli/common.ts | import { debug } from '../../compiled/debug';
/**
* Create debug function with unified namespace prefix.
* @param scope - Custom module name of your debug function.
* @returns Debug function which namespace start with modern-js:.
*/
export const createDebugger = (scope: string) => debug(`modern-js:${scope}`);
exp... | 256 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/src | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/src/cli/config.ts | /**
* When merging config, some properties prefer `override` rather than `merge to array`
*/
export const isOverriddenConfigKey = (key: string) =>
['removeConsole', 'enableInlineScripts', 'enableInlineStyles'].includes(key);
| 257 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/src | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/src/cli/ensure.ts | import path from 'path';
/**
* ensure absolute file path.
* @param base - Base path to resolve relative from.
* @param filePath - Absolute or relative file path.
* @returns Resolved absolute file path.
*/
export const ensureAbsolutePath = (base: string, filePath: string): string =>
path.isAbsolute(filePath) ? f... | 258 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/src | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/src/cli/fs.ts | import { fs } from '../compiled';
/**
* Find first already exists file.
* @param files - Absolute file paths with extension.
* @returns The file path if exists, or false if no file exists.
*/
export const findExists = (files: string[]): string | false => {
for (const file of files) {
if (fs.existsSync(file) ... | 259 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/src | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/src/cli/index.ts | export * from './constants';
export * from './get';
export * from './is';
export * from './alias';
export * from './applyOptionsChain';
export * from './babel';
export * from './commands';
export * from './common';
export * from './ensure';
export * from './fs';
export * from './logger';
export * from './monorepo';
exp... | 260 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/src | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/src/cli/logger.ts | export { logger, createLogger, type Logger } from 'rslog';
| 261 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/src | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/src/cli/monorepo.ts | import fs from 'fs';
import path from 'path';
import { glob, yaml } from '../compiled';
const PACKAGE_MAX_DEPTH = 5;
const WORKSPACE_FILES = {
YARN: 'package.json',
PNPM: 'pnpm-workspace.yaml',
LERNA: 'lerna.json',
};
export const isLerna = (root: string) =>
fs.existsSync(path.join(root, WORKSPACE_FILES.LERN... | 262 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/src | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/src/cli/package.ts | import { execa } from '../compiled';
export async function getPnpmVersion() {
const { stdout } = await execa('pnpm', ['--version']);
return stdout;
}
export async function canUseNpm() {
try {
await execa('npm', ['--version'], { env: process.env });
return true;
} catch (e) {
return false;
}
}
e... | 263 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/src | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/src/cli/path.ts | import path from 'path';
import os from 'os';
import fs from 'fs';
import { nanoid, upath } from '../compiled';
export const isPathString = (test: string): boolean =>
path.posix.basename(test) !== test || path.win32.basename(test) !== test;
export const isRelativePath = (test: string): boolean =>
/^\.\.?($|[\\/])... | 264 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/src | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/src/cli/port.ts | import net from 'net';
import { chalk } from '../compiled';
import { logger } from './logger';
/**
* Get available free port.
* @param port - Current port want to use.
* @param tryLimits - Maximum number of retries.
* @param strictPort - Whether to throw an error when the port is occupied.
* @returns Available po... | 265 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/src | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/src/cli/prettyInstructions.ts | import os from 'os';
import { chalk } from '../compiled';
import { isDev, isSingleEntry } from './is';
import { DEFAULT_DEV_HOST } from './constants';
// TODO: type
interface EntryPoint {
entryName: string;
}
interface ServerRoute {
entryName: string;
isSSR: boolean;
urlPath: string;
}
const normalizeUrl = (... | 266 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/src | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/src/cli/require.ts | import { findExists } from './fs';
/**
* Require function compatible with esm and cjs module.
* @param filePath - File to required.
* @returns module export object.
*/
export const compatRequire = (filePath: string, interop = true) => {
const mod = require(filePath);
const rtnESMDefault = interop && mod?.__esM... | 267 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/src | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/src/cli/runtimeExports.ts | import path from 'path';
import { fs } from '../compiled';
import { normalizeOutputPath } from './path';
const memo = <T extends (...args: any[]) => any>(fn: T) => {
const cache = new Map();
return (...params: Parameters<T>): ReturnType<T> => {
const stringifiedParams = JSON.stringify(params);
const cache... | 268 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/src | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/src/cli/watch.ts | // Todo: only @modern-js/module-tools used
import path from 'path';
import { chokidar } from '../compiled';
export type WatchChangeTypeValueT = 'add' | 'unlink' | 'change';
export const WatchChangeType: Record<
'ADD' | 'UNLINK' | 'CHANGE',
WatchChangeTypeValueT
> = {
ADD: 'add',
UNLINK: 'unlink',
CHANGE: 'c... | 269 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/src/cli | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/src/cli/constants/chainId.ts | export const CHAIN_ID = {
/** Predefined rules */
RULE: {
/** Rule for .mjs */
MJS: 'mjs',
/** Rule for predefined loaders */
LOADERS: 'loaders',
/** Rule for fonts */
FONT: 'font',
/** Rule for images */
IMAGE: 'image',
/** Rule for media */
MEDIA: 'media',
/** Rule for ... | 270 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/src/cli | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/src/cli/constants/index.ts | import { InternalPlugins } from '@modern-js/types';
/**
* route specification file
*/
export const ROUTE_SPEC_FILE = 'route.json';
/**
* Front-end routing metadata
*/
export const NESTED_ROUTE_SPEC_FILE = 'nestedRoutes.json';
/**
* main entry name
*/
export const MAIN_ENTRY_NAME = 'main';
/**
* server side b... | 271 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/src/cli | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/src/cli/get/config.ts | import { isPlainObject } from '../is';
export const getEntryOptions = <T>(
name: string,
isMainEntry: boolean,
baseOptions?: T,
optionsByEntries?: Record<string, T>,
packageName?: string,
) => {
if (optionsByEntries) {
let optionsByEntry = getOptionsByEntryName(name, optionsByEntries);
// compatib... | 272 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/src/cli | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/src/cli/get/data.ts | import os from 'os';
import path from 'path';
import { InternalPlugins } from '@modern-js/types';
import { browserslist, fs, json5 } from '../../compiled';
import { INTERNAL_CLI_PLUGINS } from '../constants';
import { isDepExists } from '../is';
import { canUsePnpm, canUseYarn } from '../package';
// get data from fil... | 273 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/src/cli | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/src/cli/get/index.ts | import path from 'path';
import { CONFIG_FILE_EXTENSIONS } from '../constants';
import { findExists } from '../fs';
// get filepath
export const getServerConfig = async (
appDirectory: string,
configFile: string,
) => {
const configFilePath = findExists(
CONFIG_FILE_EXTENSIONS.map(extension =>
path.res... | 274 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/src/cli | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/src/cli/is/config.ts | import type { SSGMultiEntryOptions } from '@modern-js/types';
import { MAIN_ENTRY_NAME } from '../constants';
import { isEmpty } from './type';
interface EntryPoint {
entryName: string;
}
/**
* Is SSR project
*
* @param config - User config.
* @returns Whether to use server side render.
*/
export const isSSR =... | 275 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/src/cli | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/src/cli/is/env.ts | /**
* Get the current NODE_ENV, or default to 'development' if not set.
*/
export const getNodeEnv = (): string => process.env.NODE_ENV || 'development';
export const isDev = (): boolean => getNodeEnv() === 'development';
export const isProd = (): boolean => getNodeEnv() === 'production';
export const isTest = () ... | 276 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/src/cli | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/src/cli/is/index.ts | export * from './env';
export * from './type';
export * from './config';
export * from './project';
| 277 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/src/cli | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/src/cli/is/project.ts | import path from 'path';
import pkgUp from '../../../compiled/pkg-up';
import { getArgv } from '../commands';
import { fs, minimist, semver } from '../../compiled';
import { createDebugger } from '../common';
import { ensureArray } from '../ensure';
const debug = createDebugger('judge-depExists');
/**
* Check if the... | 278 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/src/cli | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/src/cli/is/type.ts | export function isString(str: any): str is string {
return typeof str === 'string';
}
export function isUndefined(obj: any): obj is undefined {
return typeof obj === 'undefined';
}
export function isArray(obj: unknown): obj is any[] {
return Array.isArray(obj);
}
// eslint-disable-next-line @typescript-eslint/... | 279 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/src | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/src/universal/constants.ts | /**
* Property mounted on window that describes route manifest
*/
export const ROUTE_MANIFEST = `_MODERNJS_ROUTE_MANIFEST`;
/**
* Property mounted on window that record all route modules
*/
export const ROUTE_MODULES = `_routeModules`;
/**
* hmr socket connect path
*/
export const HMR_SOCK_PATH = '/webpack-hmr'... | 280 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/src | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/src/universal/formatWebpack.ts | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file at
* https://github.com/facebook/create-react-app/blob/master/LICENSE
*/
// Modified by Chao Xu (xuchaobei)
import type webpack from 'webpack';
import type { StatsCompilation } fro... | 281 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/src | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/src/universal/pluginDagSort.ts | export const pluginDagSort = <P extends Record<string, any>>(
plugins: P[],
key = 'name',
preKey = 'pre',
postKey = 'post',
): P[] => {
type PluginQueryCondition = P | string;
let allLines: [string, string][] = [];
function getPluginByAny(q: PluginQueryCondition) {
const target = plugins.find(item =>
... | 282 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/tests/.eslintrc.js | module.exports = {
extends: ['@modern-js'],
parserOptions: {
project: require.resolve('./tsconfig.json'),
},
};
| 283 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/tests/alias.test.ts | import { getUserAlias } from '../src';
describe('getUserAlias', () => {
it('should filter invalid ts paths that are not array', () => {
expect(
getUserAlias({
foo: ['a', 'b'],
bar: 'c',
}),
).toEqual({
foo: ['a', 'b'],
});
});
});
| 284 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/tests/analyzeProject.test.ts | import path from 'path';
import { isApiOnly } from '../src';
describe('analyzeProject', () => {
test('apiOnly should be calculate correctly', () => {
const projectDir = path.join('./fixtures', 'analyze-projects', 'api-only');
const apiOnly = isApiOnly(projectDir);
expect(apiOnly).toBeTruthy();
});
});
| 285 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/tests/applyOptionsChain.test.ts | import { applyOptionsChain } from '../src';
describe('apply options chain', () => {
test(`should return default options`, () => {
expect(applyOptionsChain({ default: 'a' })).toEqual({ default: 'a' });
});
test(`should merge default options`, () => {
expect(
applyOptionsChain(
{ name: 'a' }... | 286 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/tests/babel.test.ts | import { resolve } from 'path';
import { applyUserBabelConfig } from '../src';
describe('applyUserBabelConfig', () => {
test('should add plugins correctly', () => {
const config = applyUserBabelConfig({}, (config, utils) => {
utils.addPlugins(['foo', ['bar', {}]]);
});
expect(config).toEqual({ plu... | 287 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/tests/commands.test.ts | import { getArgv, getCommand, isDevCommand } from '../src';
describe('test commands utils', () => {
test('should get command correctly', () => {
process.argv = ['', '', 'dev'];
expect(getCommand()).toBe('dev');
process.env.MODERN_ARGV = ['', '', 'start'].join(' ');
expect(getCommand()).toBe('start')... | 288 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/tests/compatRequire.test.ts | import path from 'path';
import { compatRequire, cleanRequireCache } from '../src';
describe('compat require', () => {
const fixturePath = path.resolve(__dirname, './fixtures/compat-require');
test(`should support default property`, () => {
expect(compatRequire(path.join(fixturePath, 'esm.js'))).toEqual({
... | 289 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/tests/debug.test.ts | import { debug } from '../src/compiled';
import { stripAnsi, createDebugger } from '../src';
describe('debug utility', () => {
test('should return file path', () => {
const debug1 = createDebugger('test');
const debug2 = createDebugger('test2');
debug.enable('modern-js:test2');
debug.log = (...arg... | 290 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/tests/ensureAbsolutePath.test.ts | import path from 'path';
import { ensureAbsolutePath } from '../src';
describe('ensure absolute file path', () => {
test('should return filePath directly', () => {
expect(
path.isAbsolute(ensureAbsolutePath('/a/b', '/a/b/c/d/e.jsx')),
).toBeTruthy();
});
test(`should resolve absolute path`, () => ... | 291 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/tests/findExists.test.ts | import path from 'path';
import { findExists } from '../src';
describe('find first exists file', () => {
const fixturePath = path.resolve(__dirname, './fixtures/file-exists');
test('should return file path', () => {
expect(
findExists(
['.js', '.ts', '.ejs', '.mjs'].map(ext =>
path.joi... | 292 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/tests/getAddressUrls.test.ts | import { getAddressUrls } from '../src';
describe('getAddressUrls', () => {
test('should allow to custom host', () => {
expect(getAddressUrls('http', 3000, 'localhost')).toEqual([
{ label: 'Local: ', url: 'http://localhost:3000' },
]);
expect(getAddressUrls('http', 3000, '192.168.0.1')).toEqual([
... | 293 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/tests/getBrowserslist.test.ts | import path from 'path';
import { getBrowserslist, defaults } from '../src';
describe('get browserslist', () => {
const fixture = path.resolve(__dirname, './fixtures/browserlist');
test(`should load browserslist from package.json`, () => {
expect(getBrowserslist(path.join(fixture, 'pkg'))).toEqual([
'no... | 294 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/tests/getEntryOptions.test.ts | import { getEntryOptions } from '../src';
describe('get entry options', () => {
test('should return default options', () => {
expect(getEntryOptions('page-a', false, 'default value')).toEqual(
'default value',
);
expect(
getEntryOptions('page-a', false, 'default value', { 'page-b': 'a' }),
... | 295 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/tests/getPort.test.ts | import net from 'net';
import { getPort } from '../src';
describe('get port', () => {
const originalPort = 45577;
const listenToPort = async (port: number) => {
const server = net.createServer();
server.unref();
return new Promise<() => void>(resolve => {
server.listen(
{
port,... | 296 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/tests/is.test.ts | import { isSSR, isTest, isEmpty, isUseSSRBundle, isSSGEntry } from '../src';
describe('validate', () => {
it('should validate empty object correctly', () => {
expect(isEmpty({})).toBeTruthy();
expect(isEmpty({ foo: 'bar' })).toBeFalsy();
});
it('should validate ssr config correctly', () => {
expect(... | 297 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/tests/isPackageInstalled.test.ts | import { isPackageInstalled } from '../src';
describe('isPackageInstalled', () => {
it('should return false if the package not is resolved', () => {
expect(isPackageInstalled('@foo/bar', __dirname)).toBeFalsy();
});
it('should return true if the package is resolved', () => {
expect(isPackageInstalled('l... | 298 |
0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils | petrpan-code/web-infra-dev/modern.js/packages/toolkit/utils/tests/isPlatform.test.ts | import { isBrowser } from '../src';
describe('validate platform', () => {
it('should validate browser correctly', () => {
const windowSpy = jest.spyOn(window, 'window', 'get');
windowSpy.mockImplementation((): any => undefined);
expect(isBrowser()).toBeFalsy();
windowSpy.mockImplementation((): any ... | 299 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.