backend allowing creation of models, records and databases
This commit is contained in:
parent
65fd38e205
commit
1381cefc41
|
@ -4,7 +4,6 @@
|
||||||
"packages": [
|
"packages": [
|
||||||
"packages/*"
|
"packages/*"
|
||||||
],
|
],
|
||||||
"useWorkspaces": true,
|
|
||||||
"command": {
|
"command": {
|
||||||
"publish": {
|
"publish": {
|
||||||
"ignoreChanges": [
|
"ignoreChanges": [
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "root",
|
"name": "root",
|
||||||
"private": true,
|
"private": true,
|
||||||
"workspaces": [
|
|
||||||
"packages/*"
|
|
||||||
],
|
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"babel-eslint": "^10.0.3",
|
"babel-eslint": "^10.0.3",
|
||||||
"eslint": "^6.8.0",
|
"eslint": "^6.8.0",
|
||||||
|
|
|
@ -118,7 +118,7 @@ const coreExternal = [
|
||||||
]
|
]
|
||||||
|
|
||||||
const customResolver = resolve({
|
const customResolver = resolve({
|
||||||
extensions: [".mjs", ".js", ".jsx", ".json", ".sass", ".scss", ".svelte"]
|
extensions: [".mjs", ".js", ".jsx", ".json", ".sass", ".scss", ".svelte", ".css"]
|
||||||
})
|
})
|
||||||
const projectRootDir = path.resolve(__dirname)
|
const projectRootDir = path.resolve(__dirname)
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ export const getBackendUiStore = () => {
|
||||||
name: "",
|
name: "",
|
||||||
},
|
},
|
||||||
breadcrumbs: [],
|
breadcrumbs: [],
|
||||||
|
models: [],
|
||||||
selectedDatabase: {},
|
selectedDatabase: {},
|
||||||
selectedModel: {},
|
selectedModel: {},
|
||||||
}
|
}
|
||||||
|
@ -27,12 +28,16 @@ export const getBackendUiStore = () => {
|
||||||
|
|
||||||
store.actions = {
|
store.actions = {
|
||||||
database: {
|
database: {
|
||||||
select: db =>
|
select: async db => {
|
||||||
|
const response = await api.get(`/api/${db.id}/models`)
|
||||||
|
const models = await response.json()
|
||||||
store.update(state => {
|
store.update(state => {
|
||||||
state.selectedDatabase = db
|
state.selectedDatabase = db
|
||||||
state.breadcrumbs = [db.name]
|
state.breadcrumbs = [db.name]
|
||||||
|
state.models = models
|
||||||
return state
|
return state
|
||||||
}),
|
})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
records: {
|
records: {
|
||||||
delete: () =>
|
delete: () =>
|
||||||
|
@ -51,6 +56,13 @@ export const getBackendUiStore = () => {
|
||||||
return state
|
return state
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
|
models: {
|
||||||
|
create: model => store.update(state => {
|
||||||
|
state.models.push(model)
|
||||||
|
state.models = state.models
|
||||||
|
return state
|
||||||
|
})
|
||||||
|
},
|
||||||
views: {
|
views: {
|
||||||
select: view =>
|
select: view =>
|
||||||
store.update(state => {
|
store.update(state => {
|
||||||
|
|
|
@ -42,7 +42,8 @@ export const getStore = () => {
|
||||||
currentNode: null,
|
currentNode: null,
|
||||||
libraries: null,
|
libraries: null,
|
||||||
showSettings: false,
|
showSettings: false,
|
||||||
useAnalytics: true
|
useAnalytics: true,
|
||||||
|
neoAppId: "84a14e3065c5f15ef8410a5e4c000d68"
|
||||||
}
|
}
|
||||||
|
|
||||||
const store = writable(initial)
|
const store = writable(initial)
|
||||||
|
|
|
@ -16,6 +16,6 @@
|
||||||
<div class="uk-margin">
|
<div class="uk-margin">
|
||||||
<label class="uk-form-label">{label}</label>
|
<label class="uk-form-label">{label}</label>
|
||||||
<div class="uk-form-controls">
|
<div class="uk-form-controls">
|
||||||
<input class="budibase__input" {value} on:change={inputChanged} />
|
<input class="budibase__input" type="number" {value} on:change={inputChanged} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,156 +0,0 @@
|
||||||
<script>
|
|
||||||
import Dropdown from "../common/Dropdown.svelte"
|
|
||||||
import Textbox from "../common/Textbox.svelte"
|
|
||||||
import Button from "../common/Button.svelte"
|
|
||||||
import ButtonGroup from "../common/ButtonGroup.svelte"
|
|
||||||
import NumberBox from "../common/NumberBox.svelte"
|
|
||||||
import ValuesList from "../common/ValuesList.svelte"
|
|
||||||
import ErrorsBox from "../common/ErrorsBox.svelte"
|
|
||||||
import Checkbox from "../common/Checkbox.svelte"
|
|
||||||
import ActionButton from "../common/ActionButton.svelte"
|
|
||||||
import DatePicker from "../common/DatePicker.svelte"
|
|
||||||
import {
|
|
||||||
cloneDeep,
|
|
||||||
keys,
|
|
||||||
isNumber,
|
|
||||||
includes,
|
|
||||||
map,
|
|
||||||
isBoolean,
|
|
||||||
} from "lodash/fp"
|
|
||||||
import {
|
|
||||||
allTypes,
|
|
||||||
validate,
|
|
||||||
getPotentialReferenceIndexes,
|
|
||||||
getDefaultTypeOptions,
|
|
||||||
getNode,
|
|
||||||
getPotentialReverseReferenceIndexes,
|
|
||||||
} from "../common/core"
|
|
||||||
|
|
||||||
export let field
|
|
||||||
export let allFields
|
|
||||||
export let onFinished = () => {}
|
|
||||||
export let store
|
|
||||||
|
|
||||||
let errors = []
|
|
||||||
let clonedField = cloneDeep(field)
|
|
||||||
|
|
||||||
$: isNew = !!field && field.name.length === 0
|
|
||||||
|
|
||||||
$: possibleReferenceIndexes = getPotentialReferenceIndexes(
|
|
||||||
store.hierarchy,
|
|
||||||
store.currentNode
|
|
||||||
)
|
|
||||||
|
|
||||||
$: selectedReverseRefIndex = !clonedField.typeOptions.indexNodeKey
|
|
||||||
? ""
|
|
||||||
: getNode(store.hierarchy, clonedField.typeOptions.indexNodeKey)
|
|
||||||
|
|
||||||
$: possibleReverseReferenceIndexes = !selectedReverseRefIndex
|
|
||||||
? []
|
|
||||||
: getPotentialReverseReferenceIndexes(
|
|
||||||
store.hierarchy,
|
|
||||||
selectedReverseRefIndex
|
|
||||||
)
|
|
||||||
|
|
||||||
const typeChanged = ev =>
|
|
||||||
(clonedField.typeOptions = getDefaultTypeOptions(ev.detail))
|
|
||||||
|
|
||||||
const save = () => {
|
|
||||||
errors = validate.field(allFields)(clonedField)
|
|
||||||
if (errors.length > 0) return
|
|
||||||
field.typeOptions = cloneDeep(clonedField.typeOptions)
|
|
||||||
onFinished({ ...field, ...clonedField })
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<div class="root">
|
|
||||||
|
|
||||||
<ErrorsBox {errors} />
|
|
||||||
|
|
||||||
<form on:submit|preventDefault class="uk-form-stacked">
|
|
||||||
<Textbox label="Name" bind:text={clonedField.name} />
|
|
||||||
<Dropdown
|
|
||||||
label="Type"
|
|
||||||
bind:selected={clonedField.type}
|
|
||||||
options={keys(allTypes)}
|
|
||||||
on:change={typeChanged} />
|
|
||||||
|
|
||||||
<Textbox label="Label" bind:text={clonedField.label} />
|
|
||||||
|
|
||||||
{#if clonedField.type === 'string'}
|
|
||||||
<NumberBox
|
|
||||||
label="Max Length"
|
|
||||||
bind:value={clonedField.typeOptions.maxLength} />
|
|
||||||
<ValuesList
|
|
||||||
label="Categories"
|
|
||||||
bind:values={clonedField.typeOptions.values} />
|
|
||||||
<Checkbox
|
|
||||||
label="Declared Values Only"
|
|
||||||
bind:checked={clonedField.typeOptions.allowDeclaredValuesOnly} />
|
|
||||||
{:else if clonedField.type === 'bool'}
|
|
||||||
<Checkbox
|
|
||||||
label="Allow Null"
|
|
||||||
bind:checked={clonedField.typeOptions.allowNulls} />
|
|
||||||
{:else if clonedField.type === 'datetime'}
|
|
||||||
<DatePicker
|
|
||||||
label="Min Value"
|
|
||||||
bind:value={clonedField.typeOptions.minValue} />
|
|
||||||
<DatePicker
|
|
||||||
label="Max Value"
|
|
||||||
bind:value={clonedField.typeOptions.maxValue} />
|
|
||||||
{:else if clonedField.type === 'number'}
|
|
||||||
<NumberBox
|
|
||||||
label="Min Value"
|
|
||||||
bind:value={clonedField.typeOptions.minValue} />
|
|
||||||
<NumberBox
|
|
||||||
label="Max Value"
|
|
||||||
bind:value={clonedField.typeOptions.maxValue} />
|
|
||||||
<NumberBox
|
|
||||||
label="Decimal Places"
|
|
||||||
bind:value={clonedField.typeOptions.decimalPlaces} />
|
|
||||||
{:else if clonedField.type === 'reference'}
|
|
||||||
<Dropdown
|
|
||||||
label="Lookup Index"
|
|
||||||
options={possibleReferenceIndexes}
|
|
||||||
valueMember={n => n.nodeKey()}
|
|
||||||
textMember={n => n.name}
|
|
||||||
bind:selected={clonedField.typeOptions.indexNodeKey} />
|
|
||||||
|
|
||||||
<Dropdown
|
|
||||||
label="Reverse Reference Index"
|
|
||||||
options={possibleReverseReferenceIndexes}
|
|
||||||
multiple="true"
|
|
||||||
valueMember={n => n.nodeKey()}
|
|
||||||
textMember={n => n.name}
|
|
||||||
bind:selected={clonedField.typeOptions.reverseIndexNodeKeys} />
|
|
||||||
|
|
||||||
<Textbox
|
|
||||||
label="Display Value"
|
|
||||||
bind:text={clonedField.typeOptions.displayValue} />
|
|
||||||
{:else if clonedField.type.startsWith('array')}
|
|
||||||
<NumberBox
|
|
||||||
label="Min Length"
|
|
||||||
bind:value={clonedField.typeOptions.minLength} />
|
|
||||||
<NumberBox
|
|
||||||
label="Max Length"
|
|
||||||
bind:value={clonedField.typeOptions.maxLength} />
|
|
||||||
{/if}
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
<footer>
|
|
||||||
<ActionButton primary on:click={save}>Save</ActionButton>
|
|
||||||
<ActionButton alert on:click={() => onFinished(false)}>Cancel</ActionButton>
|
|
||||||
</footer>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
.root {
|
|
||||||
margin: 20px;
|
|
||||||
}
|
|
||||||
footer {
|
|
||||||
padding: 20px;
|
|
||||||
border-radius: 0 0 5px 5px;
|
|
||||||
bottom: 0;
|
|
||||||
left: 0;
|
|
||||||
background: #fafafa;
|
|
||||||
}
|
|
||||||
</style>
|
|
|
@ -27,7 +27,7 @@
|
||||||
CreateEditRecordModal,
|
CreateEditRecordModal,
|
||||||
{
|
{
|
||||||
onClosed: close,
|
onClosed: close,
|
||||||
record: await selectRecord(row),
|
record: row,
|
||||||
},
|
},
|
||||||
{ styleContent: { padding: "0" } }
|
{ styleContent: { padding: "0" } }
|
||||||
)
|
)
|
||||||
|
@ -38,7 +38,7 @@
|
||||||
DeleteRecordModal,
|
DeleteRecordModal,
|
||||||
{
|
{
|
||||||
onClosed: close,
|
onClosed: close,
|
||||||
record: await selectRecord(row),
|
record: row,
|
||||||
},
|
},
|
||||||
{ styleContent: { padding: "0" } }
|
{ styleContent: { padding: "0" } }
|
||||||
)
|
)
|
||||||
|
@ -53,7 +53,7 @@
|
||||||
|
|
||||||
const ITEMS_PER_PAGE = 10
|
const ITEMS_PER_PAGE = 10
|
||||||
// Internal headers we want to hide from the user
|
// Internal headers we want to hide from the user
|
||||||
const INTERNAL_HEADERS = ["key", "sortKey", "type", "id", "isNew"]
|
const INTERNAL_HEADERS = ["_id", "_rev", "modelId", "type"]
|
||||||
|
|
||||||
let modalOpen = false
|
let modalOpen = false
|
||||||
let data = []
|
let data = []
|
||||||
|
@ -61,50 +61,25 @@
|
||||||
let views = []
|
let views = []
|
||||||
let currentPage = 0
|
let currentPage = 0
|
||||||
|
|
||||||
$: views = $backendUiStore.selectedRecord
|
$: instanceId = $backendUiStore.selectedDatabase.id
|
||||||
? childViewsForRecord($store.hierarchy)
|
|
||||||
: $store.hierarchy.indexes
|
|
||||||
|
|
||||||
$: currentAppInfo = {
|
$: {
|
||||||
appname: $store.appname,
|
if ($backendUiStore.selectedView) {
|
||||||
instanceId: $backendUiStore.selectedDatabase.id,
|
api.fetchDataForView($backendUiStore.selectedView, instanceId).then(records => {
|
||||||
|
data = records || []
|
||||||
|
headers = Object.keys($backendUiStore.selectedModel.schema).filter(key => !INTERNAL_HEADERS.includes(key));
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$: fetchRecordsForView(
|
|
||||||
$backendUiStore.selectedView,
|
|
||||||
$backendUiStore.selectedDatabase
|
|
||||||
).then(records => {
|
|
||||||
data = records || []
|
|
||||||
headers = hideInternalHeaders($backendUiStore.selectedView)
|
|
||||||
})
|
|
||||||
|
|
||||||
$: paginatedData = data.slice(
|
$: paginatedData = data.slice(
|
||||||
currentPage * ITEMS_PER_PAGE,
|
currentPage * ITEMS_PER_PAGE,
|
||||||
currentPage * ITEMS_PER_PAGE + ITEMS_PER_PAGE
|
currentPage * ITEMS_PER_PAGE + ITEMS_PER_PAGE
|
||||||
)
|
)
|
||||||
|
|
||||||
const getSchema = getIndexSchema($store.hierarchy)
|
// async function fetchRecordsForView(view, instance) {
|
||||||
|
// return await api.fetchDataForView($backendUiStore.selectedView)
|
||||||
const childViewsForRecord = compose(flatten, map("indexes"), get("children"))
|
// }
|
||||||
|
|
||||||
const hideInternalHeaders = compose(
|
|
||||||
remove(headerName => INTERNAL_HEADERS.includes(headerName)),
|
|
||||||
map(get("name")),
|
|
||||||
getSchema
|
|
||||||
)
|
|
||||||
|
|
||||||
async function fetchRecordsForView(view, instance) {
|
|
||||||
if (!view || !view.name) return
|
|
||||||
|
|
||||||
const viewName = $backendUiStore.selectedRecord
|
|
||||||
? `${$backendUiStore.selectedRecord.key}/${view.name}`
|
|
||||||
: view.name
|
|
||||||
|
|
||||||
return await api.fetchDataForView(viewName, {
|
|
||||||
appname: $store.appname,
|
|
||||||
instanceId: instance.id,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
function drillIntoRecord(record) {
|
function drillIntoRecord(record) {
|
||||||
backendUiStore.update(state => {
|
backendUiStore.update(state => {
|
||||||
|
@ -127,11 +102,6 @@
|
||||||
<h2 class="title">
|
<h2 class="title">
|
||||||
{takeRight(2, $backendUiStore.breadcrumbs).join(' / ')}
|
{takeRight(2, $backendUiStore.breadcrumbs).join(' / ')}
|
||||||
</h2>
|
</h2>
|
||||||
<Select icon="ri-eye-line" bind:value={$backendUiStore.selectedView}>
|
|
||||||
{#each views as view}
|
|
||||||
<option value={view}>{view.name}</option>
|
|
||||||
{/each}
|
|
||||||
</Select>
|
|
||||||
</div>
|
</div>
|
||||||
<table class="uk-table">
|
<table class="uk-table">
|
||||||
<thead>
|
<thead>
|
||||||
|
|
|
@ -14,8 +14,8 @@ export async function createDatabase(appname, instanceName) {
|
||||||
return await response.json()
|
return await response.json()
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function deleteRecord(record, { appname, instanceId }) {
|
export async function deleteRecord(record, instanceId) {
|
||||||
const DELETE_RECORDS_URL = `/_builder/instance/${appname}/${instanceId}/api/record${record.key}`
|
const DELETE_RECORDS_URL = `/api/${instanceId}/records/${record._id}/${record._rev}`
|
||||||
const response = await api.delete(DELETE_RECORDS_URL)
|
const response = await api.delete(DELETE_RECORDS_URL)
|
||||||
return response
|
return response
|
||||||
}
|
}
|
||||||
|
@ -26,34 +26,16 @@ export async function loadRecord(key, { appname, instanceId }) {
|
||||||
return await response.json()
|
return await response.json()
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function saveRecord(record, { appname, instanceId }) {
|
export async function saveRecord({ record, instanceId, modelId }) {
|
||||||
let recordBase = { ...record }
|
const SAVE_RECORDS_URL = `/api/${instanceId}/${modelId}/records`
|
||||||
|
const response = await api.post(SAVE_RECORDS_URL, record)
|
||||||
// brand new record
|
|
||||||
// car-model-id or name/specific-car-id/manus
|
|
||||||
if (record.collectionName) {
|
|
||||||
const collectionKey = `/${record.collectionName}`
|
|
||||||
recordBase = getNewRecord(recordBase, collectionKey)
|
|
||||||
recordBase = overwritePresentProperties(recordBase, record)
|
|
||||||
}
|
|
||||||
|
|
||||||
const SAVE_RECORDS_URL = `/_builder/instance/${appname}/${instanceId}/api/record/`
|
|
||||||
const response = await api.post(SAVE_RECORDS_URL, recordBase)
|
|
||||||
return await response.json()
|
return await response.json()
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function fetchDataForView(viewName, { appname, instanceId }) {
|
export async function fetchDataForView(viewName, instanceId) {
|
||||||
const FETCH_RECORDS_URL = `/_builder/instance/${appname}/${instanceId}/api/listRecords/${viewName}`
|
// const FETCH_RECORDS_URL = `/_builder/instance/${appname}/${instanceId}/api/listRecords/${viewName}`
|
||||||
|
const FETCH_RECORDS_URL = `/api/${instanceId}/${viewName}/records`
|
||||||
|
|
||||||
const response = await api.get(FETCH_RECORDS_URL)
|
const response = await api.get(FETCH_RECORDS_URL)
|
||||||
return await response.json()
|
return await response.json()
|
||||||
}
|
}
|
||||||
|
|
||||||
function overwritePresentProperties(baseObj, overwrites) {
|
|
||||||
const base = { ...baseObj }
|
|
||||||
|
|
||||||
for (let key in base) {
|
|
||||||
if (overwrites[key]) base[key] = overwrites[key]
|
|
||||||
}
|
|
||||||
return base
|
|
||||||
}
|
|
|
@ -0,0 +1,156 @@
|
||||||
|
<script>
|
||||||
|
import { tick } from "svelte"
|
||||||
|
import Textbox from "components/common/Textbox.svelte"
|
||||||
|
import Button from "components/common/Button.svelte"
|
||||||
|
import Select from "components/common/Select.svelte"
|
||||||
|
import ActionButton from "components/common/ActionButton.svelte"
|
||||||
|
import getIcon from "components/common/icon"
|
||||||
|
import FieldView from "./FieldView.svelte"
|
||||||
|
import api from "builderStore/api"
|
||||||
|
import { store, backendUiStore } from "builderStore"
|
||||||
|
import { common, hierarchy } from "../../../../../../../core/src/"
|
||||||
|
import { getNode } from "components/common/core"
|
||||||
|
import { templateApi, pipe, validate } from "components/common/core"
|
||||||
|
import ErrorsBox from "components/common/ErrorsBox.svelte"
|
||||||
|
|
||||||
|
export let model = { schema: {} }
|
||||||
|
export let onClosed
|
||||||
|
|
||||||
|
let showFieldView = false
|
||||||
|
let fieldToEdit
|
||||||
|
|
||||||
|
$: modelFields = model.schema ? Object.entries(model.schema) : []
|
||||||
|
$: instanceId = $backendUiStore.selectedDatabase.id
|
||||||
|
|
||||||
|
function editField() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function deleteField() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function onFinishedFieldEdit() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
async function saveModel() {
|
||||||
|
const SAVE_MODEL_URL = `/api/${instanceId}/models`
|
||||||
|
const response = await api.post(SAVE_MODEL_URL, model)
|
||||||
|
const newModel = await response.json()
|
||||||
|
backendUiStore.actions.models.create(newModel.model)
|
||||||
|
onClosed();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<heading>
|
||||||
|
{#if !showFieldView}
|
||||||
|
<i class="ri-list-settings-line button--toggled" />
|
||||||
|
<h3 class="budibase__title--3">Create / Edit Model</h3>
|
||||||
|
{:else}
|
||||||
|
<i class="ri-file-list-line button--toggled" />
|
||||||
|
<h3 class="budibase__title--3">Create / Edit Field</h3>
|
||||||
|
{/if}
|
||||||
|
</heading>
|
||||||
|
{#if !showFieldView}
|
||||||
|
<div class="padding">
|
||||||
|
<h4 class="budibase__label--big">Settings</h4>
|
||||||
|
|
||||||
|
{#if $store.errors && $store.errors.length > 0}
|
||||||
|
<ErrorsBox errors={$store.errors} />
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<Textbox label="Name" bind:text={model.name} />
|
||||||
|
|
||||||
|
<div class="table-controls">
|
||||||
|
<span class="budibase__label--big">Fields</span>
|
||||||
|
<h4 class="hoverable new-field" on:click={() => (showFieldView = true)}>
|
||||||
|
Add new field
|
||||||
|
</h4>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<table class="uk-table fields-table budibase__table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Edit</th>
|
||||||
|
<th>Name</th>
|
||||||
|
<th>Type</th>
|
||||||
|
<th>Values</th>
|
||||||
|
<th />
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{#each modelFields as [key, meta]}
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<i class="ri-more-line" on:click={() => editField(meta)} />
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>{key}</div>
|
||||||
|
</td>
|
||||||
|
<td>{meta.type}</td>
|
||||||
|
<!-- <td>{meta.typeOptions.values || ''}</td> -->
|
||||||
|
<td>
|
||||||
|
<i
|
||||||
|
class="ri-delete-bin-6-line hoverable"
|
||||||
|
on:click={() => deleteField(meta)} />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{/each}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<div class="uk-margin">
|
||||||
|
<ActionButton color="secondary" on:click={saveModel}>
|
||||||
|
Save
|
||||||
|
</ActionButton>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{:else}
|
||||||
|
<FieldView
|
||||||
|
field={fieldToEdit}
|
||||||
|
onFinished={onFinishedFieldEdit}
|
||||||
|
schema={model.schema}
|
||||||
|
goBack={() => showFieldView = false}
|
||||||
|
/>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.padding {
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.new-field {
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: bold;
|
||||||
|
color: var(--button-text);
|
||||||
|
}
|
||||||
|
|
||||||
|
.fields-table {
|
||||||
|
margin: 1rem 1rem 0rem 0rem;
|
||||||
|
border-collapse: collapse;
|
||||||
|
}
|
||||||
|
|
||||||
|
tbody > tr:hover {
|
||||||
|
background-color: var(--primary10);
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-controls {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ri-more-line:hover {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
heading {
|
||||||
|
padding: 20px 20px 0 20px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
h3 {
|
||||||
|
margin: 0 0 0 10px;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -0,0 +1,102 @@
|
||||||
|
<script>
|
||||||
|
import Dropdown from "components/common/Dropdown.svelte"
|
||||||
|
import Textbox from "components/common/Textbox.svelte"
|
||||||
|
import Button from "components/common/Button.svelte"
|
||||||
|
import ButtonGroup from "components/common/ButtonGroup.svelte"
|
||||||
|
import NumberBox from "components/common/NumberBox.svelte"
|
||||||
|
import ValuesList from "components/common/ValuesList.svelte"
|
||||||
|
import ErrorsBox from "components/common/ErrorsBox.svelte"
|
||||||
|
import Checkbox from "components/common/Checkbox.svelte"
|
||||||
|
import ActionButton from "components/common/ActionButton.svelte"
|
||||||
|
import DatePicker from "components/common/DatePicker.svelte"
|
||||||
|
import { keys, cloneDeep } from "lodash/fp"
|
||||||
|
import {
|
||||||
|
allTypes,
|
||||||
|
validate,
|
||||||
|
getDefaultTypeOptions,
|
||||||
|
} from "components/common/core"
|
||||||
|
|
||||||
|
export let field = { type: "string" }
|
||||||
|
export let schema
|
||||||
|
export let goBack
|
||||||
|
export let onFinished = () => {}
|
||||||
|
|
||||||
|
let errors = []
|
||||||
|
let draftField = cloneDeep(field);
|
||||||
|
|
||||||
|
const save = () => {
|
||||||
|
// errors = validate.field(allFields)(clonedField)
|
||||||
|
// if (errors.length > 0) return
|
||||||
|
// field.typeOptions = cloneDeep(clonedField.typeOptions)
|
||||||
|
schema[field.name] = draftField;
|
||||||
|
goBack();
|
||||||
|
// onFinished({ ...field, ...clonedField })
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="root">
|
||||||
|
|
||||||
|
<ErrorsBox {errors} />
|
||||||
|
|
||||||
|
<form on:submit|preventDefault class="uk-form-stacked">
|
||||||
|
<Textbox label="Name" bind:text={field.name} />
|
||||||
|
<Dropdown
|
||||||
|
label="Type"
|
||||||
|
bind:selected={draftField.type}
|
||||||
|
options={keys(allTypes)} />
|
||||||
|
|
||||||
|
{#if field.type === 'string'}
|
||||||
|
<NumberBox
|
||||||
|
label="Max Length"
|
||||||
|
bind:value={draftField.maxLength} />
|
||||||
|
<ValuesList
|
||||||
|
label="Categories"
|
||||||
|
bind:values={draftField.values} />
|
||||||
|
{:else if field.type === 'bool'}
|
||||||
|
<!-- TODO: revisit and fix with JSON schema -->
|
||||||
|
<Checkbox
|
||||||
|
label="Allow Null"
|
||||||
|
bind:checked={draftField.allowNulls} />
|
||||||
|
{:else if field.format === 'datetime'}
|
||||||
|
<!-- TODO: revisit and fix with JSON schema -->
|
||||||
|
<DatePicker
|
||||||
|
label="Min Value"
|
||||||
|
bind:value={draftField.minValue} />
|
||||||
|
<DatePicker
|
||||||
|
label="Max Value"
|
||||||
|
bind:value={draftField.maxValue} />
|
||||||
|
{:else if field.type === 'number'}
|
||||||
|
<NumberBox
|
||||||
|
label="Min Value"
|
||||||
|
bind:value={draftField.minimum} />
|
||||||
|
<NumberBox
|
||||||
|
label="Max Value"
|
||||||
|
bind:value={draftField.maximum} />
|
||||||
|
{:else if draftField.type.startsWith('array')}
|
||||||
|
<!-- TODO: revisit and fix with JSON schema -->
|
||||||
|
<NumberBox
|
||||||
|
label="Min Length"
|
||||||
|
bind:value={draftField.typeOptions.minLength} />
|
||||||
|
<NumberBox
|
||||||
|
label="Max Length"
|
||||||
|
bind:value={draftField.typeOptions.maxLength} />
|
||||||
|
{/if}
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<footer>
|
||||||
|
<ActionButton primary on:click={save}>Save</ActionButton>
|
||||||
|
<ActionButton alert on:click={goBack}>Cancel</ActionButton>
|
||||||
|
</footer>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.root {
|
||||||
|
margin: 20px;
|
||||||
|
}
|
||||||
|
footer {
|
||||||
|
padding: 20px;
|
||||||
|
border-radius: 0 0 5px 5px;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
background: #fafafa;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -13,63 +13,57 @@
|
||||||
import * as api from "../api"
|
import * as api from "../api"
|
||||||
import ErrorsBox from "components/common/ErrorsBox.svelte"
|
import ErrorsBox from "components/common/ErrorsBox.svelte"
|
||||||
|
|
||||||
export let record
|
export let record = {}
|
||||||
export let onClosed
|
export let onClosed
|
||||||
|
|
||||||
let errors = []
|
let errors = []
|
||||||
let selectedModel
|
let selectedModel
|
||||||
|
|
||||||
const childModelsForModel = compose(flatten, map("children"), get("children"))
|
$: instanceId = $backendUiStore.selectedDatabase.id
|
||||||
|
|
||||||
$: currentAppInfo = {
|
|
||||||
appname: $store.appname,
|
|
||||||
instanceId: $backendUiStore.selectedDatabase.id,
|
|
||||||
}
|
|
||||||
$: models = $backendUiStore.selectedRecord
|
$: models = $backendUiStore.selectedRecord
|
||||||
? childModelsForModel($store.hierarchy)
|
? childModelsForModel($store.hierarchy)
|
||||||
: $store.hierarchy.children
|
: $store.hierarchy.children
|
||||||
|
|
||||||
$: {
|
$: modelSchema = $backendUiStore.selectedModel
|
||||||
if (record) {
|
? Object.entries($backendUiStore.selectedModel.schema)
|
||||||
selectedModel = getExactNodeForKey($store.hierarchy)(record.key)
|
: []
|
||||||
} else {
|
|
||||||
selectedModel = selectedModel || models[0]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$: modelFields = selectedModel ? selectedModel.fields : []
|
|
||||||
|
|
||||||
function getCurrentCollectionKey(selectedRecord) {
|
|
||||||
return selectedRecord
|
|
||||||
? joinKey(selectedRecord.key, selectedModel.collectionName)
|
|
||||||
: joinKey(selectedModel.collectionName)
|
|
||||||
}
|
|
||||||
|
|
||||||
$: editingRecord =
|
|
||||||
record ||
|
|
||||||
getNewRecord(
|
|
||||||
selectedModel,
|
|
||||||
getCurrentCollectionKey($backendUiStore.selectedRecord)
|
|
||||||
)
|
|
||||||
|
|
||||||
function closed() {
|
function closed() {
|
||||||
editingRecord = null
|
// editingRecord = null
|
||||||
onClosed()
|
onClosed()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function determineInputType(meta) {
|
||||||
|
if (meta.type === "datetime") return "date"
|
||||||
|
if (meta.type === "number") return "number"
|
||||||
|
if (meta.type === "boolean") return "checkbox"
|
||||||
|
|
||||||
|
return "text"
|
||||||
|
}
|
||||||
|
|
||||||
async function saveRecord() {
|
async function saveRecord() {
|
||||||
const recordResponse = await api.saveRecord(editingRecord, currentAppInfo)
|
const recordResponse = await api.saveRecord({
|
||||||
|
record,
|
||||||
|
instanceId,
|
||||||
|
modelId: $backendUiStore.selectedModel._id
|
||||||
|
})
|
||||||
|
if (recordResponse.errors) {
|
||||||
|
errors = recordResponse.errors;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
backendUiStore.update(state => {
|
backendUiStore.update(state => {
|
||||||
state.selectedView = state.selectedView
|
state.selectedView = state.selectedView
|
||||||
return state
|
return state
|
||||||
})
|
})
|
||||||
closed()
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="actions">
|
<div class="actions">
|
||||||
<h4 class="budibase__title--4">Create / Edit Record</h4>
|
<h4 class="budibase__title--4">Create / Edit Record</h4>
|
||||||
<ErrorsBox {errors} />
|
<!-- <ErrorsBox {errors} /> -->
|
||||||
|
{JSON.stringify(errors)}
|
||||||
<form on:submit|preventDefault class="uk-form-stacked">
|
<form on:submit|preventDefault class="uk-form-stacked">
|
||||||
{#if !record}
|
{#if !record}
|
||||||
<div class="uk-margin">
|
<div class="uk-margin">
|
||||||
|
@ -81,8 +75,14 @@
|
||||||
</Select>
|
</Select>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
{#each modelFields || [] as field}
|
{#each modelSchema as [key, meta]}
|
||||||
<RecordFieldControl record={editingRecord} {field} {errors} />
|
<div class="uk-margin">
|
||||||
|
<RecordFieldControl
|
||||||
|
{errors}
|
||||||
|
type={determineInputType(meta)}
|
||||||
|
label={key}
|
||||||
|
bind:value={record[key]} />
|
||||||
|
</div>
|
||||||
{/each}
|
{/each}
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -6,10 +6,7 @@
|
||||||
export let record
|
export let record
|
||||||
export let onClosed
|
export let onClosed
|
||||||
|
|
||||||
$: currentAppInfo = {
|
$: instanceId = $backendUiStore.selectedDatabase.id
|
||||||
appname: $store.appname,
|
|
||||||
instanceId: $backendUiStore.selectedDatabase.id,
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
|
@ -28,7 +25,7 @@
|
||||||
<ActionButton
|
<ActionButton
|
||||||
alert
|
alert
|
||||||
on:click={async () => {
|
on:click={async () => {
|
||||||
await api.deleteRecord(record, currentAppInfo)
|
await api.deleteRecord(record, instanceId)
|
||||||
backendUiStore.actions.records.delete(record)
|
backendUiStore.actions.records.delete(record)
|
||||||
onClosed()
|
onClosed()
|
||||||
}}>
|
}}>
|
||||||
|
|
|
@ -0,0 +1,66 @@
|
||||||
|
<script>
|
||||||
|
import Select from "../../../common/Select.svelte"
|
||||||
|
|
||||||
|
export let record
|
||||||
|
export let field
|
||||||
|
export let errors
|
||||||
|
|
||||||
|
$: isDropdown =
|
||||||
|
field.type === "string" &&
|
||||||
|
field.typeOptions.values &&
|
||||||
|
field.typeOptions.values.length > 0
|
||||||
|
|
||||||
|
$: isNumber = field.type === "number"
|
||||||
|
|
||||||
|
$: isText = field.type === "string" && !isDropdown
|
||||||
|
|
||||||
|
$: isCheckbox = field.type === "bool"
|
||||||
|
|
||||||
|
$: isError = errors && errors.some(e => e.field && e.field === field.name)
|
||||||
|
|
||||||
|
$: isDatetime = field.type === "datetime"
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="uk-margin">
|
||||||
|
{#if !isCheckbox}
|
||||||
|
<label class="uk-form-label" for={field.name}>{field.label}</label>
|
||||||
|
{/if}
|
||||||
|
<div class="uk-form-controls">
|
||||||
|
{#if isDropdown}
|
||||||
|
<Select bind:value={record[field.name]}>
|
||||||
|
<option value="" />
|
||||||
|
{#each field.typeOptions.values as val}
|
||||||
|
<option value={val}>{val}</option>
|
||||||
|
{/each}
|
||||||
|
</Select>
|
||||||
|
{:else if isText}
|
||||||
|
<input
|
||||||
|
class="uk-input"
|
||||||
|
class:uk-form-danger={isError}
|
||||||
|
id={field.name}
|
||||||
|
type="text"
|
||||||
|
bind:value={record[field.name]} />
|
||||||
|
{:else if isNumber}
|
||||||
|
<input
|
||||||
|
class="uk-input"
|
||||||
|
class:uk-form-danger={isError}
|
||||||
|
type="number"
|
||||||
|
bind:value={record[field.name]} />
|
||||||
|
{:else if isDatetime}
|
||||||
|
<input
|
||||||
|
class="uk-input"
|
||||||
|
class:uk-form-danger={isError}
|
||||||
|
type="date"
|
||||||
|
bind:value={record[field.name]} />
|
||||||
|
{:else if isCheckbox}
|
||||||
|
<label>
|
||||||
|
<input
|
||||||
|
class="uk-checkbox"
|
||||||
|
class:uk-form-danger={isError}
|
||||||
|
type="checkbox"
|
||||||
|
bind:checked={record[field.name]} />
|
||||||
|
{field.label}
|
||||||
|
</label>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</div>
|
|
@ -1,66 +1,29 @@
|
||||||
<script>
|
<script>
|
||||||
import Select from "../../../common/Select.svelte"
|
export let type = "text"
|
||||||
|
export let value = ""
|
||||||
|
export let label
|
||||||
|
export let errors = []
|
||||||
|
|
||||||
export let record
|
const handleInput = event => {
|
||||||
export let field
|
if (event.target.type === "checkbox") {
|
||||||
export let errors
|
value = event.target.checked;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$: isDropdown =
|
if (event.target.type === "number") {
|
||||||
field.type === "string" &&
|
value = parseInt(event.target.value);
|
||||||
field.typeOptions.values &&
|
return;
|
||||||
field.typeOptions.values.length > 0
|
}
|
||||||
|
|
||||||
$: isNumber = field.type === "number"
|
value = event.target.value;
|
||||||
|
}
|
||||||
$: isText = field.type === "string" && !isDropdown
|
|
||||||
|
|
||||||
$: isCheckbox = field.type === "bool"
|
|
||||||
|
|
||||||
$: isError = errors && errors.some(e => e.field && e.field === field.name)
|
|
||||||
|
|
||||||
$: isDatetime = field.type === "datetime"
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="uk-margin">
|
<label>{label}</label>
|
||||||
{#if !isCheckbox}
|
<input
|
||||||
<label class="uk-form-label" for={field.name}>{field.label}</label>
|
class="uk-input"
|
||||||
{/if}
|
class:uk-form-danger={errors.length > 0}
|
||||||
<div class="uk-form-controls">
|
{type}
|
||||||
{#if isDropdown}
|
{value}
|
||||||
<Select bind:value={record[field.name]}>
|
on:input={handleInput}
|
||||||
<option value="" />
|
on:change={handleInput} />
|
||||||
{#each field.typeOptions.values as val}
|
|
||||||
<option value={val}>{val}</option>
|
|
||||||
{/each}
|
|
||||||
</Select>
|
|
||||||
{:else if isText}
|
|
||||||
<input
|
|
||||||
class="uk-input"
|
|
||||||
class:uk-form-danger={isError}
|
|
||||||
id={field.name}
|
|
||||||
type="text"
|
|
||||||
bind:value={record[field.name]} />
|
|
||||||
{:else if isNumber}
|
|
||||||
<input
|
|
||||||
class="uk-input"
|
|
||||||
class:uk-form-danger={isError}
|
|
||||||
type="number"
|
|
||||||
bind:value={record[field.name]} />
|
|
||||||
{:else if isDatetime}
|
|
||||||
<input
|
|
||||||
class="uk-input"
|
|
||||||
class:uk-form-danger={isError}
|
|
||||||
type="date"
|
|
||||||
bind:value={record[field.name]} />
|
|
||||||
{:else if isCheckbox}
|
|
||||||
<label>
|
|
||||||
<input
|
|
||||||
class="uk-checkbox"
|
|
||||||
class:uk-form-danger={isError}
|
|
||||||
type="checkbox"
|
|
||||||
bind:checked={record[field.name]} />
|
|
||||||
{field.label}
|
|
||||||
</label>
|
|
||||||
{/if}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
export { default as DeleteRecordModal } from "./DeleteRecord.svelte"
|
export { default as DeleteRecordModal } from "./DeleteRecord.svelte"
|
||||||
export { default as CreateEditRecordModal } from "./CreateEditRecord.svelte"
|
export { default as CreateEditRecordModal } from "./CreateEditRecord.svelte"
|
||||||
export { default as CreateEditModelModal } from "./CreateEditModel.svelte"
|
export { default as CreateEditModelModal } from "./CreateEditModel/CreateEditModel.svelte"
|
||||||
export { default as CreateEditViewModal } from "./CreateEditView.svelte"
|
export { default as CreateEditViewModal } from "./CreateEditView.svelte"
|
||||||
export { default as CreateDatabaseModal } from "./CreateDatabase.svelte"
|
export { default as CreateDatabaseModal } from "./CreateDatabase.svelte"
|
||||||
export { default as CreateUserModal } from "./CreateUser.svelte"
|
export { default as CreateUserModal } from "./CreateUser.svelte"
|
||||||
|
|
|
@ -6,16 +6,14 @@
|
||||||
import { CheckIcon } from "../common/Icons"
|
import { CheckIcon } from "../common/Icons"
|
||||||
|
|
||||||
$: instances = $store.appInstances
|
$: instances = $store.appInstances
|
||||||
$: views = $store.hierarchy.indexes
|
// $: views = $store.hierarchy.indexes
|
||||||
|
|
||||||
async function selectDatabase(database) {
|
async function selectDatabase(database) {
|
||||||
backendUiStore.actions.records.select(null)
|
|
||||||
backendUiStore.actions.views.select(views[0])
|
|
||||||
backendUiStore.actions.database.select(database)
|
backendUiStore.actions.database.select(database)
|
||||||
}
|
}
|
||||||
|
|
||||||
async function deleteDatabase(database) {
|
async function deleteDatabase(database) {
|
||||||
const DELETE_DATABASE_URL = `/_builder/instance/_master/0/api/record/applications/${$store.appId}/instances/${database.id}`
|
const DELETE_DATABASE_URL = `/api/instances/${database.id}`
|
||||||
const response = await api.delete(DELETE_DATABASE_URL)
|
const response = await api.delete(DELETE_DATABASE_URL)
|
||||||
store.update(state => {
|
store.update(state => {
|
||||||
state.appInstances = state.appInstances.filter(
|
state.appInstances = state.appInstances.filter(
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
const { open, close } = getContext("simple-modal")
|
const { open, close } = getContext("simple-modal")
|
||||||
|
|
||||||
export let level = 0
|
// export let level = 0
|
||||||
export let node
|
export let node
|
||||||
export let type
|
export let type
|
||||||
|
|
||||||
|
@ -27,31 +27,35 @@
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
function selectHierarchyItem(node) {
|
function selectModel(model) {
|
||||||
store.selectExistingNode(node.nodeId)
|
backendUiStore.update(state => {
|
||||||
const modalType =
|
state.selectedModel = model
|
||||||
node.type === "index" ? CreateEditViewModal : CreateEditModelModal
|
state.selectedView = `all_${model._id}`
|
||||||
open(
|
return state;
|
||||||
modalType,
|
})
|
||||||
{
|
// store.selectExistingNode(node.nodeId)
|
||||||
onClosed: close,
|
// const modalType =
|
||||||
},
|
// node.type === "index" ? CreateEditViewModal : CreateEditModelModal
|
||||||
{ styleContent: { padding: "0" } }
|
// open(
|
||||||
)
|
// modalType,
|
||||||
|
// {
|
||||||
|
// onClosed: close,
|
||||||
|
// },
|
||||||
|
// { styleContent: { padding: "0" } }
|
||||||
|
// )
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<div
|
<div
|
||||||
on:click={() => selectHierarchyItem(node)}
|
on:click={() => selectModel(node)}
|
||||||
class="budibase__nav-item hierarchy-item"
|
class="budibase__nav-item hierarchy-item"
|
||||||
class:capitalized={type === 'model'}
|
class:capitalized={type === 'model'}
|
||||||
style="padding-left: {20 + level * 20}px"
|
class:selected={$backendUiStore.selectedModel._id === node._id}>
|
||||||
class:selected={navActive}>
|
|
||||||
<i class={ICON_MAP[type]} />
|
<i class={ICON_MAP[type]} />
|
||||||
<span style="margin-left: 1rem">{node.name}</span>
|
<span style="margin-left: 1rem">{node.name}</span>
|
||||||
</div>
|
</div>
|
||||||
{#if node.children}
|
<!-- {#if node.children}
|
||||||
{#each node.children as child}
|
{#each node.children as child}
|
||||||
<svelte:self node={child} level={level + 1} type="model" />
|
<svelte:self node={child} level={level + 1} type="model" />
|
||||||
{/each}
|
{/each}
|
||||||
|
@ -60,7 +64,7 @@
|
||||||
{#each node.indexes as index}
|
{#each node.indexes as index}
|
||||||
<svelte:self node={index} level={level + 1} type="index" />
|
<svelte:self node={index} level={level + 1} type="index" />
|
||||||
{/each}
|
{/each}
|
||||||
{/if}
|
{/if} -->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
@ -68,6 +72,7 @@
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
|
padding-left: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.capitalized {
|
.capitalized {
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
<script>
|
<script>
|
||||||
import { getContext } from "svelte"
|
import { getContext, onMount } from "svelte"
|
||||||
import { store, backendUiStore } from "builderStore"
|
import { store, backendUiStore } from "builderStore"
|
||||||
import HierarchyRow from "./HierarchyRow.svelte"
|
import HierarchyRow from "./HierarchyRow.svelte"
|
||||||
import DropdownButton from "components/common/DropdownButton.svelte"
|
import DropdownButton from "components/common/DropdownButton.svelte"
|
||||||
import NavItem from "./NavItem.svelte"
|
import NavItem from "./NavItem.svelte"
|
||||||
import getIcon from "components/common/icon"
|
import getIcon from "components/common/icon"
|
||||||
|
import api from "builderStore/api"
|
||||||
import {
|
import {
|
||||||
CreateEditModelModal,
|
CreateEditModelModal,
|
||||||
CreateEditViewModal,
|
CreateEditViewModal,
|
||||||
|
@ -13,11 +14,6 @@
|
||||||
const { open, close } = getContext("simple-modal")
|
const { open, close } = getContext("simple-modal")
|
||||||
|
|
||||||
function newModel() {
|
function newModel() {
|
||||||
if ($store.currentNode) {
|
|
||||||
store.newChildModel()
|
|
||||||
} else {
|
|
||||||
store.newRootModel()
|
|
||||||
}
|
|
||||||
open(
|
open(
|
||||||
CreateEditModelModal,
|
CreateEditModelModal,
|
||||||
{
|
{
|
||||||
|
@ -28,7 +24,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function newView() {
|
function newView() {
|
||||||
store.newRootIndex()
|
// store.newRootIndex()
|
||||||
open(
|
open(
|
||||||
CreateEditViewModal,
|
CreateEditViewModal,
|
||||||
{
|
{
|
||||||
|
@ -43,7 +39,7 @@
|
||||||
<div class="hierarchy">
|
<div class="hierarchy">
|
||||||
<div class="components-list-container">
|
<div class="components-list-container">
|
||||||
<div class="nav-group-header">
|
<div class="nav-group-header">
|
||||||
<div class="hierarchy-title">Schema</div>
|
<div class="hierarchy-title">Models</div>
|
||||||
<div class="uk-inline">
|
<div class="uk-inline">
|
||||||
<i class="ri-add-line hoverable" />
|
<i class="ri-add-line hoverable" />
|
||||||
<div uk-dropdown="mode: click;">
|
<div uk-dropdown="mode: click;">
|
||||||
|
@ -57,13 +53,16 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="hierarchy-items-container">
|
<div class="hierarchy-items-container">
|
||||||
{#each $store.hierarchy.children as model}
|
{#each $backendUiStore.models as model}
|
||||||
|
<HierarchyRow node={model} type="model" />
|
||||||
|
{/each}
|
||||||
|
<!-- {#each $store.hierarchy.children as model}
|
||||||
<HierarchyRow node={model} type="model" />
|
<HierarchyRow node={model} type="model" />
|
||||||
{/each}
|
{/each}
|
||||||
|
|
||||||
{#each $store.hierarchy.indexes as index}
|
{#each $store.hierarchy.indexes as index}
|
||||||
<HierarchyRow node={index} type="index" />
|
<HierarchyRow node={index} type="index" />
|
||||||
{/each}
|
{/each} -->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
async function fetchUsers() {
|
async function fetchUsers() {
|
||||||
const FETCH_USERS_URL = `/_builder/instance/${currentAppInfo.appname}/${currentAppInfo.instanceId}/api/users`
|
const FETCH_USERS_URL = `/api/${currentAppInfo.instanceId}/users`
|
||||||
const response = await api.get(FETCH_USERS_URL)
|
const response = await api.get(FETCH_USERS_URL)
|
||||||
users = await response.json()
|
users = await response.json()
|
||||||
backendUiStore.update(state => {
|
backendUiStore.update(state => {
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
<div>
|
<div>
|
||||||
<h4 style="margin-bottom: 20px">Choose an Application</h4>
|
<h4 style="margin-bottom: 20px">Choose an Application</h4>
|
||||||
{#each apps as app}
|
{#each apps as app}
|
||||||
<a href={`/_builder/${app}`} class="app-link">{app}</a>
|
<a href={`/_builder/${app.name}`} class="app-link">{app.name}</a>
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -16,7 +16,7 @@ export const validatePage = page => {
|
||||||
!isString(page.appBody) ||
|
!isString(page.appBody) ||
|
||||||
!page.appBody.endsWith(".json")
|
!page.appBody.endsWith(".json")
|
||||||
) {
|
) {
|
||||||
error("App body must be set toa valid JSON file")
|
error("App body must be set to a valid JSON file")
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Commenting this for now
|
/* Commenting this for now
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
let promise = getPackage()
|
let promise = getPackage()
|
||||||
|
|
||||||
async function getPackage() {
|
async function getPackage() {
|
||||||
const res = await fetch(`/_builder/api/${application}/appPackage`)
|
const res = await fetch(`/api/budibase/${$store.neoAppId}/appPackage`)
|
||||||
const pkg = await res.json()
|
const pkg = await res.json()
|
||||||
|
|
||||||
if (res.ok) {
|
if (res.ok) {
|
||||||
|
|
|
@ -9,12 +9,10 @@
|
||||||
const { open, close } = getContext("simple-modal")
|
const { open, close } = getContext("simple-modal")
|
||||||
|
|
||||||
const createNewRecord = () => {
|
const createNewRecord = () => {
|
||||||
selectedRecord = null
|
|
||||||
open(
|
open(
|
||||||
CreateEditRecordModal,
|
CreateEditRecordModal,
|
||||||
{
|
{
|
||||||
onClosed: close,
|
onClosed: close
|
||||||
record: selectedRecord,
|
|
||||||
},
|
},
|
||||||
{ styleContent: { padding: "0" } }
|
{ styleContent: { padding: "0" } }
|
||||||
)
|
)
|
||||||
|
|
|
@ -7,8 +7,6 @@
|
||||||
$: views = $store.hierarchy.indexes
|
$: views = $store.hierarchy.indexes
|
||||||
|
|
||||||
async function selectDatabase(database) {
|
async function selectDatabase(database) {
|
||||||
backendUiStore.actions.records.select(null)
|
|
||||||
backendUiStore.actions.views.select(views[0])
|
|
||||||
backendUiStore.actions.database.select(database)
|
backendUiStore.actions.database.select(database)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,6 @@
|
||||||
$: views = $store.hierarchy.indexes
|
$: views = $store.hierarchy.indexes
|
||||||
|
|
||||||
async function selectDatabase(database) {
|
async function selectDatabase(database) {
|
||||||
backendUiStore.actions.records.select(null)
|
|
||||||
backendUiStore.actions.views.select(views[0])
|
|
||||||
backendUiStore.actions.database.select(database)
|
backendUiStore.actions.database.select(database)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
let promise = getApps()
|
let promise = getApps()
|
||||||
|
|
||||||
async function getApps() {
|
async function getApps() {
|
||||||
const res = await fetch(`/_builder/api/apps`)
|
const res = await fetch(`/api/budibase/applications`)
|
||||||
const json = await res.json()
|
const json = await res.json()
|
||||||
|
|
||||||
if (res.ok) {
|
if (res.ok) {
|
||||||
|
|
|
@ -13,6 +13,12 @@ module.exports = opts => {
|
||||||
console.log(chalk.green(`Budibase app ${opts.name} created!`))
|
console.log(chalk.green(`Budibase app ${opts.name} created!`))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const run2 = async opts => {
|
||||||
|
// create a brand new app in couch
|
||||||
|
// create an empty app package locally
|
||||||
|
exec(`cd ${join(opts.config.latestPackagesFolder, opts.name)} && npm install`)
|
||||||
|
}
|
||||||
|
|
||||||
const run = async opts => {
|
const run = async opts => {
|
||||||
const context = await getAppContext({
|
const context = await getAppContext({
|
||||||
configName: opts.config,
|
configName: opts.config,
|
||||||
|
@ -36,7 +42,10 @@ const createEmptyAppPackage = async opts => {
|
||||||
const appsFolder = opts.config.latestPackagesFolder || "."
|
const appsFolder = opts.config.latestPackagesFolder || "."
|
||||||
const destinationFolder = resolve(appsFolder, opts.name)
|
const destinationFolder = resolve(appsFolder, opts.name)
|
||||||
|
|
||||||
if (await exists(destinationFolder)) return
|
if (await exists(destinationFolder)) {
|
||||||
|
console.log(chalk.red(`App ${opts.name} already exists.`))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
await copy(templateFolder, destinationFolder)
|
await copy(templateFolder, destinationFolder)
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
"use strict";Object.defineProperty(exports, "__esModule", { value: true });Object.defineProperty(exports, "validateRecord", { enumerable: true, get: function get() {return _validateRecord.validateRecord;} });Object.defineProperty(exports, "events", { enumerable: true, get: function get() {return _events.events;} });Object.defineProperty(exports, "safeParseField", { enumerable: true, get: function get() {return _types.safeParseField;} });var _validateRecord = require("./records/validateRecord");
|
"use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports, "__esModule", { value: true });Object.defineProperty(exports, "validateRecord", { enumerable: true, get: function get() {return _validateRecord.validateRecord;} });Object.defineProperty(exports, "events", { enumerable: true, get: function get() {return _events.events;} });Object.defineProperty(exports, "safeParseField", { enumerable: true, get: function get() {return _types.safeParseField;} });Object.defineProperty(exports, "schemaValidator", { enumerable: true, get: function get() {return _schemaValidation["default"];} });var _validateRecord = require("./records/validateRecord");
|
||||||
var _events = require("./common/events");
|
var _events = require("./common/events");
|
||||||
var _types = require("./schema/types");
|
var _types = require("./schema/types");
|
||||||
|
var _schemaValidation = _interopRequireDefault(require("./schemaValidation"));
|
||||||
//# sourceMappingURL=index.js.map
|
//# sourceMappingURL=index.js.map
|
|
@ -1 +1 @@
|
||||||
{"version":3,"sources":["../src/index.js"],"names":[],"mappings":"ybAAA;AACA;AACA","sourcesContent":["export { validateRecord } from \"./records/validateRecord\";\nexport { events } from \"./common/events\";\nexport { safeParseField } from \"./schema/types\";"],"file":"index.js"}
|
{"version":3,"sources":["../src/index.js"],"names":[],"mappings":"kpBAAA;AACA;AACA;AACA","sourcesContent":["export { validateRecord } from \"./records/validateRecord\";\nexport { events } from \"./common/events\";\nexport { safeParseField } from \"./schema/types\";\nexport { default as schemaValidator } from \"./schemaValidation\";"],"file":"index.js"}
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,6 @@
|
||||||
|
"use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports, "__esModule", { value: true });exports["default"] = void 0;var _ajv = _interopRequireDefault(require("ajv"));
|
||||||
|
|
||||||
|
var ajv = new _ajv["default"]();var _default =
|
||||||
|
|
||||||
|
ajv;exports["default"] = _default;
|
||||||
|
//# sourceMappingURL=index.js.map
|
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"sources":["../../src/schemaValidation/index.js"],"names":["ajv","Ajv"],"mappings":"4LAAA;;AAEA,IAAMA,GAAG,GAAG,IAAIC,eAAJ,EAAZ,C;;AAEeD,G","sourcesContent":["import Ajv from \"ajv\";\n\nconst ajv = new Ajv();\n\nexport default ajv;"],"file":"index.js"}
|
|
@ -1 +1 @@
|
||||||
../../../../node_modules/@babel/cli/bin/babel.js
|
../@babel/cli/bin/babel.js
|
|
@ -1 +1 @@
|
||||||
../../../../node_modules/@babel/cli/bin/babel-external-helpers.js
|
../@babel/cli/bin/babel-external-helpers.js
|
|
@ -1 +1 @@
|
||||||
../../../../node_modules/cross-env/dist/bin/cross-env.js
|
../cross-env/dist/bin/cross-env.js
|
|
@ -1 +1 @@
|
||||||
../../../../node_modules/cross-env/dist/bin/cross-env-shell.js
|
../cross-env/dist/bin/cross-env-shell.js
|
|
@ -1 +1 @@
|
||||||
../../../../node_modules/jest/bin/jest.js
|
../jest/bin/jest.js
|
|
@ -1 +1 @@
|
||||||
../../../../node_modules/rimraf/bin.js
|
../rimraf/bin.js
|
|
@ -1 +1 @@
|
||||||
../../../../../../../node_modules/@babel/parser/bin/babel-parser.js
|
../@babel/parser/bin/babel-parser.js
|
|
@ -1,21 +0,0 @@
|
||||||
MIT License
|
|
||||||
|
|
||||||
Copyright (c) Facebook, Inc. and its affiliates.
|
|
||||||
|
|
||||||
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, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
|
@ -4,9 +4,10 @@
|
||||||
* This source code is licensed under the MIT license found in the
|
* This source code is licensed under the MIT license found in the
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
import type { Config } from '@jest/types';
|
import { Config } from '@jest/types';
|
||||||
import type { Options, TransformResult } from './types';
|
import { Options, TransformResult } from './types';
|
||||||
export default class ScriptTransformer {
|
export default class ScriptTransformer {
|
||||||
|
static EVAL_RESULT_VARIABLE: 'Object.<anonymous>';
|
||||||
private _cache;
|
private _cache;
|
||||||
private _config;
|
private _config;
|
||||||
private _transformCache;
|
private _transformCache;
|
||||||
|
@ -19,7 +20,11 @@ export default class ScriptTransformer {
|
||||||
private _instrumentFile;
|
private _instrumentFile;
|
||||||
private _getRealPath;
|
private _getRealPath;
|
||||||
preloadTransformer(filepath: Config.Path): void;
|
preloadTransformer(filepath: Config.Path): void;
|
||||||
transformSource(filepath: Config.Path, content: string, instrument: boolean, supportsDynamicImport?: boolean, supportsStaticESM?: boolean): TransformResult;
|
transformSource(filepath: Config.Path, content: string, instrument: boolean): {
|
||||||
|
code: string;
|
||||||
|
mapCoverage: boolean;
|
||||||
|
sourceMapPath: string | null;
|
||||||
|
};
|
||||||
private _transformAndBuildScript;
|
private _transformAndBuildScript;
|
||||||
transform(filename: Config.Path, options: Options, fileSource?: string): TransformResult;
|
transform(filename: Config.Path, options: Options, fileSource?: string): TransformResult;
|
||||||
transformJson(filename: Config.Path, options: Options, fileSource: string): string;
|
transformJson(filename: Config.Path, options: Options, fileSource: string): string;
|
||||||
|
@ -31,5 +36,4 @@ export default class ScriptTransformer {
|
||||||
private _shouldTransform;
|
private _shouldTransform;
|
||||||
shouldTransform(filename: Config.Path): boolean;
|
shouldTransform(filename: Config.Path): boolean;
|
||||||
}
|
}
|
||||||
export declare function createTranspilingRequire(config: Config.ProjectConfig): <TModuleType = unknown>(resolverPath: string, applyInteropRequireDefault?: boolean) => TModuleType;
|
|
||||||
//# sourceMappingURL=ScriptTransformer.d.ts.map
|
//# sourceMappingURL=ScriptTransformer.d.ts.map
|
|
@ -1 +1 @@
|
||||||
{"version":3,"file":"ScriptTransformer.d.ts","sourceRoot":"","sources":["../src/ScriptTransformer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AAaxC,OAAO,KAAK,EACV,OAAO,EACP,eAAe,EAGhB,MAAM,SAAS,CAAC;AAiCjB,MAAM,CAAC,OAAO,OAAO,iBAAiB;IACpC,OAAO,CAAC,MAAM,CAAe;IAC7B,OAAO,CAAC,OAAO,CAAuB;IACtC,OAAO,CAAC,eAAe,CAAgC;IACvD,OAAO,CAAC,qBAAqB,CAA4B;gBAE7C,MAAM,EAAE,MAAM,CAAC,aAAa;IAsBxC,OAAO,CAAC,YAAY;IAkCpB,OAAO,CAAC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,EAAE,UAAU,KAAK,OAAO,CAAC,IAAI,CAAC,GAC/C,OAAO,CAAC,UAAU,CAAC;IAsDtB;;OAEG;IAEH,OAAO,CAAC,gBAAgB;IAIxB,eAAe,CAAC,QAAQ,EAAE,MAAM,CAAC,IAAI,GAAG,OAAO;CAQhD"}
|
|
@ -3,23 +3,32 @@
|
||||||
Object.defineProperty(exports, '__esModule', {
|
Object.defineProperty(exports, '__esModule', {
|
||||||
value: true
|
value: true
|
||||||
});
|
});
|
||||||
exports.createTranspilingRequire = createTranspilingRequire;
|
|
||||||
exports.default = void 0;
|
exports.default = void 0;
|
||||||
|
|
||||||
function _crypto() {
|
function _crypto() {
|
||||||
const data = require('crypto');
|
const data = _interopRequireDefault(require('crypto'));
|
||||||
|
|
||||||
_crypto = function () {
|
_crypto = function _crypto() {
|
||||||
return data;
|
return data;
|
||||||
};
|
};
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
function path() {
|
function _path() {
|
||||||
const data = _interopRequireWildcard(require('path'));
|
const data = _interopRequireDefault(require('path'));
|
||||||
|
|
||||||
path = function () {
|
_path = function _path() {
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _vm() {
|
||||||
|
const data = _interopRequireDefault(require('vm'));
|
||||||
|
|
||||||
|
_vm = function _vm() {
|
||||||
return data;
|
return data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -29,17 +38,17 @@ function path() {
|
||||||
function _jestUtil() {
|
function _jestUtil() {
|
||||||
const data = require('jest-util');
|
const data = require('jest-util');
|
||||||
|
|
||||||
_jestUtil = function () {
|
_jestUtil = function _jestUtil() {
|
||||||
return data;
|
return data;
|
||||||
};
|
};
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
function fs() {
|
function _gracefulFs() {
|
||||||
const data = _interopRequireWildcard(require('graceful-fs'));
|
const data = _interopRequireDefault(require('graceful-fs'));
|
||||||
|
|
||||||
fs = function () {
|
_gracefulFs = function _gracefulFs() {
|
||||||
return data;
|
return data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -49,7 +58,7 @@ function fs() {
|
||||||
function _core() {
|
function _core() {
|
||||||
const data = require('@babel/core');
|
const data = require('@babel/core');
|
||||||
|
|
||||||
_core = function () {
|
_core = function _core() {
|
||||||
return data;
|
return data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -59,7 +68,7 @@ function _core() {
|
||||||
function _babelPluginIstanbul() {
|
function _babelPluginIstanbul() {
|
||||||
const data = _interopRequireDefault(require('babel-plugin-istanbul'));
|
const data = _interopRequireDefault(require('babel-plugin-istanbul'));
|
||||||
|
|
||||||
_babelPluginIstanbul = function () {
|
_babelPluginIstanbul = function _babelPluginIstanbul() {
|
||||||
return data;
|
return data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -67,9 +76,9 @@ function _babelPluginIstanbul() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function _convertSourceMap() {
|
function _convertSourceMap() {
|
||||||
const data = require('convert-source-map');
|
const data = _interopRequireDefault(require('convert-source-map'));
|
||||||
|
|
||||||
_convertSourceMap = function () {
|
_convertSourceMap = function _convertSourceMap() {
|
||||||
return data;
|
return data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -79,7 +88,7 @@ function _convertSourceMap() {
|
||||||
function _jestHasteMap() {
|
function _jestHasteMap() {
|
||||||
const data = _interopRequireDefault(require('jest-haste-map'));
|
const data = _interopRequireDefault(require('jest-haste-map'));
|
||||||
|
|
||||||
_jestHasteMap = function () {
|
_jestHasteMap = function _jestHasteMap() {
|
||||||
return data;
|
return data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -89,7 +98,7 @@ function _jestHasteMap() {
|
||||||
function _fastJsonStableStringify() {
|
function _fastJsonStableStringify() {
|
||||||
const data = _interopRequireDefault(require('fast-json-stable-stringify'));
|
const data = _interopRequireDefault(require('fast-json-stable-stringify'));
|
||||||
|
|
||||||
_fastJsonStableStringify = function () {
|
_fastJsonStableStringify = function _fastJsonStableStringify() {
|
||||||
return data;
|
return data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -99,7 +108,7 @@ function _fastJsonStableStringify() {
|
||||||
function _slash() {
|
function _slash() {
|
||||||
const data = _interopRequireDefault(require('slash'));
|
const data = _interopRequireDefault(require('slash'));
|
||||||
|
|
||||||
_slash = function () {
|
_slash = function _slash() {
|
||||||
return data;
|
return data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -107,9 +116,9 @@ function _slash() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function _writeFileAtomic() {
|
function _writeFileAtomic() {
|
||||||
const data = require('write-file-atomic');
|
const data = _interopRequireDefault(require('write-file-atomic'));
|
||||||
|
|
||||||
_writeFileAtomic = function () {
|
_writeFileAtomic = function _writeFileAtomic() {
|
||||||
return data;
|
return data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -119,7 +128,7 @@ function _writeFileAtomic() {
|
||||||
function _realpathNative() {
|
function _realpathNative() {
|
||||||
const data = require('realpath-native');
|
const data = require('realpath-native');
|
||||||
|
|
||||||
_realpathNative = function () {
|
_realpathNative = function _realpathNative() {
|
||||||
return data;
|
return data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -129,7 +138,7 @@ function _realpathNative() {
|
||||||
function _pirates() {
|
function _pirates() {
|
||||||
const data = require('pirates');
|
const data = require('pirates');
|
||||||
|
|
||||||
_pirates = function () {
|
_pirates = function _pirates() {
|
||||||
return data;
|
return data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -146,48 +155,6 @@ function _interopRequireDefault(obj) {
|
||||||
return obj && obj.__esModule ? obj : {default: obj};
|
return obj && obj.__esModule ? obj : {default: obj};
|
||||||
}
|
}
|
||||||
|
|
||||||
function _getRequireWildcardCache() {
|
|
||||||
if (typeof WeakMap !== 'function') return null;
|
|
||||||
var cache = new WeakMap();
|
|
||||||
_getRequireWildcardCache = function () {
|
|
||||||
return cache;
|
|
||||||
};
|
|
||||||
return cache;
|
|
||||||
}
|
|
||||||
|
|
||||||
function _interopRequireWildcard(obj) {
|
|
||||||
if (obj && obj.__esModule) {
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) {
|
|
||||||
return {default: obj};
|
|
||||||
}
|
|
||||||
var cache = _getRequireWildcardCache();
|
|
||||||
if (cache && cache.has(obj)) {
|
|
||||||
return cache.get(obj);
|
|
||||||
}
|
|
||||||
var newObj = {};
|
|
||||||
var hasPropertyDescriptor =
|
|
||||||
Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
||||||
for (var key in obj) {
|
|
||||||
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
||||||
var desc = hasPropertyDescriptor
|
|
||||||
? Object.getOwnPropertyDescriptor(obj, key)
|
|
||||||
: null;
|
|
||||||
if (desc && (desc.get || desc.set)) {
|
|
||||||
Object.defineProperty(newObj, key, desc);
|
|
||||||
} else {
|
|
||||||
newObj[key] = obj[key];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
newObj.default = obj;
|
|
||||||
if (cache) {
|
|
||||||
cache.set(obj, newObj);
|
|
||||||
}
|
|
||||||
return newObj;
|
|
||||||
}
|
|
||||||
|
|
||||||
function _defineProperty(obj, key, value) {
|
function _defineProperty(obj, key, value) {
|
||||||
if (key in obj) {
|
if (key in obj) {
|
||||||
Object.defineProperty(obj, key, {
|
Object.defineProperty(obj, key, {
|
||||||
|
@ -202,21 +169,61 @@ function _defineProperty(obj, key, value) {
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
||||||
|
try {
|
||||||
|
var info = gen[key](arg);
|
||||||
|
var value = info.value;
|
||||||
|
} catch (error) {
|
||||||
|
reject(error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (info.done) {
|
||||||
|
resolve(value);
|
||||||
|
} else {
|
||||||
|
Promise.resolve(value).then(_next, _throw);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function _asyncToGenerator(fn) {
|
||||||
|
return function() {
|
||||||
|
var self = this,
|
||||||
|
args = arguments;
|
||||||
|
return new Promise(function(resolve, reject) {
|
||||||
|
var gen = fn.apply(self, args);
|
||||||
|
function _next(value) {
|
||||||
|
asyncGeneratorStep(gen, resolve, reject, _next, _throw, 'next', value);
|
||||||
|
}
|
||||||
|
function _throw(err) {
|
||||||
|
asyncGeneratorStep(gen, resolve, reject, _next, _throw, 'throw', err);
|
||||||
|
}
|
||||||
|
_next(undefined);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
// Use `require` to avoid TS rootDir
|
// Use `require` to avoid TS rootDir
|
||||||
const {version: VERSION} = require('../package.json'); // This data structure is used to avoid recalculating some data every time that
|
const _require = require('../package.json'),
|
||||||
|
VERSION = _require.version; // This data structure is used to avoid recalculating some data every time that
|
||||||
// we need to transform a file. Since ScriptTransformer is instantiated for each
|
// we need to transform a file. Since ScriptTransformer is instantiated for each
|
||||||
// file we need to keep this object in the local scope of this module.
|
// file we need to keep this object in the local scope of this module.
|
||||||
|
|
||||||
const projectCaches = new Map(); // To reset the cache for specific changesets (rather than package version).
|
const projectCaches = new WeakMap(); // To reset the cache for specific changesets (rather than package version).
|
||||||
|
|
||||||
const CACHE_VERSION = '1';
|
const CACHE_VERSION = '1';
|
||||||
|
|
||||||
async function waitForPromiseWithCleanup(promise, cleanup) {
|
function waitForPromiseWithCleanup(_x, _x2) {
|
||||||
try {
|
return _waitForPromiseWithCleanup.apply(this, arguments);
|
||||||
await promise;
|
}
|
||||||
} finally {
|
|
||||||
cleanup();
|
function _waitForPromiseWithCleanup() {
|
||||||
}
|
_waitForPromiseWithCleanup = _asyncToGenerator(function*(promise, cleanup) {
|
||||||
|
try {
|
||||||
|
yield promise;
|
||||||
|
} finally {
|
||||||
|
cleanup();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return _waitForPromiseWithCleanup.apply(this, arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
class ScriptTransformer {
|
class ScriptTransformer {
|
||||||
|
@ -232,48 +239,41 @@ class ScriptTransformer {
|
||||||
this._config = config;
|
this._config = config;
|
||||||
this._transformCache = new Map();
|
this._transformCache = new Map();
|
||||||
this._transformConfigCache = new Map();
|
this._transformConfigCache = new Map();
|
||||||
const configString = (0, _fastJsonStableStringify().default)(this._config);
|
let projectCache = projectCaches.get(config);
|
||||||
let projectCache = projectCaches.get(configString);
|
|
||||||
|
|
||||||
if (!projectCache) {
|
if (!projectCache) {
|
||||||
projectCache = {
|
projectCache = {
|
||||||
configString,
|
configString: (0, _fastJsonStableStringify().default)(this._config),
|
||||||
ignorePatternsRegExp: calcIgnorePatternRegExp(this._config),
|
ignorePatternsRegExp: calcIgnorePatternRegExp(this._config),
|
||||||
transformRegExp: calcTransformRegExp(this._config),
|
transformRegExp: calcTransformRegExp(this._config),
|
||||||
transformedFiles: new Map()
|
transformedFiles: new Map()
|
||||||
};
|
};
|
||||||
projectCaches.set(configString, projectCache);
|
projectCaches.set(config, projectCache);
|
||||||
}
|
}
|
||||||
|
|
||||||
this._cache = projectCache;
|
this._cache = projectCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
_getCacheKey(
|
_getCacheKey(fileData, filename, instrument) {
|
||||||
fileData,
|
|
||||||
filename,
|
|
||||||
instrument,
|
|
||||||
supportsDynamicImport,
|
|
||||||
supportsStaticESM
|
|
||||||
) {
|
|
||||||
const configString = this._cache.configString;
|
const configString = this._cache.configString;
|
||||||
|
|
||||||
const transformer = this._getTransformer(filename);
|
const transformer = this._getTransformer(filename);
|
||||||
|
|
||||||
if (transformer && typeof transformer.getCacheKey === 'function') {
|
if (transformer && typeof transformer.getCacheKey === 'function') {
|
||||||
return (0, _crypto().createHash)('md5')
|
return _crypto()
|
||||||
|
.default.createHash('md5')
|
||||||
.update(
|
.update(
|
||||||
transformer.getCacheKey(fileData, filename, configString, {
|
transformer.getCacheKey(fileData, filename, configString, {
|
||||||
config: this._config,
|
config: this._config,
|
||||||
instrument,
|
instrument,
|
||||||
rootDir: this._config.rootDir,
|
rootDir: this._config.rootDir
|
||||||
supportsDynamicImport,
|
|
||||||
supportsStaticESM
|
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
.update(CACHE_VERSION)
|
.update(CACHE_VERSION)
|
||||||
.digest('hex');
|
.digest('hex');
|
||||||
} else {
|
} else {
|
||||||
return (0, _crypto().createHash)('md5')
|
return _crypto()
|
||||||
|
.default.createHash('md5')
|
||||||
.update(fileData)
|
.update(fileData)
|
||||||
.update(configString)
|
.update(configString)
|
||||||
.update(instrument ? 'instrument' : '')
|
.update(instrument ? 'instrument' : '')
|
||||||
|
@ -283,34 +283,27 @@ class ScriptTransformer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_getFileCachePath(
|
_getFileCachePath(filename, content, instrument) {
|
||||||
filename,
|
|
||||||
content,
|
|
||||||
instrument,
|
|
||||||
supportsDynamicImport,
|
|
||||||
supportsStaticESM
|
|
||||||
) {
|
|
||||||
const baseCacheDir = _jestHasteMap().default.getCacheFilePath(
|
const baseCacheDir = _jestHasteMap().default.getCacheFilePath(
|
||||||
this._config.cacheDirectory,
|
this._config.cacheDirectory,
|
||||||
'jest-transform-cache-' + this._config.name,
|
'jest-transform-cache-' + this._config.name,
|
||||||
VERSION
|
VERSION
|
||||||
);
|
);
|
||||||
|
|
||||||
const cacheKey = this._getCacheKey(
|
const cacheKey = this._getCacheKey(content, filename, instrument); // Create sub folders based on the cacheKey to avoid creating one
|
||||||
content,
|
|
||||||
filename,
|
|
||||||
instrument,
|
|
||||||
supportsDynamicImport,
|
|
||||||
supportsStaticESM
|
|
||||||
); // Create sub folders based on the cacheKey to avoid creating one
|
|
||||||
// directory with many files.
|
// directory with many files.
|
||||||
|
|
||||||
const cacheDir = path().join(baseCacheDir, cacheKey[0] + cacheKey[1]);
|
const cacheDir = _path().default.join(
|
||||||
const cacheFilenamePrefix = path()
|
baseCacheDir,
|
||||||
.basename(filename, path().extname(filename))
|
cacheKey[0] + cacheKey[1]
|
||||||
|
);
|
||||||
|
|
||||||
|
const cacheFilenamePrefix = _path()
|
||||||
|
.default.basename(filename, _path().default.extname(filename))
|
||||||
.replace(/\W/g, '');
|
.replace(/\W/g, '');
|
||||||
|
|
||||||
const cachePath = (0, _slash().default)(
|
const cachePath = (0, _slash().default)(
|
||||||
path().join(cacheDir, cacheFilenamePrefix + '_' + cacheKey)
|
_path().default.join(cacheDir, cacheFilenamePrefix + '_' + cacheKey)
|
||||||
);
|
);
|
||||||
(0, _jestUtil().createDirectory)(cacheDir);
|
(0, _jestUtil().createDirectory)(cacheDir);
|
||||||
return cachePath;
|
return cachePath;
|
||||||
|
@ -354,10 +347,6 @@ class ScriptTransformer {
|
||||||
|
|
||||||
transform = require(transformPath);
|
transform = require(transformPath);
|
||||||
|
|
||||||
if (!transform) {
|
|
||||||
throw new TypeError('Jest: a transform must export something.');
|
|
||||||
}
|
|
||||||
|
|
||||||
const transformerConfig = this._transformConfigCache.get(transformPath);
|
const transformerConfig = this._transformConfigCache.get(transformPath);
|
||||||
|
|
||||||
if (typeof transform.createTransformer === 'function') {
|
if (typeof transform.createTransformer === 'function') {
|
||||||
|
@ -376,14 +365,13 @@ class ScriptTransformer {
|
||||||
return transform;
|
return transform;
|
||||||
}
|
}
|
||||||
|
|
||||||
_instrumentFile(filename, content, supportsDynamicImport, supportsStaticESM) {
|
_instrumentFile(filename, content) {
|
||||||
const result = (0, _core().transformSync)(content, {
|
const result = (0, _core().transformSync)(content, {
|
||||||
auxiliaryCommentBefore: ' istanbul ignore next ',
|
auxiliaryCommentBefore: ' istanbul ignore next ',
|
||||||
babelrc: false,
|
babelrc: false,
|
||||||
caller: {
|
caller: {
|
||||||
name: '@jest/transform',
|
name: '@jest/transform',
|
||||||
supportsDynamicImport,
|
supportsStaticESM: false
|
||||||
supportsStaticESM
|
|
||||||
},
|
},
|
||||||
configFile: false,
|
configFile: false,
|
||||||
filename,
|
filename,
|
||||||
|
@ -395,7 +383,6 @@ class ScriptTransformer {
|
||||||
// files outside `cwd` will not be instrumented
|
// files outside `cwd` will not be instrumented
|
||||||
cwd: this._config.rootDir,
|
cwd: this._config.rootDir,
|
||||||
exclude: [],
|
exclude: [],
|
||||||
extension: false,
|
|
||||||
useInlineSourceMaps: false
|
useInlineSourceMaps: false
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -403,7 +390,7 @@ class ScriptTransformer {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
const {code} = result;
|
const code = result.code;
|
||||||
|
|
||||||
if (code) {
|
if (code) {
|
||||||
return code;
|
return code;
|
||||||
|
@ -424,26 +411,14 @@ class ScriptTransformer {
|
||||||
|
|
||||||
preloadTransformer(filepath) {
|
preloadTransformer(filepath) {
|
||||||
this._getTransformer(filepath);
|
this._getTransformer(filepath);
|
||||||
} // TODO: replace third argument with TransformOptions in Jest 26
|
}
|
||||||
|
|
||||||
transformSource(
|
transformSource(filepath, content, instrument) {
|
||||||
filepath,
|
|
||||||
content,
|
|
||||||
instrument,
|
|
||||||
supportsDynamicImport = false,
|
|
||||||
supportsStaticESM = false
|
|
||||||
) {
|
|
||||||
const filename = this._getRealPath(filepath);
|
const filename = this._getRealPath(filepath);
|
||||||
|
|
||||||
const transform = this._getTransformer(filename);
|
const transform = this._getTransformer(filename);
|
||||||
|
|
||||||
const cacheFilePath = this._getFileCachePath(
|
const cacheFilePath = this._getFileCachePath(filename, content, instrument);
|
||||||
filename,
|
|
||||||
content,
|
|
||||||
instrument,
|
|
||||||
supportsDynamicImport,
|
|
||||||
supportsStaticESM
|
|
||||||
);
|
|
||||||
|
|
||||||
let sourceMapPath = cacheFilePath + '.map'; // Ignore cache if `config.cache` is set (--no-cache)
|
let sourceMapPath = cacheFilePath + '.map'; // Ignore cache if `config.cache` is set (--no-cache)
|
||||||
|
|
||||||
|
@ -465,7 +440,6 @@ class ScriptTransformer {
|
||||||
return {
|
return {
|
||||||
code,
|
code,
|
||||||
mapCoverage,
|
mapCoverage,
|
||||||
originalCode: content,
|
|
||||||
sourceMapPath
|
sourceMapPath
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -477,9 +451,7 @@ class ScriptTransformer {
|
||||||
|
|
||||||
if (transform && shouldCallTransform) {
|
if (transform && shouldCallTransform) {
|
||||||
const processed = transform.process(content, filename, this._config, {
|
const processed = transform.process(content, filename, this._config, {
|
||||||
instrument,
|
instrument
|
||||||
supportsDynamicImport,
|
|
||||||
supportsStaticESM
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (typeof processed === 'string') {
|
if (typeof processed === 'string') {
|
||||||
|
@ -495,34 +467,19 @@ class ScriptTransformer {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!transformed.map) {
|
if (!transformed.map) {
|
||||||
try {
|
//Could be a potential freeze here.
|
||||||
//Could be a potential freeze here.
|
//See: https://github.com/facebook/jest/pull/5177#discussion_r158883570
|
||||||
//See: https://github.com/facebook/jest/pull/5177#discussion_r158883570
|
const inlineSourceMap = _convertSourceMap().default.fromSource(
|
||||||
const inlineSourceMap = (0, _convertSourceMap().fromSource)(
|
transformed.code
|
||||||
transformed.code
|
);
|
||||||
);
|
|
||||||
|
|
||||||
if (inlineSourceMap) {
|
if (inlineSourceMap) {
|
||||||
transformed.map = inlineSourceMap.toJSON();
|
transformed.map = inlineSourceMap.toJSON();
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
const transformPath = this._getTransformPath(filename);
|
|
||||||
|
|
||||||
console.warn(
|
|
||||||
`jest-transform: The source map produced for the file ${filename} ` +
|
|
||||||
`by ${transformPath} was invalid. Proceeding without source ` +
|
|
||||||
'mapping for that file.'
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!transformWillInstrument && instrument) {
|
if (!transformWillInstrument && instrument) {
|
||||||
code = this._instrumentFile(
|
code = this._instrumentFile(filename, transformed.code);
|
||||||
filename,
|
|
||||||
transformed.code,
|
|
||||||
supportsDynamicImport,
|
|
||||||
supportsStaticESM
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
code = transformed.code;
|
code = transformed.code;
|
||||||
}
|
}
|
||||||
|
@ -541,22 +498,17 @@ class ScriptTransformer {
|
||||||
return {
|
return {
|
||||||
code,
|
code,
|
||||||
mapCoverage,
|
mapCoverage,
|
||||||
originalCode: content,
|
|
||||||
sourceMapPath
|
sourceMapPath
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
_transformAndBuildScript(filename, options, instrument, fileSource) {
|
_transformAndBuildScript(filename, options, instrument, fileSource) {
|
||||||
const {
|
const isInternalModule = !!(options && options.isInternalModule);
|
||||||
isCoreModule,
|
const isCoreModule = !!(options && options.isCoreModule);
|
||||||
isInternalModule,
|
|
||||||
supportsDynamicImport,
|
|
||||||
supportsStaticESM
|
|
||||||
} = options;
|
|
||||||
const content = stripShebang(
|
const content = stripShebang(
|
||||||
fileSource || fs().readFileSync(filename, 'utf8')
|
fileSource || _gracefulFs().default.readFileSync(filename, 'utf8')
|
||||||
);
|
);
|
||||||
let code = content;
|
let wrappedCode;
|
||||||
let sourceMapPath = null;
|
let sourceMapPath = null;
|
||||||
let mapCoverage = false;
|
let mapCoverage = false;
|
||||||
const willTransform =
|
const willTransform =
|
||||||
|
@ -565,27 +517,43 @@ class ScriptTransformer {
|
||||||
(this.shouldTransform(filename) || instrument);
|
(this.shouldTransform(filename) || instrument);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
const extraGlobals = (options && options.extraGlobals) || [];
|
||||||
|
|
||||||
if (willTransform) {
|
if (willTransform) {
|
||||||
const transformedSource = this.transformSource(
|
const transformedSource = this.transformSource(
|
||||||
filename,
|
filename,
|
||||||
content,
|
content,
|
||||||
instrument,
|
instrument
|
||||||
supportsDynamicImport,
|
|
||||||
supportsStaticESM
|
|
||||||
);
|
);
|
||||||
code = transformedSource.code;
|
wrappedCode = wrap(transformedSource.code, ...extraGlobals);
|
||||||
sourceMapPath = transformedSource.sourceMapPath;
|
sourceMapPath = transformedSource.sourceMapPath;
|
||||||
mapCoverage = transformedSource.mapCoverage;
|
mapCoverage = transformedSource.mapCoverage;
|
||||||
|
} else {
|
||||||
|
wrappedCode = wrap(content, ...extraGlobals);
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
code,
|
|
||||||
mapCoverage,
|
mapCoverage,
|
||||||
originalCode: content,
|
script: new (_vm()).default.Script(wrappedCode, {
|
||||||
|
displayErrors: true,
|
||||||
|
filename: isCoreModule ? 'jest-nodejs-core-' + filename : filename
|
||||||
|
}),
|
||||||
sourceMapPath
|
sourceMapPath
|
||||||
};
|
};
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
throw (0, _enhanceUnexpectedTokenMessage.default)(e);
|
if (e.codeFrame) {
|
||||||
|
e.stack = e.message + '\n' + e.codeFrame;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
e instanceof SyntaxError &&
|
||||||
|
e.message.includes('Unexpected token') &&
|
||||||
|
!e.message.includes(' expected')
|
||||||
|
) {
|
||||||
|
throw (0, _enhanceUnexpectedTokenMessage.default)(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -594,9 +562,11 @@ class ScriptTransformer {
|
||||||
let instrument = false;
|
let instrument = false;
|
||||||
|
|
||||||
if (!options.isCoreModule) {
|
if (!options.isCoreModule) {
|
||||||
instrument =
|
instrument = (0, _shouldInstrument.default)(
|
||||||
options.coverageProvider === 'babel' &&
|
filename,
|
||||||
(0, _shouldInstrument.default)(filename, options, this._config);
|
options,
|
||||||
|
this._config
|
||||||
|
);
|
||||||
scriptCacheKey = getScriptCacheKey(filename, instrument);
|
scriptCacheKey = getScriptCacheKey(filename, instrument);
|
||||||
|
|
||||||
const result = this._cache.transformedFiles.get(scriptCacheKey);
|
const result = this._cache.transformedFiles.get(scriptCacheKey);
|
||||||
|
@ -621,23 +591,19 @@ class ScriptTransformer {
|
||||||
}
|
}
|
||||||
|
|
||||||
transformJson(filename, options, fileSource) {
|
transformJson(filename, options, fileSource) {
|
||||||
const {
|
const isInternalModule = options.isInternalModule;
|
||||||
isCoreModule,
|
const isCoreModule = options.isCoreModule;
|
||||||
isInternalModule,
|
|
||||||
supportsDynamicImport,
|
|
||||||
supportsStaticESM
|
|
||||||
} = options;
|
|
||||||
const willTransform =
|
const willTransform =
|
||||||
!isInternalModule && !isCoreModule && this.shouldTransform(filename);
|
!isInternalModule && !isCoreModule && this.shouldTransform(filename);
|
||||||
|
|
||||||
if (willTransform) {
|
if (willTransform) {
|
||||||
const {code: transformedJsonSource} = this.transformSource(
|
const _this$transformSource = this.transformSource(
|
||||||
filename,
|
filename,
|
||||||
fileSource,
|
fileSource,
|
||||||
false,
|
false
|
||||||
supportsDynamicImport,
|
),
|
||||||
supportsStaticESM
|
transformedJsonSource = _this$transformSource.code;
|
||||||
);
|
|
||||||
return transformedJsonSource;
|
return transformedJsonSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -653,17 +619,13 @@ class ScriptTransformer {
|
||||||
(code, filename) => {
|
(code, filename) => {
|
||||||
try {
|
try {
|
||||||
transforming = true;
|
transforming = true;
|
||||||
return (
|
return this.transformSource(filename, code, false).code || code;
|
||||||
// we might wanna do `supportsDynamicImport` at some point
|
|
||||||
this.transformSource(filename, code, false, false, false).code ||
|
|
||||||
code
|
|
||||||
);
|
|
||||||
} finally {
|
} finally {
|
||||||
transforming = false;
|
transforming = false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
exts: this._config.moduleFileExtensions.map(ext => `.${ext}`),
|
exts: [_path().default.extname(moduleName)],
|
||||||
ignoreNodeModules: false,
|
ignoreNodeModules: false,
|
||||||
matcher: filename => {
|
matcher: filename => {
|
||||||
if (transforming) {
|
if (transforming) {
|
||||||
|
@ -713,28 +675,15 @@ class ScriptTransformer {
|
||||||
!!this._config.transform && !!this._config.transform.length && !isIgnored
|
!!this._config.transform && !!this._config.transform.length && !isIgnored
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} // TODO: do we need to define the generics twice?
|
}
|
||||||
|
|
||||||
exports.default = ScriptTransformer;
|
exports.default = ScriptTransformer;
|
||||||
|
|
||||||
function createTranspilingRequire(config) {
|
_defineProperty(ScriptTransformer, 'EVAL_RESULT_VARIABLE', void 0);
|
||||||
const transformer = new ScriptTransformer(config);
|
|
||||||
return function requireAndTranspileModule(
|
|
||||||
resolverPath,
|
|
||||||
applyInteropRequireDefault = false
|
|
||||||
) {
|
|
||||||
const transpiledModule = transformer.requireAndTranspileModule(
|
|
||||||
resolverPath
|
|
||||||
);
|
|
||||||
return applyInteropRequireDefault
|
|
||||||
? (0, _jestUtil().interopRequireDefault)(transpiledModule).default
|
|
||||||
: transpiledModule;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
const removeFile = path => {
|
const removeFile = path => {
|
||||||
try {
|
try {
|
||||||
fs().unlinkSync(path);
|
_gracefulFs().default.unlinkSync(path);
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -756,7 +705,11 @@ const stripShebang = content => {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function writeCodeCacheFile(cachePath, code) {
|
function writeCodeCacheFile(cachePath, code) {
|
||||||
const checksum = (0, _crypto().createHash)('md5').update(code).digest('hex');
|
const checksum = _crypto()
|
||||||
|
.default.createHash('md5')
|
||||||
|
.update(code)
|
||||||
|
.digest('hex');
|
||||||
|
|
||||||
writeCacheFile(cachePath, checksum + '\n' + code);
|
writeCacheFile(cachePath, checksum + '\n' + code);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -774,7 +727,11 @@ function readCodeCacheFile(cachePath) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const code = content.substr(33);
|
const code = content.substr(33);
|
||||||
const checksum = (0, _crypto().createHash)('md5').update(code).digest('hex');
|
|
||||||
|
const checksum = _crypto()
|
||||||
|
.default.createHash('md5')
|
||||||
|
.update(code)
|
||||||
|
.digest('hex');
|
||||||
|
|
||||||
if (checksum === content.substr(0, 32)) {
|
if (checksum === content.substr(0, 32)) {
|
||||||
return code;
|
return code;
|
||||||
|
@ -791,9 +748,8 @@ function readCodeCacheFile(cachePath) {
|
||||||
|
|
||||||
const writeCacheFile = (cachePath, fileData) => {
|
const writeCacheFile = (cachePath, fileData) => {
|
||||||
try {
|
try {
|
||||||
(0, _writeFileAtomic().sync)(cachePath, fileData, {
|
_writeFileAtomic().default.sync(cachePath, fileData, {
|
||||||
encoding: 'utf8',
|
encoding: 'utf8'
|
||||||
fsync: false
|
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (cacheWriteErrorSafeToIgnore(e, cachePath)) {
|
if (cacheWriteErrorSafeToIgnore(e, cachePath)) {
|
||||||
|
@ -819,17 +775,17 @@ const writeCacheFile = (cachePath, fileData) => {
|
||||||
const cacheWriteErrorSafeToIgnore = (e, cachePath) =>
|
const cacheWriteErrorSafeToIgnore = (e, cachePath) =>
|
||||||
process.platform === 'win32' &&
|
process.platform === 'win32' &&
|
||||||
e.code === 'EPERM' &&
|
e.code === 'EPERM' &&
|
||||||
fs().existsSync(cachePath);
|
_gracefulFs().default.existsSync(cachePath);
|
||||||
|
|
||||||
const readCacheFile = cachePath => {
|
const readCacheFile = cachePath => {
|
||||||
if (!fs().existsSync(cachePath)) {
|
if (!_gracefulFs().default.existsSync(cachePath)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
let fileData;
|
let fileData;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
fileData = fs().readFileSync(cachePath, 'utf8');
|
fileData = _gracefulFs().default.readFileSync(cachePath, 'utf8');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
e.message =
|
e.message =
|
||||||
'jest: failed to read cache file: ' +
|
'jest: failed to read cache file: ' +
|
||||||
|
@ -850,7 +806,8 @@ const readCacheFile = cachePath => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const getScriptCacheKey = (filename, instrument) => {
|
const getScriptCacheKey = (filename, instrument) => {
|
||||||
const mtime = fs().statSync(filename).mtime;
|
const mtime = _gracefulFs().default.statSync(filename).mtime;
|
||||||
|
|
||||||
return filename + '_' + mtime.getTime() + (instrument ? '_instrumented' : '');
|
return filename + '_' + mtime.getTime() + (instrument ? '_instrumented' : '');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -882,3 +839,25 @@ const calcTransformRegExp = config => {
|
||||||
|
|
||||||
return transformRegexp;
|
return transformRegexp;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const wrap = (content, ...extras) => {
|
||||||
|
const globals = new Set([
|
||||||
|
'module',
|
||||||
|
'exports',
|
||||||
|
'require',
|
||||||
|
'__dirname',
|
||||||
|
'__filename',
|
||||||
|
'global',
|
||||||
|
'jest',
|
||||||
|
...extras
|
||||||
|
]);
|
||||||
|
return (
|
||||||
|
'({"' +
|
||||||
|
ScriptTransformer.EVAL_RESULT_VARIABLE +
|
||||||
|
`":function(${Array.from(globals).join(',')}){` +
|
||||||
|
content +
|
||||||
|
'\n}});'
|
||||||
|
);
|
||||||
|
}; // TODO: Can this be added to the static property?
|
||||||
|
|
||||||
|
ScriptTransformer.EVAL_RESULT_VARIABLE = 'Object.<anonymous>';
|
||||||
|
|
|
@ -4,10 +4,5 @@
|
||||||
* This source code is licensed under the MIT license found in the
|
* This source code is licensed under the MIT license found in the
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
interface ErrorWithCodeFrame extends Error {
|
export default function enhanceUnexpectedTokenMessage(e: Error): Error;
|
||||||
codeFrame?: string;
|
|
||||||
}
|
|
||||||
export default function handlePotentialSyntaxError(e: ErrorWithCodeFrame): ErrorWithCodeFrame;
|
|
||||||
export declare function enhanceUnexpectedTokenMessage(e: Error): Error;
|
|
||||||
export {};
|
|
||||||
//# sourceMappingURL=enhanceUnexpectedTokenMessage.d.ts.map
|
//# sourceMappingURL=enhanceUnexpectedTokenMessage.d.ts.map
|
|
@ -1 +1 @@
|
||||||
{"version":3,"file":"enhanceUnexpectedTokenMessage.d.ts","sourceRoot":"","sources":["../src/enhanceUnexpectedTokenMessage.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,UAAU,kBAAmB,SAAQ,KAAK;IACxC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,CAAC,OAAO,UAAU,0BAA0B,CAChD,CAAC,EAAE,kBAAkB,GACpB,kBAAkB,CAgBpB;AAED,wBAAgB,6BAA6B,CAAC,CAAC,EAAE,KAAK,GAAG,KAAK,CA2B7D"}
|
{"version":3,"file":"enhanceUnexpectedTokenMessage.d.ts","sourceRoot":"","sources":["../src/enhanceUnexpectedTokenMessage.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,MAAM,CAAC,OAAO,UAAU,6BAA6B,CAAC,CAAC,EAAE,KAAK,SA2B7D"}
|
23
packages/common/node_modules/@jest/transform/build/enhanceUnexpectedTokenMessage.js
generated
vendored
23
packages/common/node_modules/@jest/transform/build/enhanceUnexpectedTokenMessage.js
generated
vendored
|
@ -3,13 +3,12 @@
|
||||||
Object.defineProperty(exports, '__esModule', {
|
Object.defineProperty(exports, '__esModule', {
|
||||||
value: true
|
value: true
|
||||||
});
|
});
|
||||||
exports.default = handlePotentialSyntaxError;
|
exports.default = enhanceUnexpectedTokenMessage;
|
||||||
exports.enhanceUnexpectedTokenMessage = enhanceUnexpectedTokenMessage;
|
|
||||||
|
|
||||||
function _chalk() {
|
function _chalk() {
|
||||||
const data = _interopRequireDefault(require('chalk'));
|
const data = _interopRequireDefault(require('chalk'));
|
||||||
|
|
||||||
_chalk = function () {
|
_chalk = function _chalk() {
|
||||||
return data;
|
return data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -28,24 +27,6 @@ function _interopRequireDefault(obj) {
|
||||||
*/
|
*/
|
||||||
const DOT = ' \u2022 ';
|
const DOT = ' \u2022 ';
|
||||||
|
|
||||||
function handlePotentialSyntaxError(e) {
|
|
||||||
if (e.codeFrame) {
|
|
||||||
e.stack = e.message + '\n' + e.codeFrame;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (
|
|
||||||
// `instanceof` might come from the wrong context
|
|
||||||
e.name === 'SyntaxError' &&
|
|
||||||
(e.message.includes('Unexpected token') ||
|
|
||||||
e.message.includes('Cannot use import')) &&
|
|
||||||
!e.message.includes(' expected')
|
|
||||||
) {
|
|
||||||
throw enhanceUnexpectedTokenMessage(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
return e;
|
|
||||||
}
|
|
||||||
|
|
||||||
function enhanceUnexpectedTokenMessage(e) {
|
function enhanceUnexpectedTokenMessage(e) {
|
||||||
e.stack =
|
e.stack =
|
||||||
`${_chalk().default.bold.red('Jest encountered an unexpected token')}
|
`${_chalk().default.bold.red('Jest encountered an unexpected token')}
|
||||||
|
|
|
@ -4,8 +4,7 @@
|
||||||
* This source code is licensed under the MIT license found in the
|
* This source code is licensed under the MIT license found in the
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
export { default as ScriptTransformer, createTranspilingRequire, } from './ScriptTransformer';
|
export { default as ScriptTransformer } from './ScriptTransformer';
|
||||||
export { default as shouldInstrument } from './shouldInstrument';
|
export { default as shouldInstrument } from './shouldInstrument';
|
||||||
export type { CacheKeyOptions, Transformer, ShouldInstrumentOptions, Options as TransformationOptions, TransformOptions, TransformResult, TransformedSource, } from './types';
|
export { Transformer, ShouldInstrumentOptions, Options as TransformationOptions, } from './types';
|
||||||
export { default as handlePotentialSyntaxError } from './enhanceUnexpectedTokenMessage';
|
|
||||||
//# sourceMappingURL=index.d.ts.map
|
//# sourceMappingURL=index.d.ts.map
|
|
@ -1 +1 @@
|
||||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,OAAO,IAAI,iBAAiB,EAC5B,wBAAwB,GACzB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAC,OAAO,IAAI,gBAAgB,EAAC,MAAM,oBAAoB,CAAC;AAC/D,YAAY,EACV,eAAe,EACf,WAAW,EACX,uBAAuB,EACvB,OAAO,IAAI,qBAAqB,EAChC,gBAAgB,EAChB,eAAe,EACf,iBAAiB,GAClB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAC,OAAO,IAAI,0BAA0B,EAAC,MAAM,iCAAiC,CAAC"}
|
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAC,OAAO,IAAI,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAC,OAAO,IAAI,gBAAgB,EAAC,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EACL,WAAW,EACX,uBAAuB,EACvB,OAAO,IAAI,qBAAqB,GACjC,MAAM,SAAS,CAAC"}
|
|
@ -5,81 +5,41 @@ Object.defineProperty(exports, '__esModule', {
|
||||||
});
|
});
|
||||||
Object.defineProperty(exports, 'ScriptTransformer', {
|
Object.defineProperty(exports, 'ScriptTransformer', {
|
||||||
enumerable: true,
|
enumerable: true,
|
||||||
get: function () {
|
get: function get() {
|
||||||
return _ScriptTransformer.default;
|
return _ScriptTransformer.default;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Object.defineProperty(exports, 'createTranspilingRequire', {
|
|
||||||
enumerable: true,
|
|
||||||
get: function () {
|
|
||||||
return _ScriptTransformer.createTranspilingRequire;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
Object.defineProperty(exports, 'shouldInstrument', {
|
Object.defineProperty(exports, 'shouldInstrument', {
|
||||||
enumerable: true,
|
enumerable: true,
|
||||||
get: function () {
|
get: function get() {
|
||||||
return _shouldInstrument.default;
|
return _shouldInstrument.default;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Object.defineProperty(exports, 'handlePotentialSyntaxError', {
|
Object.defineProperty(exports, 'Transformer', {
|
||||||
enumerable: true,
|
enumerable: true,
|
||||||
get: function () {
|
get: function get() {
|
||||||
return _enhanceUnexpectedTokenMessage.default;
|
return _types.Transformer;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, 'ShouldInstrumentOptions', {
|
||||||
|
enumerable: true,
|
||||||
|
get: function get() {
|
||||||
|
return _types.ShouldInstrumentOptions;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, 'TransformationOptions', {
|
||||||
|
enumerable: true,
|
||||||
|
get: function get() {
|
||||||
|
return _types.Options;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var _ScriptTransformer = _interopRequireWildcard(
|
var _ScriptTransformer = _interopRequireDefault(require('./ScriptTransformer'));
|
||||||
require('./ScriptTransformer')
|
|
||||||
);
|
|
||||||
|
|
||||||
var _shouldInstrument = _interopRequireDefault(require('./shouldInstrument'));
|
var _shouldInstrument = _interopRequireDefault(require('./shouldInstrument'));
|
||||||
|
|
||||||
var _enhanceUnexpectedTokenMessage = _interopRequireDefault(
|
var _types = require('./types');
|
||||||
require('./enhanceUnexpectedTokenMessage')
|
|
||||||
);
|
|
||||||
|
|
||||||
function _interopRequireDefault(obj) {
|
function _interopRequireDefault(obj) {
|
||||||
return obj && obj.__esModule ? obj : {default: obj};
|
return obj && obj.__esModule ? obj : {default: obj};
|
||||||
}
|
}
|
||||||
|
|
||||||
function _getRequireWildcardCache() {
|
|
||||||
if (typeof WeakMap !== 'function') return null;
|
|
||||||
var cache = new WeakMap();
|
|
||||||
_getRequireWildcardCache = function () {
|
|
||||||
return cache;
|
|
||||||
};
|
|
||||||
return cache;
|
|
||||||
}
|
|
||||||
|
|
||||||
function _interopRequireWildcard(obj) {
|
|
||||||
if (obj && obj.__esModule) {
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) {
|
|
||||||
return {default: obj};
|
|
||||||
}
|
|
||||||
var cache = _getRequireWildcardCache();
|
|
||||||
if (cache && cache.has(obj)) {
|
|
||||||
return cache.get(obj);
|
|
||||||
}
|
|
||||||
var newObj = {};
|
|
||||||
var hasPropertyDescriptor =
|
|
||||||
Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
||||||
for (var key in obj) {
|
|
||||||
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
||||||
var desc = hasPropertyDescriptor
|
|
||||||
? Object.getOwnPropertyDescriptor(obj, key)
|
|
||||||
: null;
|
|
||||||
if (desc && (desc.get || desc.set)) {
|
|
||||||
Object.defineProperty(newObj, key, desc);
|
|
||||||
} else {
|
|
||||||
newObj[key] = obj[key];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
newObj.default = obj;
|
|
||||||
if (cache) {
|
|
||||||
cache.set(obj, newObj);
|
|
||||||
}
|
|
||||||
return newObj;
|
|
||||||
}
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* This source code is licensed under the MIT license found in the
|
* This source code is licensed under the MIT license found in the
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
import type { Config } from '@jest/types';
|
import { Config } from '@jest/types';
|
||||||
import type { ShouldInstrumentOptions } from './types';
|
import { ShouldInstrumentOptions } from './types';
|
||||||
export default function shouldInstrument(filename: Config.Path, options: ShouldInstrumentOptions, config: Config.ProjectConfig): boolean;
|
export default function shouldInstrument(filename: Config.Path, options: ShouldInstrumentOptions, config: Config.ProjectConfig): boolean;
|
||||||
//# sourceMappingURL=shouldInstrument.d.ts.map
|
//# sourceMappingURL=shouldInstrument.d.ts.map
|
|
@ -1 +1 @@
|
||||||
{"version":3,"file":"shouldInstrument.d.ts","sourceRoot":"","sources":["../src/shouldInstrument.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AAIxC,OAAO,KAAK,EAAC,uBAAuB,EAAC,MAAM,SAAS,CAAC;AAMrD,MAAM,CAAC,OAAO,UAAU,gBAAgB,CACtC,QAAQ,EAAE,MAAM,CAAC,IAAI,EACrB,OAAO,EAAE,uBAAuB,EAChC,MAAM,EAAE,MAAM,CAAC,aAAa,GAC3B,OAAO,CA8ET"}
|
{"version":3,"file":"shouldInstrument.d.ts","sourceRoot":"","sources":["../src/shouldInstrument.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AAInC,OAAO,EAAC,uBAAuB,EAAC,MAAM,SAAS,CAAC;AAMhD,MAAM,CAAC,OAAO,UAAU,gBAAgB,CACtC,QAAQ,EAAE,MAAM,CAAC,IAAI,EACrB,OAAO,EAAE,uBAAuB,EAChC,MAAM,EAAE,MAAM,CAAC,aAAa,GAC3B,OAAO,CA4ET"}
|
|
@ -5,10 +5,10 @@ Object.defineProperty(exports, '__esModule', {
|
||||||
});
|
});
|
||||||
exports.default = shouldInstrument;
|
exports.default = shouldInstrument;
|
||||||
|
|
||||||
function path() {
|
function _path() {
|
||||||
const data = _interopRequireWildcard(require('path'));
|
const data = _interopRequireDefault(require('path'));
|
||||||
|
|
||||||
path = function () {
|
_path = function _path() {
|
||||||
return data;
|
return data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ function path() {
|
||||||
function _jestRegexUtil() {
|
function _jestRegexUtil() {
|
||||||
const data = require('jest-regex-util');
|
const data = require('jest-regex-util');
|
||||||
|
|
||||||
_jestRegexUtil = function () {
|
_jestRegexUtil = function _jestRegexUtil() {
|
||||||
return data;
|
return data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ function _jestRegexUtil() {
|
||||||
function _jestUtil() {
|
function _jestUtil() {
|
||||||
const data = require('jest-util');
|
const data = require('jest-util');
|
||||||
|
|
||||||
_jestUtil = function () {
|
_jestUtil = function _jestUtil() {
|
||||||
return data;
|
return data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ function _jestUtil() {
|
||||||
function _micromatch() {
|
function _micromatch() {
|
||||||
const data = _interopRequireDefault(require('micromatch'));
|
const data = _interopRequireDefault(require('micromatch'));
|
||||||
|
|
||||||
_micromatch = function () {
|
_micromatch = function _micromatch() {
|
||||||
return data;
|
return data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -49,48 +49,6 @@ function _interopRequireDefault(obj) {
|
||||||
return obj && obj.__esModule ? obj : {default: obj};
|
return obj && obj.__esModule ? obj : {default: obj};
|
||||||
}
|
}
|
||||||
|
|
||||||
function _getRequireWildcardCache() {
|
|
||||||
if (typeof WeakMap !== 'function') return null;
|
|
||||||
var cache = new WeakMap();
|
|
||||||
_getRequireWildcardCache = function () {
|
|
||||||
return cache;
|
|
||||||
};
|
|
||||||
return cache;
|
|
||||||
}
|
|
||||||
|
|
||||||
function _interopRequireWildcard(obj) {
|
|
||||||
if (obj && obj.__esModule) {
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) {
|
|
||||||
return {default: obj};
|
|
||||||
}
|
|
||||||
var cache = _getRequireWildcardCache();
|
|
||||||
if (cache && cache.has(obj)) {
|
|
||||||
return cache.get(obj);
|
|
||||||
}
|
|
||||||
var newObj = {};
|
|
||||||
var hasPropertyDescriptor =
|
|
||||||
Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
||||||
for (var key in obj) {
|
|
||||||
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
||||||
var desc = hasPropertyDescriptor
|
|
||||||
? Object.getOwnPropertyDescriptor(obj, key)
|
|
||||||
: null;
|
|
||||||
if (desc && (desc.get || desc.set)) {
|
|
||||||
Object.defineProperty(newObj, key, desc);
|
|
||||||
} else {
|
|
||||||
newObj[key] = obj[key];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
newObj.default = obj;
|
|
||||||
if (cache) {
|
|
||||||
cache.set(obj, newObj);
|
|
||||||
}
|
|
||||||
return newObj;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
||||||
*
|
*
|
||||||
|
@ -99,7 +57,7 @@ function _interopRequireWildcard(obj) {
|
||||||
*/
|
*/
|
||||||
const MOCKS_PATTERN = new RegExp(
|
const MOCKS_PATTERN = new RegExp(
|
||||||
(0, _jestRegexUtil().escapePathForRegex)(
|
(0, _jestRegexUtil().escapePathForRegex)(
|
||||||
path().sep + '__mocks__' + path().sep
|
_path().default.sep + '__mocks__' + _path().default.sep
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -123,10 +81,10 @@ function shouldInstrument(filename, options, config) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
(0, _micromatch().default)(
|
_micromatch().default.some(
|
||||||
[(0, _jestUtil().replacePathSepForGlob)(filename)],
|
(0, _jestUtil().replacePathSepForGlob)(filename),
|
||||||
config.testMatch
|
config.testMatch
|
||||||
).length
|
)
|
||||||
) {
|
) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -144,15 +102,13 @@ function shouldInstrument(filename, options, config) {
|
||||||
if (
|
if (
|
||||||
// still cover if `only` is specified
|
// still cover if `only` is specified
|
||||||
!options.collectCoverageOnlyFrom &&
|
!options.collectCoverageOnlyFrom &&
|
||||||
options.collectCoverageFrom.length &&
|
options.collectCoverageFrom &&
|
||||||
(0, _micromatch().default)(
|
!_micromatch().default.some(
|
||||||
[
|
(0, _jestUtil().replacePathSepForGlob)(
|
||||||
(0, _jestUtil().replacePathSepForGlob)(
|
_path().default.relative(config.rootDir, filename)
|
||||||
path().relative(config.rootDir, filename)
|
),
|
||||||
)
|
|
||||||
],
|
|
||||||
options.collectCoverageFrom
|
options.collectCoverageFrom
|
||||||
).length === 0
|
)
|
||||||
) {
|
) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
35
packages/common/node_modules/@jest/transform/build/ts3.4/ScriptTransformer.d.ts
generated
vendored
35
packages/common/node_modules/@jest/transform/build/ts3.4/ScriptTransformer.d.ts
generated
vendored
|
@ -1,35 +0,0 @@
|
||||||
/**
|
|
||||||
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* This source code is licensed under the MIT license found in the
|
|
||||||
* LICENSE file in the root directory of this source tree.
|
|
||||||
*/
|
|
||||||
import { Config } from '@jest/types';
|
|
||||||
import { Options, TransformResult } from './types';
|
|
||||||
export default class ScriptTransformer {
|
|
||||||
private _cache;
|
|
||||||
private _config;
|
|
||||||
private _transformCache;
|
|
||||||
private _transformConfigCache;
|
|
||||||
constructor(config: Config.ProjectConfig);
|
|
||||||
private _getCacheKey;
|
|
||||||
private _getFileCachePath;
|
|
||||||
private _getTransformPath;
|
|
||||||
private _getTransformer;
|
|
||||||
private _instrumentFile;
|
|
||||||
private _getRealPath;
|
|
||||||
preloadTransformer(filepath: Config.Path): void;
|
|
||||||
transformSource(filepath: Config.Path, content: string, instrument: boolean, supportsDynamicImport?: boolean, supportsStaticESM?: boolean): TransformResult;
|
|
||||||
private _transformAndBuildScript;
|
|
||||||
transform(filename: Config.Path, options: Options, fileSource?: string): TransformResult;
|
|
||||||
transformJson(filename: Config.Path, options: Options, fileSource: string): string;
|
|
||||||
requireAndTranspileModule<ModuleType = unknown>(moduleName: string, callback?: (module: ModuleType) => void): ModuleType;
|
|
||||||
requireAndTranspileModule<ModuleType = unknown>(moduleName: string, callback?: (module: ModuleType) => Promise<void>): Promise<ModuleType>;
|
|
||||||
/**
|
|
||||||
* @deprecated use `this.shouldTransform` instead
|
|
||||||
*/
|
|
||||||
private _shouldTransform;
|
|
||||||
shouldTransform(filename: Config.Path): boolean;
|
|
||||||
}
|
|
||||||
export declare function createTranspilingRequire(config: Config.ProjectConfig): <TModuleType = unknown>(resolverPath: string, applyInteropRequireDefault?: boolean) => TModuleType;
|
|
||||||
//# sourceMappingURL=ScriptTransformer.d.ts.map
|
|
|
@ -1,13 +0,0 @@
|
||||||
/**
|
|
||||||
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* This source code is licensed under the MIT license found in the
|
|
||||||
* LICENSE file in the root directory of this source tree.
|
|
||||||
*/
|
|
||||||
interface ErrorWithCodeFrame extends Error {
|
|
||||||
codeFrame?: string;
|
|
||||||
}
|
|
||||||
export default function handlePotentialSyntaxError(e: ErrorWithCodeFrame): ErrorWithCodeFrame;
|
|
||||||
export declare function enhanceUnexpectedTokenMessage(e: Error): Error;
|
|
||||||
export {};
|
|
||||||
//# sourceMappingURL=enhanceUnexpectedTokenMessage.d.ts.map
|
|
|
@ -1,11 +0,0 @@
|
||||||
/**
|
|
||||||
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* This source code is licensed under the MIT license found in the
|
|
||||||
* LICENSE file in the root directory of this source tree.
|
|
||||||
*/
|
|
||||||
export { default as ScriptTransformer, createTranspilingRequire, } from './ScriptTransformer';
|
|
||||||
export { default as shouldInstrument } from './shouldInstrument';
|
|
||||||
export { CacheKeyOptions, Transformer, ShouldInstrumentOptions, Options as TransformationOptions, TransformOptions, TransformResult, TransformedSource, } from './types';
|
|
||||||
export { default as handlePotentialSyntaxError } from './enhanceUnexpectedTokenMessage';
|
|
||||||
//# sourceMappingURL=index.d.ts.map
|
|
10
packages/common/node_modules/@jest/transform/build/ts3.4/shouldInstrument.d.ts
generated
vendored
10
packages/common/node_modules/@jest/transform/build/ts3.4/shouldInstrument.d.ts
generated
vendored
|
@ -1,10 +0,0 @@
|
||||||
/**
|
|
||||||
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* This source code is licensed under the MIT license found in the
|
|
||||||
* LICENSE file in the root directory of this source tree.
|
|
||||||
*/
|
|
||||||
import { Config } from '@jest/types';
|
|
||||||
import { ShouldInstrumentOptions } from './types';
|
|
||||||
export default function shouldInstrument(filename: Config.Path, options: ShouldInstrumentOptions, config: Config.ProjectConfig): boolean;
|
|
||||||
//# sourceMappingURL=shouldInstrument.d.ts.map
|
|
|
@ -1,43 +0,0 @@
|
||||||
/**
|
|
||||||
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* This source code is licensed under the MIT license found in the
|
|
||||||
* LICENSE file in the root directory of this source tree.
|
|
||||||
*/
|
|
||||||
import { RawSourceMap } from 'source-map';
|
|
||||||
import { Config, TransformTypes } from '@jest/types';
|
|
||||||
export declare type ShouldInstrumentOptions = Pick<Config.GlobalConfig, 'collectCoverage' | 'collectCoverageFrom' | 'collectCoverageOnlyFrom' | 'coverageProvider'> & {
|
|
||||||
changedFiles?: Set<Config.Path>;
|
|
||||||
};
|
|
||||||
export declare type Options = ShouldInstrumentOptions & Partial<{
|
|
||||||
isCoreModule: boolean;
|
|
||||||
isInternalModule: boolean;
|
|
||||||
supportsDynamicImport: boolean;
|
|
||||||
supportsStaticESM: boolean;
|
|
||||||
}>;
|
|
||||||
declare type SourceMapWithVersion = Pick<RawSourceMap, Exclude<keyof RawSourceMap, 'version'>>;
|
|
||||||
interface FixedRawSourceMap extends SourceMapWithVersion {
|
|
||||||
version: number;
|
|
||||||
}
|
|
||||||
export declare type TransformedSource = {
|
|
||||||
code: string;
|
|
||||||
map?: FixedRawSourceMap | string | null;
|
|
||||||
} | string;
|
|
||||||
export declare type TransformResult = TransformTypes.TransformResult;
|
|
||||||
export interface TransformOptions {
|
|
||||||
instrument: boolean;
|
|
||||||
supportsDynamicImport?: boolean;
|
|
||||||
supportsStaticESM?: boolean;
|
|
||||||
}
|
|
||||||
export interface CacheKeyOptions extends TransformOptions {
|
|
||||||
config: Config.ProjectConfig;
|
|
||||||
rootDir: string;
|
|
||||||
}
|
|
||||||
export interface Transformer {
|
|
||||||
canInstrument?: boolean;
|
|
||||||
createTransformer?: (options?: any) => Transformer;
|
|
||||||
getCacheKey?: (fileData: string, filePath: Config.Path, configStr: string, options: CacheKeyOptions) => string;
|
|
||||||
process: (sourceText: string, sourcePath: Config.Path, config: Config.ProjectConfig, options?: TransformOptions) => TransformedSource;
|
|
||||||
}
|
|
||||||
export {};
|
|
||||||
//# sourceMappingURL=types.d.ts.map
|
|
|
@ -4,40 +4,43 @@
|
||||||
* This source code is licensed under the MIT license found in the
|
* This source code is licensed under the MIT license found in the
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
import type { RawSourceMap } from 'source-map';
|
/// <reference types="node" />
|
||||||
import type { Config, TransformTypes } from '@jest/types';
|
import { Script } from 'vm';
|
||||||
export declare type ShouldInstrumentOptions = Pick<Config.GlobalConfig, 'collectCoverage' | 'collectCoverageFrom' | 'collectCoverageOnlyFrom' | 'coverageProvider'> & {
|
import { RawSourceMap } from 'source-map';
|
||||||
changedFiles?: Set<Config.Path>;
|
import { Config } from '@jest/types';
|
||||||
|
export declare type ShouldInstrumentOptions = Pick<Config.GlobalConfig, 'collectCoverage' | 'collectCoverageFrom' | 'collectCoverageOnlyFrom'> & {
|
||||||
|
changedFiles: Set<Config.Path> | undefined;
|
||||||
};
|
};
|
||||||
export declare type Options = ShouldInstrumentOptions & Partial<{
|
export declare type Options = ShouldInstrumentOptions & Pick<Config.GlobalConfig, 'extraGlobals'> & {
|
||||||
isCoreModule: boolean;
|
isCoreModule?: boolean;
|
||||||
isInternalModule: boolean;
|
isInternalModule?: boolean;
|
||||||
supportsDynamicImport: boolean;
|
};
|
||||||
supportsStaticESM: boolean;
|
declare type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
|
||||||
}>;
|
interface FixedRawSourceMap extends Omit<RawSourceMap, 'version'> {
|
||||||
declare type SourceMapWithVersion = Omit<RawSourceMap, 'version'>;
|
|
||||||
interface FixedRawSourceMap extends SourceMapWithVersion {
|
|
||||||
version: number;
|
version: number;
|
||||||
}
|
}
|
||||||
export declare type TransformedSource = {
|
export declare type TransformedSource = {
|
||||||
code: string;
|
code: string;
|
||||||
map?: FixedRawSourceMap | string | null;
|
map?: FixedRawSourceMap | string | null;
|
||||||
} | string;
|
};
|
||||||
export declare type TransformResult = TransformTypes.TransformResult;
|
export declare type TransformResult = {
|
||||||
export interface TransformOptions {
|
script: Script;
|
||||||
|
mapCoverage: boolean;
|
||||||
|
sourceMapPath: string | null;
|
||||||
|
};
|
||||||
|
export declare type TransformOptions = {
|
||||||
instrument: boolean;
|
instrument: boolean;
|
||||||
supportsDynamicImport?: boolean;
|
};
|
||||||
supportsStaticESM?: boolean;
|
export declare type CacheKeyOptions = {
|
||||||
}
|
|
||||||
export interface CacheKeyOptions extends TransformOptions {
|
|
||||||
config: Config.ProjectConfig;
|
config: Config.ProjectConfig;
|
||||||
|
instrument: boolean;
|
||||||
rootDir: string;
|
rootDir: string;
|
||||||
}
|
};
|
||||||
export interface Transformer {
|
export interface Transformer {
|
||||||
canInstrument?: boolean;
|
canInstrument?: boolean;
|
||||||
createTransformer?: (options?: any) => Transformer;
|
createTransformer?: (options?: any) => Transformer;
|
||||||
getCacheKey?: (fileData: string, filePath: Config.Path, configStr: string, options: CacheKeyOptions) => string;
|
getCacheKey: (fileData: string, filePath: Config.Path, configStr: string, options: CacheKeyOptions) => string;
|
||||||
process: (sourceText: string, sourcePath: Config.Path, config: Config.ProjectConfig, options?: TransformOptions) => TransformedSource;
|
process: (sourceText: string, sourcePath: Config.Path, config: Config.ProjectConfig, options?: TransformOptions) => string | TransformedSource;
|
||||||
}
|
}
|
||||||
export {};
|
export {};
|
||||||
//# sourceMappingURL=types.d.ts.map
|
//# sourceMappingURL=types.d.ts.map
|
|
@ -1 +1 @@
|
||||||
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EAAC,MAAM,EAAE,cAAc,EAAC,MAAM,aAAa,CAAC;AAExD,oBAAY,uBAAuB,GAAG,IAAI,CACxC,MAAM,CAAC,YAAY,EACjB,iBAAiB,GACjB,qBAAqB,GACrB,yBAAyB,GACzB,kBAAkB,CACrB,GAAG;IACF,YAAY,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;CACjC,CAAC;AAEF,oBAAY,OAAO,GAAG,uBAAuB,GAC3C,OAAO,CAAC;IACN,YAAY,EAAE,OAAO,CAAC;IACtB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,qBAAqB,EAAE,OAAO,CAAC;IAC/B,iBAAiB,EAAE,OAAO,CAAC;CAC5B,CAAC,CAAC;AAGL,aAAK,oBAAoB,GAAG,IAAI,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;AAG1D,UAAU,iBAAkB,SAAQ,oBAAoB;IACtD,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,oBAAY,iBAAiB,GACzB;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,iBAAiB,GAAG,MAAM,GAAG,IAAI,CAAA;CAAC,GACvD,MAAM,CAAC;AAEX,oBAAY,eAAe,GAAG,cAAc,CAAC,eAAe,CAAC;AAE7D,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,OAAO,CAAC;IAEpB,qBAAqB,CAAC,EAAE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 -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@jest/transform",
|
"name": "@jest/transform",
|
||||||
"version": "25.3.0",
|
"version": "24.9.0",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/facebook/jest.git",
|
"url": "https://github.com/facebook/jest.git",
|
||||||
|
@ -8,47 +8,37 @@
|
||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"main": "build/index.js",
|
"main": "build/index.js",
|
||||||
"types": "build/index.d.ts",
|
|
||||||
"typesVersions": {
|
|
||||||
"<3.8": {
|
|
||||||
"build/*": [
|
|
||||||
"build/ts3.4/*"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/core": "^7.1.0",
|
"@babel/core": "^7.1.0",
|
||||||
"@jest/types": "^25.3.0",
|
"@jest/types": "^24.9.0",
|
||||||
"babel-plugin-istanbul": "^6.0.0",
|
"babel-plugin-istanbul": "^5.1.0",
|
||||||
"chalk": "^3.0.0",
|
"chalk": "^2.0.1",
|
||||||
"convert-source-map": "^1.4.0",
|
"convert-source-map": "^1.4.0",
|
||||||
"fast-json-stable-stringify": "^2.0.0",
|
"fast-json-stable-stringify": "^2.0.0",
|
||||||
"graceful-fs": "^4.2.3",
|
"graceful-fs": "^4.1.15",
|
||||||
"jest-haste-map": "^25.3.0",
|
"jest-haste-map": "^24.9.0",
|
||||||
"jest-regex-util": "^25.2.6",
|
"jest-regex-util": "^24.9.0",
|
||||||
"jest-util": "^25.3.0",
|
"jest-util": "^24.9.0",
|
||||||
"micromatch": "^4.0.2",
|
"micromatch": "^3.1.10",
|
||||||
"pirates": "^4.0.1",
|
"pirates": "^4.0.1",
|
||||||
"realpath-native": "^2.0.0",
|
"realpath-native": "^1.1.0",
|
||||||
"slash": "^3.0.0",
|
"slash": "^2.0.0",
|
||||||
"source-map": "^0.6.1",
|
"source-map": "^0.6.1",
|
||||||
"write-file-atomic": "^3.0.0"
|
"write-file-atomic": "2.4.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/babel__core": "^7.1.0",
|
"@types/babel__core": "^7.1.0",
|
||||||
"@types/convert-source-map": "^1.5.1",
|
"@types/convert-source-map": "^1.5.1",
|
||||||
"@types/fast-json-stable-stringify": "^2.0.0",
|
"@types/fast-json-stable-stringify": "^2.0.0",
|
||||||
"@types/graceful-fs": "^4.1.2",
|
"@types/graceful-fs": "^4.1.2",
|
||||||
"@types/micromatch": "^4.0.0",
|
"@types/micromatch": "^3.1.0",
|
||||||
"@types/write-file-atomic": "^3.0.0",
|
"@types/write-file-atomic": "^2.1.1"
|
||||||
"dedent": "^0.7.0",
|
|
||||||
"jest-snapshot-serializer-raw": "^1.1.0"
|
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 8.3"
|
"node": ">= 6"
|
||||||
},
|
},
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"access": "public"
|
"access": "public"
|
||||||
},
|
},
|
||||||
"gitHead": "45a4936d96d74cdee6b91122a51a556e3ebe6dc8"
|
"gitHead": "9ad0f4bc6b8bdd94989804226c28c9960d9da7d1"
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import type * as Global from './Global';
|
import * as Global from './Global';
|
||||||
declare type Process = NodeJS.Process;
|
declare type Process = NodeJS.Process;
|
||||||
export declare type DoneFn = Global.DoneFn;
|
export declare type DoneFn = Global.DoneFn;
|
||||||
export declare type BlockFn = Global.BlockFn;
|
export declare type BlockFn = Global.BlockFn;
|
||||||
|
@ -28,12 +28,10 @@ export declare type Hook = {
|
||||||
parent: DescribeBlock;
|
parent: DescribeBlock;
|
||||||
timeout: number | undefined | null;
|
timeout: number | undefined | null;
|
||||||
};
|
};
|
||||||
export interface EventHandler {
|
export declare type EventHandler = (event: Event, state: State) => void;
|
||||||
(event: AsyncEvent, state: State): void | Promise<void>;
|
export declare type Event = {
|
||||||
(event: SyncEvent, state: State): void;
|
name: 'include_test_location_in_result';
|
||||||
}
|
} | {
|
||||||
export declare type Event = SyncEvent | AsyncEvent;
|
|
||||||
export declare type SyncEvent = {
|
|
||||||
asyncError: Error;
|
asyncError: Error;
|
||||||
mode: BlockMode;
|
mode: BlockMode;
|
||||||
name: 'start_describe_definition';
|
name: 'start_describe_definition';
|
||||||
|
@ -55,16 +53,6 @@ export declare type SyncEvent = {
|
||||||
fn?: TestFn;
|
fn?: TestFn;
|
||||||
mode?: TestMode;
|
mode?: TestMode;
|
||||||
timeout: number | undefined;
|
timeout: number | undefined;
|
||||||
} | {
|
|
||||||
name: 'error';
|
|
||||||
error: Exception;
|
|
||||||
};
|
|
||||||
export declare type AsyncEvent = {
|
|
||||||
name: 'setup';
|
|
||||||
testNamePattern?: string;
|
|
||||||
parentProcess: Process;
|
|
||||||
} | {
|
|
||||||
name: 'include_test_location_in_result';
|
|
||||||
} | {
|
} | {
|
||||||
name: 'hook_start';
|
name: 'hook_start';
|
||||||
hook: Hook;
|
hook: Hook;
|
||||||
|
@ -114,6 +102,13 @@ export declare type AsyncEvent = {
|
||||||
name: 'run_start';
|
name: 'run_start';
|
||||||
} | {
|
} | {
|
||||||
name: 'run_finish';
|
name: 'run_finish';
|
||||||
|
} | {
|
||||||
|
name: 'error';
|
||||||
|
error: Exception;
|
||||||
|
} | {
|
||||||
|
name: 'setup';
|
||||||
|
testNamePattern?: string;
|
||||||
|
parentProcess: Process;
|
||||||
} | {
|
} | {
|
||||||
name: 'teardown';
|
name: 'teardown';
|
||||||
};
|
};
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
{"version":3,"file":"Circus.d.ts","sourceRoot":"","sources":["../src/Circus.ts"],"names":[],"mappings":"AAAA;;;;;GAK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AM,CAAC,EAAE,UAAU,GAAG,IAAI,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC"}
|
|
@ -5,15 +5,13 @@
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import type { Arguments } from 'yargs';
|
import { Arguments } from 'yargs';
|
||||||
import type { ReportOptions } from 'istanbul-reports';
|
import { ReportOptions } from 'istanbul-reports';
|
||||||
import chalk = require('chalk');
|
|
||||||
declare type CoverageProvider = 'babel' | 'v8';
|
|
||||||
export declare type Path = string;
|
export declare type Path = string;
|
||||||
export declare type Glob = string;
|
export declare type Glob = string;
|
||||||
export declare type HasteConfig = {
|
export declare type HasteConfig = {
|
||||||
computeSha1?: boolean;
|
computeSha1?: boolean;
|
||||||
defaultPlatform?: string | null;
|
defaultPlatform?: string | null | undefined;
|
||||||
hasteImplModulePath?: string;
|
hasteImplModulePath?: string;
|
||||||
platforms?: Array<string>;
|
platforms?: Array<string>;
|
||||||
providesModuleNodeModules: Array<string>;
|
providesModuleNodeModules: Array<string>;
|
||||||
|
@ -21,9 +19,7 @@ export declare type HasteConfig = {
|
||||||
};
|
};
|
||||||
export declare type ReporterConfig = [string, Record<string, unknown>];
|
export declare type ReporterConfig = [string, Record<string, unknown>];
|
||||||
export declare type TransformerConfig = [string, Record<string, unknown>];
|
export declare type TransformerConfig = [string, Record<string, unknown>];
|
||||||
export interface ConfigGlobals {
|
export declare type ConfigGlobals = Record<string, any>;
|
||||||
[K: string]: unknown;
|
|
||||||
}
|
|
||||||
export declare type DefaultOptions = {
|
export declare type DefaultOptions = {
|
||||||
automock: boolean;
|
automock: boolean;
|
||||||
bail: number;
|
bail: number;
|
||||||
|
@ -33,30 +29,46 @@ export declare type DefaultOptions = {
|
||||||
changedFilesWithAncestor: boolean;
|
changedFilesWithAncestor: boolean;
|
||||||
clearMocks: boolean;
|
clearMocks: boolean;
|
||||||
collectCoverage: boolean;
|
collectCoverage: boolean;
|
||||||
|
collectCoverageFrom: Array<string> | null | undefined;
|
||||||
|
coverageDirectory: string | null | undefined;
|
||||||
coveragePathIgnorePatterns: Array<string>;
|
coveragePathIgnorePatterns: Array<string>;
|
||||||
coverageReporters: Array<string | [string, any]>;
|
coverageReporters: Array<string>;
|
||||||
coverageProvider: CoverageProvider;
|
coverageThreshold: {
|
||||||
|
global: {
|
||||||
|
[key: string]: number;
|
||||||
|
};
|
||||||
|
} | null | undefined;
|
||||||
|
dependencyExtractor: string | null | undefined;
|
||||||
errorOnDeprecated: boolean;
|
errorOnDeprecated: boolean;
|
||||||
expand: boolean;
|
expand: boolean;
|
||||||
|
filter: Path | null | undefined;
|
||||||
forceCoverageMatch: Array<Glob>;
|
forceCoverageMatch: Array<Glob>;
|
||||||
globals: ConfigGlobals;
|
globals: ConfigGlobals;
|
||||||
|
globalSetup: string | null | undefined;
|
||||||
|
globalTeardown: string | null | undefined;
|
||||||
haste: HasteConfig;
|
haste: HasteConfig;
|
||||||
maxConcurrency: number;
|
|
||||||
maxWorkers: number | string;
|
maxWorkers: number | string;
|
||||||
|
maxConcurrency: number;
|
||||||
moduleDirectories: Array<string>;
|
moduleDirectories: Array<string>;
|
||||||
moduleFileExtensions: Array<string>;
|
moduleFileExtensions: Array<string>;
|
||||||
moduleNameMapper: Record<string, string | Array<string>>;
|
moduleNameMapper: {
|
||||||
|
[key: string]: string;
|
||||||
|
};
|
||||||
modulePathIgnorePatterns: Array<string>;
|
modulePathIgnorePatterns: Array<string>;
|
||||||
noStackTrace: boolean;
|
noStackTrace: boolean;
|
||||||
notify: boolean;
|
notify: boolean;
|
||||||
notifyMode: NotifyMode;
|
notifyMode: string;
|
||||||
prettierPath: string;
|
preset: string | null | undefined;
|
||||||
|
prettierPath: string | null | undefined;
|
||||||
|
projects: Array<string | ProjectConfig> | null | undefined;
|
||||||
resetMocks: boolean;
|
resetMocks: boolean;
|
||||||
resetModules: boolean;
|
resetModules: boolean;
|
||||||
|
resolver: Path | null | undefined;
|
||||||
restoreMocks: boolean;
|
restoreMocks: boolean;
|
||||||
roots: Array<Path>;
|
rootDir: Path | null | undefined;
|
||||||
|
roots: Array<Path> | null | undefined;
|
||||||
|
runner: string;
|
||||||
runTestsByPath: boolean;
|
runTestsByPath: boolean;
|
||||||
runner: 'jest-runner';
|
|
||||||
setupFiles: Array<Path>;
|
setupFiles: Array<Path>;
|
||||||
setupFilesAfterEnv: Array<Path>;
|
setupFilesAfterEnv: Array<Path>;
|
||||||
skipFilter: boolean;
|
skipFilter: boolean;
|
||||||
|
@ -68,173 +80,180 @@ export declare type DefaultOptions = {
|
||||||
testMatch: Array<Glob>;
|
testMatch: Array<Glob>;
|
||||||
testPathIgnorePatterns: Array<string>;
|
testPathIgnorePatterns: Array<string>;
|
||||||
testRegex: Array<string>;
|
testRegex: Array<string>;
|
||||||
testRunner: string;
|
testResultsProcessor: string | null | undefined;
|
||||||
|
testRunner: string | null | undefined;
|
||||||
testSequencer: string;
|
testSequencer: string;
|
||||||
testURL: string;
|
testURL: string;
|
||||||
timers: 'real' | 'fake';
|
timers: 'real' | 'fake';
|
||||||
|
transform: {
|
||||||
|
[regex: string]: Path | TransformerConfig;
|
||||||
|
} | null | undefined;
|
||||||
transformIgnorePatterns: Array<Glob>;
|
transformIgnorePatterns: Array<Glob>;
|
||||||
useStderr: boolean;
|
|
||||||
watch: boolean;
|
|
||||||
watchPathIgnorePatterns: Array<string>;
|
watchPathIgnorePatterns: Array<string>;
|
||||||
|
useStderr: boolean;
|
||||||
|
verbose: boolean | null | undefined;
|
||||||
|
watch: boolean;
|
||||||
watchman: boolean;
|
watchman: boolean;
|
||||||
};
|
};
|
||||||
export declare type DisplayName = string | {
|
export declare type DisplayName = string | {
|
||||||
name: string;
|
name: string;
|
||||||
color: typeof chalk.Color;
|
color: DisplayNameColor;
|
||||||
};
|
};
|
||||||
export declare type InitialOptionsWithRootDir = InitialOptions & Required<Pick<InitialOptions, 'rootDir'>>;
|
export declare type InitialOptions = {
|
||||||
export declare type InitialOptions = Partial<{
|
automock?: boolean;
|
||||||
automock: boolean;
|
bail?: boolean | number;
|
||||||
bail: boolean | number;
|
browser?: boolean;
|
||||||
browser: boolean;
|
cache?: boolean;
|
||||||
cache: boolean;
|
cacheDirectory?: Path;
|
||||||
cacheDirectory: Path;
|
clearMocks?: boolean;
|
||||||
clearMocks: boolean;
|
changedFilesWithAncestor?: boolean;
|
||||||
changedFilesWithAncestor: boolean;
|
changedSince?: string;
|
||||||
changedSince: string;
|
collectCoverage?: boolean;
|
||||||
collectCoverage: boolean;
|
collectCoverageFrom?: Array<Glob>;
|
||||||
collectCoverageFrom: Array<Glob>;
|
collectCoverageOnlyFrom?: {
|
||||||
collectCoverageOnlyFrom: {
|
|
||||||
[key: string]: boolean;
|
[key: string]: boolean;
|
||||||
};
|
};
|
||||||
coverageDirectory: string;
|
coverageDirectory?: string;
|
||||||
coveragePathIgnorePatterns: Array<string>;
|
coveragePathIgnorePatterns?: Array<string>;
|
||||||
coverageProvider: CoverageProvider;
|
coverageReporters?: Array<string>;
|
||||||
coverageReporters: Array<string>;
|
coverageThreshold?: {
|
||||||
coverageThreshold: {
|
|
||||||
global: {
|
global: {
|
||||||
[key: string]: number;
|
[key: string]: number;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
dependencyExtractor: string;
|
dependencyExtractor?: string;
|
||||||
detectLeaks: boolean;
|
detectLeaks?: boolean;
|
||||||
detectOpenHandles: boolean;
|
detectOpenHandles?: boolean;
|
||||||
displayName: DisplayName;
|
displayName?: DisplayName;
|
||||||
expand: boolean;
|
expand?: boolean;
|
||||||
extraGlobals: Array<string>;
|
extraGlobals?: Array<string>;
|
||||||
filter: Path;
|
filter?: Path;
|
||||||
findRelatedTests: boolean;
|
findRelatedTests?: boolean;
|
||||||
forceCoverageMatch: Array<Glob>;
|
forceCoverageMatch?: Array<Glob>;
|
||||||
forceExit: boolean;
|
forceExit?: boolean;
|
||||||
json: boolean;
|
json?: boolean;
|
||||||
globals: ConfigGlobals;
|
globals?: ConfigGlobals;
|
||||||
globalSetup: string | null | undefined;
|
globalSetup?: string | null | undefined;
|
||||||
globalTeardown: string | null | undefined;
|
globalTeardown?: string | null | undefined;
|
||||||
haste: HasteConfig;
|
haste?: HasteConfig;
|
||||||
reporters: Array<string | ReporterConfig>;
|
reporters?: Array<string | ReporterConfig>;
|
||||||
logHeapUsage: boolean;
|
logHeapUsage?: boolean;
|
||||||
lastCommit: boolean;
|
lastCommit?: boolean;
|
||||||
listTests: boolean;
|
listTests?: boolean;
|
||||||
mapCoverage: boolean;
|
mapCoverage?: boolean;
|
||||||
maxConcurrency: number;
|
maxConcurrency?: number;
|
||||||
maxWorkers: number | string;
|
maxWorkers: number | string;
|
||||||
moduleDirectories: Array<string>;
|
moduleDirectories?: Array<string>;
|
||||||
moduleFileExtensions: Array<string>;
|
moduleFileExtensions?: Array<string>;
|
||||||
moduleLoader: Path;
|
moduleLoader?: Path;
|
||||||
moduleNameMapper: {
|
moduleNameMapper?: {
|
||||||
[key: string]: string | Array<string>;
|
[key: string]: string;
|
||||||
};
|
};
|
||||||
modulePathIgnorePatterns: Array<string>;
|
modulePathIgnorePatterns?: Array<string>;
|
||||||
modulePaths: Array<string>;
|
modulePaths?: Array<string>;
|
||||||
name: string;
|
name?: string;
|
||||||
noStackTrace: boolean;
|
noStackTrace?: boolean;
|
||||||
notify: boolean;
|
notify?: boolean;
|
||||||
notifyMode: string;
|
notifyMode?: string;
|
||||||
onlyChanged: boolean;
|
onlyChanged?: boolean;
|
||||||
outputFile: Path;
|
outputFile?: Path;
|
||||||
passWithNoTests: boolean;
|
passWithNoTests?: boolean;
|
||||||
preprocessorIgnorePatterns: Array<Glob>;
|
preprocessorIgnorePatterns?: Array<Glob>;
|
||||||
preset: string | null | undefined;
|
preset?: string | null | undefined;
|
||||||
prettierPath: string | null | undefined;
|
prettierPath?: string | null | undefined;
|
||||||
projects: Array<Glob>;
|
projects?: Array<Glob>;
|
||||||
replname: string | null | undefined;
|
replname?: string | null | undefined;
|
||||||
resetMocks: boolean;
|
resetMocks?: boolean;
|
||||||
resetModules: boolean;
|
resetModules?: boolean;
|
||||||
resolver: Path | null | undefined;
|
resolver?: Path | null | undefined;
|
||||||
restoreMocks: boolean;
|
restoreMocks?: boolean;
|
||||||
rootDir: Path;
|
rootDir: Path;
|
||||||
roots: Array<Path>;
|
roots?: Array<Path>;
|
||||||
runner: string;
|
runner?: string;
|
||||||
runTestsByPath: boolean;
|
runTestsByPath?: boolean;
|
||||||
scriptPreprocessor: string;
|
scriptPreprocessor?: string;
|
||||||
setupFiles: Array<Path>;
|
setupFiles?: Array<Path>;
|
||||||
setupTestFrameworkScriptFile: Path;
|
setupTestFrameworkScriptFile?: Path;
|
||||||
setupFilesAfterEnv: Array<Path>;
|
setupFilesAfterEnv?: Array<Path>;
|
||||||
silent: boolean;
|
silent?: boolean;
|
||||||
skipFilter: boolean;
|
skipFilter?: boolean;
|
||||||
skipNodeResolution: boolean;
|
skipNodeResolution?: boolean;
|
||||||
snapshotResolver: Path;
|
snapshotResolver?: Path;
|
||||||
snapshotSerializers: Array<Path>;
|
snapshotSerializers?: Array<Path>;
|
||||||
errorOnDeprecated: boolean;
|
errorOnDeprecated?: boolean;
|
||||||
testEnvironment: string;
|
testEnvironment?: string;
|
||||||
testEnvironmentOptions: Record<string, any>;
|
testEnvironmentOptions?: Record<string, any>;
|
||||||
testFailureExitCode: string | number;
|
testFailureExitCode?: string | number;
|
||||||
testLocationInResults: boolean;
|
testLocationInResults?: boolean;
|
||||||
testMatch: Array<Glob>;
|
testMatch?: Array<Glob>;
|
||||||
testNamePattern: string;
|
testNamePattern?: string;
|
||||||
testPathDirs: Array<Path>;
|
testPathDirs?: Array<Path>;
|
||||||
testPathIgnorePatterns: Array<string>;
|
testPathIgnorePatterns?: Array<string>;
|
||||||
testRegex: string | Array<string>;
|
testRegex?: string | Array<string>;
|
||||||
testResultsProcessor: string;
|
testResultsProcessor?: string | null | undefined;
|
||||||
testRunner: string;
|
testRunner?: string;
|
||||||
testSequencer: string;
|
testSequencer?: string;
|
||||||
testURL: string;
|
testURL?: string;
|
||||||
testTimeout: number;
|
testTimeout?: number;
|
||||||
timers: 'real' | 'fake';
|
timers?: 'real' | 'fake';
|
||||||
transform: {
|
transform?: {
|
||||||
[regex: string]: Path | TransformerConfig;
|
[regex: string]: Path | TransformerConfig;
|
||||||
};
|
};
|
||||||
transformIgnorePatterns: Array<Glob>;
|
transformIgnorePatterns?: Array<Glob>;
|
||||||
watchPathIgnorePatterns: Array<string>;
|
watchPathIgnorePatterns?: Array<string>;
|
||||||
unmockedModulePathPatterns: Array<string>;
|
unmockedModulePathPatterns?: Array<string>;
|
||||||
updateSnapshot: boolean;
|
updateSnapshot?: boolean;
|
||||||
useStderr: boolean;
|
useStderr?: boolean;
|
||||||
verbose?: boolean;
|
verbose?: boolean | null | undefined;
|
||||||
watch: boolean;
|
watch?: boolean;
|
||||||
watchAll: boolean;
|
watchAll?: boolean;
|
||||||
watchman: boolean;
|
watchman?: boolean;
|
||||||
watchPlugins: Array<string | [string, Record<string, any>]>;
|
watchPlugins?: Array<string | [string, Record<string, any>]>;
|
||||||
}>;
|
};
|
||||||
export declare type SnapshotUpdateState = 'all' | 'new' | 'none';
|
export declare type SnapshotUpdateState = 'all' | 'new' | 'none';
|
||||||
declare type NotifyMode = 'always' | 'failure' | 'success' | 'change' | 'success-change' | 'failure-change';
|
declare type NotifyMode = 'always' | 'failure' | 'success' | 'change' | 'success-change' | 'failure-change';
|
||||||
export declare type CoverageThresholdValue = {
|
/**
|
||||||
branches?: number;
|
* Hard coding this until
|
||||||
functions?: number;
|
* https://github.com/chalk/chalk/pull/336
|
||||||
lines?: number;
|
* gets merged
|
||||||
statements?: number;
|
*/
|
||||||
};
|
declare type DisplayNameColor = 'black' | 'red' | 'green' | 'yellow' | 'blue' | 'magenta' | 'cyan' | 'white' | 'gray' | 'grey' | 'blackBright' | 'redBright' | 'greenBright' | 'yellowBright' | 'blueBright' | 'magentaBright' | 'cyanBright' | 'whiteBright' | 'bgBlack' | 'bgRed' | 'bgGreen' | 'bgYellow' | 'bgBlue' | 'bgMagenta' | 'bgCyan' | 'bgWhite' | 'bgBlackBright' | 'bgRedBright' | 'bgGreenBright' | 'bgYellowBright' | 'bgBlueBright' | 'bgMagentaBright' | 'bgCyanBright' | 'bgWhiteBright';
|
||||||
declare type CoverageThreshold = {
|
declare type CoverageThreshold = {
|
||||||
[path: string]: CoverageThresholdValue;
|
[path: string]: {
|
||||||
global: CoverageThresholdValue;
|
[key: string]: number;
|
||||||
|
};
|
||||||
|
global: {
|
||||||
|
[key: string]: number;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
export declare type GlobalConfig = {
|
export declare type GlobalConfig = {
|
||||||
bail: number;
|
bail: number;
|
||||||
changedSince?: string;
|
changedSince: string;
|
||||||
changedFilesWithAncestor: boolean;
|
changedFilesWithAncestor: boolean;
|
||||||
collectCoverage: boolean;
|
collectCoverage: boolean;
|
||||||
collectCoverageFrom: Array<Glob>;
|
collectCoverageFrom: Array<Glob>;
|
||||||
collectCoverageOnlyFrom?: {
|
collectCoverageOnlyFrom: {
|
||||||
[key: string]: boolean;
|
[key: string]: boolean;
|
||||||
};
|
} | null | undefined;
|
||||||
coverageDirectory: string;
|
coverageDirectory: string;
|
||||||
coveragePathIgnorePatterns?: Array<string>;
|
coveragePathIgnorePatterns?: Array<string>;
|
||||||
coverageProvider: CoverageProvider;
|
coverageReporters: Array<keyof ReportOptions>;
|
||||||
coverageReporters: Array<keyof ReportOptions | [keyof ReportOptions, any]>;
|
coverageThreshold: CoverageThreshold;
|
||||||
coverageThreshold?: CoverageThreshold;
|
|
||||||
detectLeaks: boolean;
|
detectLeaks: boolean;
|
||||||
detectOpenHandles: boolean;
|
detectOpenHandles: boolean;
|
||||||
enabledTestsMap?: {
|
enabledTestsMap: {
|
||||||
[key: string]: {
|
[key: string]: {
|
||||||
[key: string]: boolean;
|
[key: string]: boolean;
|
||||||
};
|
};
|
||||||
};
|
} | null | undefined;
|
||||||
expand: boolean;
|
expand: boolean;
|
||||||
filter?: Path;
|
extraGlobals: Array<string>;
|
||||||
|
filter: Path | null | undefined;
|
||||||
findRelatedTests: boolean;
|
findRelatedTests: boolean;
|
||||||
forceExit: boolean;
|
forceExit: boolean;
|
||||||
json: boolean;
|
json: boolean;
|
||||||
globalSetup?: string;
|
globalSetup: string | null | undefined;
|
||||||
globalTeardown?: string;
|
globalTeardown: string | null | undefined;
|
||||||
lastCommit: boolean;
|
lastCommit: boolean;
|
||||||
logHeapUsage: boolean;
|
logHeapUsage: boolean;
|
||||||
listTests: boolean;
|
listTests: boolean;
|
||||||
|
@ -242,37 +261,37 @@ export declare type GlobalConfig = {
|
||||||
maxWorkers: number;
|
maxWorkers: number;
|
||||||
noStackTrace: boolean;
|
noStackTrace: boolean;
|
||||||
nonFlagArgs: Array<string>;
|
nonFlagArgs: Array<string>;
|
||||||
noSCM?: boolean;
|
noSCM: boolean | null | undefined;
|
||||||
notify: boolean;
|
notify: boolean;
|
||||||
notifyMode: NotifyMode;
|
notifyMode: NotifyMode;
|
||||||
outputFile?: Path;
|
outputFile: Path | null | undefined;
|
||||||
onlyChanged: boolean;
|
onlyChanged: boolean;
|
||||||
onlyFailures: boolean;
|
onlyFailures: boolean;
|
||||||
passWithNoTests: boolean;
|
passWithNoTests: boolean;
|
||||||
projects: Array<Glob>;
|
projects: Array<Glob>;
|
||||||
replname?: string;
|
replname: string | null | undefined;
|
||||||
reporters?: Array<string | ReporterConfig>;
|
reporters: Array<string | ReporterConfig>;
|
||||||
runTestsByPath: boolean;
|
runTestsByPath: boolean;
|
||||||
rootDir: Path;
|
rootDir: Path;
|
||||||
silent?: boolean;
|
silent: boolean;
|
||||||
skipFilter: boolean;
|
skipFilter: boolean;
|
||||||
errorOnDeprecated: boolean;
|
errorOnDeprecated: boolean;
|
||||||
testFailureExitCode: number;
|
testFailureExitCode: number;
|
||||||
testNamePattern?: string;
|
testNamePattern: string;
|
||||||
testPathPattern: string;
|
testPathPattern: string;
|
||||||
testResultsProcessor?: string;
|
testResultsProcessor: string | null | undefined;
|
||||||
testSequencer: string;
|
testSequencer: string;
|
||||||
testTimeout?: number;
|
testTimeout: number;
|
||||||
updateSnapshot: SnapshotUpdateState;
|
updateSnapshot: SnapshotUpdateState;
|
||||||
useStderr: boolean;
|
useStderr: boolean;
|
||||||
verbose?: boolean;
|
verbose: boolean | null | undefined;
|
||||||
watch: boolean;
|
watch: boolean;
|
||||||
watchAll: boolean;
|
watchAll: boolean;
|
||||||
watchman: boolean;
|
watchman: boolean;
|
||||||
watchPlugins?: Array<{
|
watchPlugins: Array<{
|
||||||
path: string;
|
path: string;
|
||||||
config: Record<string, any>;
|
config: Record<string, any>;
|
||||||
}> | null;
|
}> | null | undefined;
|
||||||
};
|
};
|
||||||
export declare type ProjectConfig = {
|
export declare type ProjectConfig = {
|
||||||
automock: boolean;
|
automock: boolean;
|
||||||
|
@ -288,23 +307,23 @@ export declare type ProjectConfig = {
|
||||||
displayName?: DisplayName;
|
displayName?: DisplayName;
|
||||||
errorOnDeprecated: boolean;
|
errorOnDeprecated: boolean;
|
||||||
extraGlobals: Array<keyof NodeJS.Global>;
|
extraGlobals: Array<keyof NodeJS.Global>;
|
||||||
filter?: Path;
|
filter: Path | null | undefined;
|
||||||
forceCoverageMatch: Array<Glob>;
|
forceCoverageMatch: Array<Glob>;
|
||||||
globalSetup?: string;
|
globalSetup: string | null | undefined;
|
||||||
globalTeardown?: string;
|
globalTeardown: string | null | undefined;
|
||||||
globals: ConfigGlobals;
|
globals: ConfigGlobals;
|
||||||
haste: HasteConfig;
|
haste: HasteConfig;
|
||||||
moduleDirectories: Array<string>;
|
moduleDirectories: Array<string>;
|
||||||
moduleFileExtensions: Array<string>;
|
moduleFileExtensions: Array<string>;
|
||||||
moduleLoader?: Path;
|
moduleLoader: Path;
|
||||||
moduleNameMapper: Array<[string, string]>;
|
moduleNameMapper: Array<[string, string]>;
|
||||||
modulePathIgnorePatterns: Array<string>;
|
modulePathIgnorePatterns: Array<string>;
|
||||||
modulePaths?: Array<string>;
|
modulePaths: Array<string>;
|
||||||
name: string;
|
name: string;
|
||||||
prettierPath: string;
|
prettierPath: string;
|
||||||
resetMocks: boolean;
|
resetMocks: boolean;
|
||||||
resetModules: boolean;
|
resetModules: boolean;
|
||||||
resolver?: Path;
|
resolver: Path | null | undefined;
|
||||||
restoreMocks: boolean;
|
restoreMocks: boolean;
|
||||||
rootDir: Path;
|
rootDir: Path;
|
||||||
roots: Array<Path>;
|
roots: Array<Path>;
|
||||||
|
@ -312,22 +331,22 @@ export declare type ProjectConfig = {
|
||||||
setupFiles: Array<Path>;
|
setupFiles: Array<Path>;
|
||||||
setupFilesAfterEnv: Array<Path>;
|
setupFilesAfterEnv: Array<Path>;
|
||||||
skipFilter: boolean;
|
skipFilter: boolean;
|
||||||
skipNodeResolution?: boolean;
|
skipNodeResolution: boolean;
|
||||||
snapshotResolver?: Path;
|
snapshotResolver: Path | null | undefined;
|
||||||
snapshotSerializers: Array<Path>;
|
snapshotSerializers: Array<Path>;
|
||||||
testEnvironment: string;
|
testEnvironment: string;
|
||||||
testEnvironmentOptions: Record<string, any>;
|
testEnvironmentOptions: Record<string, any>;
|
||||||
testMatch: Array<Glob>;
|
testMatch: Array<Glob>;
|
||||||
testLocationInResults: boolean;
|
testLocationInResults: boolean;
|
||||||
testPathIgnorePatterns: Array<string>;
|
testPathIgnorePatterns: Array<string>;
|
||||||
testRegex: Array<string | RegExp>;
|
testRegex: Array<string>;
|
||||||
testRunner: string;
|
testRunner: string;
|
||||||
testURL: string;
|
testURL: string;
|
||||||
timers: 'real' | 'fake';
|
timers: 'real' | 'fake';
|
||||||
transform: Array<[string, Path, Record<string, unknown>]>;
|
transform: Array<[string, Path, Record<string, unknown>]>;
|
||||||
transformIgnorePatterns: Array<Glob>;
|
transformIgnorePatterns: Array<Glob>;
|
||||||
watchPathIgnorePatterns: Array<string>;
|
watchPathIgnorePatterns: Array<string>;
|
||||||
unmockedModulePathPatterns?: Array<string>;
|
unmockedModulePathPatterns: Array<string> | null | undefined;
|
||||||
};
|
};
|
||||||
export declare type Argv = Arguments<Partial<{
|
export declare type Argv = Arguments<Partial<{
|
||||||
all: boolean;
|
all: boolean;
|
||||||
|
@ -398,7 +417,7 @@ export declare type Argv = Arguments<Partial<{
|
||||||
testPathIgnorePatterns: Array<string>;
|
testPathIgnorePatterns: Array<string>;
|
||||||
testPathPattern: Array<string>;
|
testPathPattern: Array<string>;
|
||||||
testRegex: string | Array<string>;
|
testRegex: string | Array<string>;
|
||||||
testResultsProcessor: string;
|
testResultsProcessor: string | null | undefined;
|
||||||
testRunner: string;
|
testRunner: string;
|
||||||
testSequencer: string;
|
testSequencer: string;
|
||||||
testURL: string;
|
testURL: string;
|
||||||
|
@ -409,7 +428,7 @@ export declare type Argv = Arguments<Partial<{
|
||||||
unmockedModulePathPatterns: Array<string> | null | undefined;
|
unmockedModulePathPatterns: Array<string> | null | undefined;
|
||||||
updateSnapshot: boolean;
|
updateSnapshot: boolean;
|
||||||
useStderr: boolean;
|
useStderr: boolean;
|
||||||
verbose: boolean;
|
verbose: boolean | null | undefined;
|
||||||
version: boolean;
|
version: boolean;
|
||||||
watch: boolean;
|
watch: boolean;
|
||||||
watchAll: boolean;
|
watchAll: boolean;
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,15 +1 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
function _chalk() {
|
|
||||||
const data = _interopRequireDefault(require('chalk'));
|
|
||||||
|
|
||||||
_chalk = function () {
|
|
||||||
return data;
|
|
||||||
};
|
|
||||||
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
function _interopRequireDefault(obj) {
|
|
||||||
return obj && obj.__esModule ? obj : {default: obj};
|
|
||||||
}
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import type { CoverageMapData } from 'istanbul-lib-coverage';
|
import { CoverageMapData } from 'istanbul-lib-coverage';
|
||||||
export declare type DoneFn = (reason?: string | Error) => void;
|
export declare type DoneFn = (reason?: string | Error) => void;
|
||||||
export declare type TestName = string;
|
export declare type TestName = string;
|
||||||
export declare type TestFn = (done?: DoneFn) => Promise<any> | void | undefined;
|
export declare type TestFn = (done?: DoneFn) => Promise<any> | void | undefined;
|
||||||
|
@ -51,7 +51,7 @@ export interface Describe extends DescribeBase {
|
||||||
only: DescribeBase;
|
only: DescribeBase;
|
||||||
skip: DescribeBase;
|
skip: DescribeBase;
|
||||||
}
|
}
|
||||||
export interface GlobalAdditions {
|
export interface Global extends NodeJS.Global {
|
||||||
it: ItConcurrent;
|
it: ItConcurrent;
|
||||||
test: ItConcurrent;
|
test: ItConcurrent;
|
||||||
fit: ItBase & {
|
fit: ItBase & {
|
||||||
|
@ -68,9 +68,6 @@ export interface GlobalAdditions {
|
||||||
pending: () => void;
|
pending: () => void;
|
||||||
spyOn: () => void;
|
spyOn: () => void;
|
||||||
spyOnProperty: () => void;
|
spyOnProperty: () => void;
|
||||||
}
|
|
||||||
declare type NodeGlobalWithoutAdditions = Omit<NodeJS.Global, keyof GlobalAdditions>;
|
|
||||||
export interface Global extends GlobalAdditions, NodeGlobalWithoutAdditions {
|
|
||||||
[extras: string]: any;
|
[extras: string]: any;
|
||||||
}
|
}
|
||||||
export {};
|
export {};
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
{"version":3,"file":"Global.d.ts","sourceRoot":"","sources":["../src/Global.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,uBAAuB,CAAC;AAE3D,oBAAY,MAAM,GAAG,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,KAAK,KAAK,IAAI,CAAC;AACvD,oBAAY,QAA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SAAQ,MAAM,CAAC,MAAM;IAC3C,EAAE,EAAE,YAAY,CAAC;IACjB,IAAI,EAAE,YAAY,CAAC;IACnB,GAAG,EAAE,MAAM,GAAG;QAAC,UAAU,CAAC,EAAE,gBAAgB,CAAA;KAAC,CAAC;IAC9C,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,QAAQ,CAAC;IACnB,SAAS,EAAE,YAAY,CAAC;IACxB,SAAS,EAAE,YAAY,CAAC;IACxB,YAAY,EAAE,eAAe,CAAC;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG,CAAC;CACvB"}
|
|
@ -1,31 +0,0 @@
|
||||||
/**
|
|
||||||
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* This source code is licensed under the MIT license found in the
|
|
||||||
* LICENSE file in the root directory of this source tree.
|
|
||||||
*/
|
|
||||||
export declare type Milliseconds = number;
|
|
||||||
declare type Status = 'passed' | 'failed' | 'skipped' | 'pending' | 'todo' | 'disabled';
|
|
||||||
declare type Callsite = {
|
|
||||||
column: number;
|
|
||||||
line: number;
|
|
||||||
};
|
|
||||||
export declare type AssertionResult = {
|
|
||||||
ancestorTitles: Array<string>;
|
|
||||||
duration?: Milliseconds | null;
|
|
||||||
failureMessages: Array<string>;
|
|
||||||
fullName: string;
|
|
||||||
invocations?: number;
|
|
||||||
location?: Callsite | null;
|
|
||||||
numPassingAsserts: number;
|
|
||||||
status: Status;
|
|
||||||
title: string;
|
|
||||||
};
|
|
||||||
export declare type SerializableError = {
|
|
||||||
code?: unknown;
|
|
||||||
message: string;
|
|
||||||
stack: string | null | undefined;
|
|
||||||
type?: string;
|
|
||||||
};
|
|
||||||
export {};
|
|
||||||
//# sourceMappingURL=TestResult.d.ts.map
|
|
|
@ -1 +0,0 @@
|
||||||
{"version":3,"file":"TestResult.d.ts","sourceRoot":"","sources":["../src/TestResult.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,oBAAY,YAAY,GAAG,MAAM,CAAC;AAElC,aAAK,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,MAAM,GAAG,UAAU,CAAC;AAEhF,aAAK,QAAQ,GAAG;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAGF,oBAAY,eAAe,GAAG;IAC5B,cAAc,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC9B,QAAQ,CAAC,EAAE,YAAY,GAAG,IAAI,CAAC;IAC/B,eAAe,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC;IAC3B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,oBAAY,iBAAiB,GAAG;IAC9B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACjC,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC"}
|
|
|
@ -1 +0,0 @@
|
||||||
'use strict';
|
|
|
@ -1,13 +0,0 @@
|
||||||
/**
|
|
||||||
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* This source code is licensed under the MIT license found in the
|
|
||||||
* LICENSE file in the root directory of this source tree.
|
|
||||||
*/
|
|
||||||
export declare type TransformResult = {
|
|
||||||
code: string;
|
|
||||||
originalCode: string;
|
|
||||||
mapCoverage: boolean;
|
|
||||||
sourceMapPath: string | null;
|
|
||||||
};
|
|
||||||
//# sourceMappingURL=Transform.d.ts.map
|
|
|
@ -1 +0,0 @@
|
||||||
{"version":3,"file":"Transform.d.ts","sourceRoot":"","sources":["../src/Transform.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,oBAAY,eAAe,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC;IACrB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B,CAAC"}
|
|
|
@ -1 +0,0 @@
|
||||||
'use strict';
|
|
|
@ -4,10 +4,8 @@
|
||||||
* This source code is licensed under the MIT license found in the
|
* This source code is licensed under the MIT license found in the
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
import type * as Circus from './Circus';
|
import * as Circus from './Circus';
|
||||||
import type * as Config from './Config';
|
import * as Config from './Config';
|
||||||
import type * as Global from './Global';
|
import * as Global from './Global';
|
||||||
import type * as TestResult from './TestResult';
|
export { Circus, Config, Global };
|
||||||
import type * as TransformTypes from './Transform';
|
|
||||||
export type { Circus, Config, Global, TestResult, TransformTypes };
|
|
||||||
//# sourceMappingURL=index.d.ts.map
|
//# sourceMappingURL=index.d.ts.map
|
|
@ -1 +1 @@
|
||||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,KAAK,MAAM,MAAM,UAAU,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,MAAM,UAAU,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,MAAM,UAAU,CAAC;AACxC,OAAO,KAAK,KAAK,UAAU,MAAM,cAAc,CAAC;AAChD,OAAO,KAAK,KAAK,cAAc,MAAM,aAAa,CAAC;AAEnD,YAAY,EAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,cAAc,EAAC,CAAC"}
|
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AAEnC,OAAO,EAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAC,CAAC"}
|
|
@ -1 +1,43 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, '__esModule', {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.Global = exports.Config = exports.Circus = void 0;
|
||||||
|
|
||||||
|
var Circus = _interopRequireWildcard(require('./Circus'));
|
||||||
|
|
||||||
|
exports.Circus = Circus;
|
||||||
|
|
||||||
|
var Config = _interopRequireWildcard(require('./Config'));
|
||||||
|
|
||||||
|
exports.Config = Config;
|
||||||
|
|
||||||
|
var Global = _interopRequireWildcard(require('./Global'));
|
||||||
|
|
||||||
|
exports.Global = Global;
|
||||||
|
|
||||||
|
function _interopRequireWildcard(obj) {
|
||||||
|
if (obj && obj.__esModule) {
|
||||||
|
return obj;
|
||||||
|
} else {
|
||||||
|
var newObj = {};
|
||||||
|
if (obj != null) {
|
||||||
|
for (var key in obj) {
|
||||||
|
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
||||||
|
var desc =
|
||||||
|
Object.defineProperty && Object.getOwnPropertyDescriptor
|
||||||
|
? Object.getOwnPropertyDescriptor(obj, key)
|
||||||
|
: {};
|
||||||
|
if (desc.get || desc.set) {
|
||||||
|
Object.defineProperty(newObj, key, desc);
|
||||||
|
} else {
|
||||||
|
newObj[key] = obj[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
newObj.default = obj;
|
||||||
|
return newObj;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,178 +0,0 @@
|
||||||
/// <reference types="node" />
|
|
||||||
/**
|
|
||||||
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* This source code is licensed under the MIT license found in the
|
|
||||||
* LICENSE file in the root directory of this source tree.
|
|
||||||
*/
|
|
||||||
/// <reference types="node" />
|
|
||||||
import * as Global from './Global';
|
|
||||||
declare type Process = NodeJS.Process;
|
|
||||||
export declare type DoneFn = Global.DoneFn;
|
|
||||||
export declare type BlockFn = Global.BlockFn;
|
|
||||||
export declare type BlockName = Global.BlockName;
|
|
||||||
export declare type BlockMode = void | 'skip' | 'only' | 'todo';
|
|
||||||
export declare type TestMode = BlockMode;
|
|
||||||
export declare type TestName = Global.TestName;
|
|
||||||
export declare type TestFn = Global.TestFn;
|
|
||||||
export declare type HookFn = (done?: DoneFn) => Promise<any> | null | undefined;
|
|
||||||
export declare type AsyncFn = TestFn | HookFn;
|
|
||||||
export declare type SharedHookType = 'afterAll' | 'beforeAll';
|
|
||||||
export declare type HookType = SharedHookType | 'afterEach' | 'beforeEach';
|
|
||||||
export declare type TestContext = Record<string, any>;
|
|
||||||
export declare type Exception = any;
|
|
||||||
export declare type FormattedError = string;
|
|
||||||
export declare type Hook = {
|
|
||||||
asyncError: Error;
|
|
||||||
fn: HookFn;
|
|
||||||
type: HookType;
|
|
||||||
parent: DescribeBlock;
|
|
||||||
timeout: number | undefined | null;
|
|
||||||
};
|
|
||||||
export interface EventHandler {
|
|
||||||
(event: AsyncEvent, state: State): void | Promise<void>;
|
|
||||||
(event: SyncEvent, state: State): void;
|
|
||||||
}
|
|
||||||
export declare type Event = SyncEvent | AsyncEvent;
|
|
||||||
export declare type SyncEvent = {
|
|
||||||
asyncError: Error;
|
|
||||||
mode: BlockMode;
|
|
||||||
name: 'start_describe_definition';
|
|
||||||
blockName: BlockName;
|
|
||||||
} | {
|
|
||||||
mode: BlockMode;
|
|
||||||
name: 'finish_describe_definition';
|
|
||||||
blockName: BlockName;
|
|
||||||
} | {
|
|
||||||
asyncError: Error;
|
|
||||||
name: 'add_hook';
|
|
||||||
hookType: HookType;
|
|
||||||
fn: HookFn;
|
|
||||||
timeout: number | undefined;
|
|
||||||
} | {
|
|
||||||
asyncError: Error;
|
|
||||||
name: 'add_test';
|
|
||||||
testName: TestName;
|
|
||||||
fn?: TestFn;
|
|
||||||
mode?: TestMode;
|
|
||||||
timeout: number | undefined;
|
|
||||||
} | {
|
|
||||||
name: 'error';
|
|
||||||
error: Exception;
|
|
||||||
};
|
|
||||||
export declare type AsyncEvent = {
|
|
||||||
name: 'setup';
|
|
||||||
testNamePattern?: string;
|
|
||||||
parentProcess: Process;
|
|
||||||
} | {
|
|
||||||
name: 'include_test_location_in_result';
|
|
||||||
} | {
|
|
||||||
name: 'hook_start';
|
|
||||||
hook: Hook;
|
|
||||||
} | {
|
|
||||||
name: 'hook_success';
|
|
||||||
describeBlock?: DescribeBlock;
|
|
||||||
test?: TestEntry;
|
|
||||||
hook: Hook;
|
|
||||||
} | {
|
|
||||||
name: 'hook_failure';
|
|
||||||
error: string | Exception;
|
|
||||||
describeBlock?: DescribeBlock;
|
|
||||||
test?: TestEntry;
|
|
||||||
hook: Hook;
|
|
||||||
} | {
|
|
||||||
name: 'test_fn_start';
|
|
||||||
test: TestEntry;
|
|
||||||
} | {
|
|
||||||
name: 'test_fn_success';
|
|
||||||
test: TestEntry;
|
|
||||||
} | {
|
|
||||||
name: 'test_fn_failure';
|
|
||||||
error: Exception;
|
|
||||||
test: TestEntry;
|
|
||||||
} | {
|
|
||||||
name: 'test_retry';
|
|
||||||
test: TestEntry;
|
|
||||||
} | {
|
|
||||||
name: 'test_start';
|
|
||||||
test: TestEntry;
|
|
||||||
} | {
|
|
||||||
name: 'test_skip';
|
|
||||||
test: TestEntry;
|
|
||||||
} | {
|
|
||||||
name: 'test_todo';
|
|
||||||
test: TestEntry;
|
|
||||||
} | {
|
|
||||||
name: 'test_done';
|
|
||||||
test: TestEntry;
|
|
||||||
} | {
|
|
||||||
name: 'run_describe_start';
|
|
||||||
describeBlock: DescribeBlock;
|
|
||||||
} | {
|
|
||||||
name: 'run_describe_finish';
|
|
||||||
describeBlock: DescribeBlock;
|
|
||||||
} | {
|
|
||||||
name: 'run_start';
|
|
||||||
} | {
|
|
||||||
name: 'run_finish';
|
|
||||||
} | {
|
|
||||||
name: 'teardown';
|
|
||||||
};
|
|
||||||
export declare type TestStatus = 'skip' | 'done' | 'todo';
|
|
||||||
export declare type TestResult = {
|
|
||||||
duration?: number | null;
|
|
||||||
errors: Array<FormattedError>;
|
|
||||||
invocations: number;
|
|
||||||
status: TestStatus;
|
|
||||||
location?: {
|
|
||||||
column: number;
|
|
||||||
line: number;
|
|
||||||
} | null;
|
|
||||||
testPath: Array<TestName | BlockName>;
|
|
||||||
};
|
|
||||||
export declare type RunResult = {
|
|
||||||
unhandledErrors: Array<FormattedError>;
|
|
||||||
testResults: TestResults;
|
|
||||||
};
|
|
||||||
export declare type TestResults = Array<TestResult>;
|
|
||||||
export declare type GlobalErrorHandlers = {
|
|
||||||
uncaughtException: Array<(exception: Exception) => void>;
|
|
||||||
unhandledRejection: Array<(exception: Exception, promise: Promise<any>) => void>;
|
|
||||||
};
|
|
||||||
export declare type State = {
|
|
||||||
currentDescribeBlock: DescribeBlock;
|
|
||||||
currentlyRunningTest?: TestEntry | null;
|
|
||||||
expand?: boolean;
|
|
||||||
hasFocusedTests: boolean;
|
|
||||||
originalGlobalErrorHandlers?: GlobalErrorHandlers;
|
|
||||||
parentProcess: Process | null;
|
|
||||||
rootDescribeBlock: DescribeBlock;
|
|
||||||
testNamePattern?: RegExp | null;
|
|
||||||
testTimeout: number;
|
|
||||||
unhandledErrors: Array<Exception>;
|
|
||||||
includeTestLocationInResult: boolean;
|
|
||||||
};
|
|
||||||
export declare type DescribeBlock = {
|
|
||||||
children: Array<DescribeBlock>;
|
|
||||||
hooks: Array<Hook>;
|
|
||||||
mode: BlockMode;
|
|
||||||
name: BlockName;
|
|
||||||
parent?: DescribeBlock;
|
|
||||||
tests: Array<TestEntry>;
|
|
||||||
};
|
|
||||||
export declare type TestError = Exception | Array<[Exception | undefined, Exception]>;
|
|
||||||
export declare type TestEntry = {
|
|
||||||
asyncError: Exception;
|
|
||||||
errors: TestError;
|
|
||||||
fn?: TestFn;
|
|
||||||
invocations: number;
|
|
||||||
mode: TestMode;
|
|
||||||
name: TestName;
|
|
||||||
parent: DescribeBlock;
|
|
||||||
startedAt?: number | null;
|
|
||||||
duration?: number | null;
|
|
||||||
status?: TestStatus | null;
|
|
||||||
timeout?: number;
|
|
||||||
};
|
|
||||||
export {};
|
|
||||||
//# sourceMappingURL=Circus.d.ts.map
|
|
|
@ -1,421 +0,0 @@
|
||||||
/// <reference types="node" />
|
|
||||||
/**
|
|
||||||
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* This source code is licensed under the MIT license found in the
|
|
||||||
* LICENSE file in the root directory of this source tree.
|
|
||||||
*/
|
|
||||||
/// <reference types="node" />
|
|
||||||
import { Arguments } from 'yargs';
|
|
||||||
import { ReportOptions } from 'istanbul-reports';
|
|
||||||
import chalk = require('chalk');
|
|
||||||
declare type CoverageProvider = 'babel' | 'v8';
|
|
||||||
export declare type Path = string;
|
|
||||||
export declare type Glob = string;
|
|
||||||
export declare type HasteConfig = {
|
|
||||||
computeSha1?: boolean;
|
|
||||||
defaultPlatform?: string | null;
|
|
||||||
hasteImplModulePath?: string;
|
|
||||||
platforms?: Array<string>;
|
|
||||||
providesModuleNodeModules: Array<string>;
|
|
||||||
throwOnModuleCollision?: boolean;
|
|
||||||
};
|
|
||||||
export declare type ReporterConfig = [string, Record<string, unknown>];
|
|
||||||
export declare type TransformerConfig = [string, Record<string, unknown>];
|
|
||||||
export interface ConfigGlobals {
|
|
||||||
[K: string]: unknown;
|
|
||||||
}
|
|
||||||
export declare type DefaultOptions = {
|
|
||||||
automock: boolean;
|
|
||||||
bail: number;
|
|
||||||
browser: boolean;
|
|
||||||
cache: boolean;
|
|
||||||
cacheDirectory: Path;
|
|
||||||
changedFilesWithAncestor: boolean;
|
|
||||||
clearMocks: boolean;
|
|
||||||
collectCoverage: boolean;
|
|
||||||
coveragePathIgnorePatterns: Array<string>;
|
|
||||||
coverageReporters: Array<string | [string, any]>;
|
|
||||||
coverageProvider: CoverageProvider;
|
|
||||||
errorOnDeprecated: boolean;
|
|
||||||
expand: boolean;
|
|
||||||
forceCoverageMatch: Array<Glob>;
|
|
||||||
globals: ConfigGlobals;
|
|
||||||
haste: HasteConfig;
|
|
||||||
maxConcurrency: number;
|
|
||||||
maxWorkers: number | string;
|
|
||||||
moduleDirectories: Array<string>;
|
|
||||||
moduleFileExtensions: Array<string>;
|
|
||||||
moduleNameMapper: Record<string, string | Array<string>>;
|
|
||||||
modulePathIgnorePatterns: Array<string>;
|
|
||||||
noStackTrace: boolean;
|
|
||||||
notify: boolean;
|
|
||||||
notifyMode: NotifyMode;
|
|
||||||
prettierPath: string;
|
|
||||||
resetMocks: boolean;
|
|
||||||
resetModules: boolean;
|
|
||||||
restoreMocks: boolean;
|
|
||||||
roots: Array<Path>;
|
|
||||||
runTestsByPath: boolean;
|
|
||||||
runner: 'jest-runner';
|
|
||||||
setupFiles: Array<Path>;
|
|
||||||
setupFilesAfterEnv: Array<Path>;
|
|
||||||
skipFilter: boolean;
|
|
||||||
snapshotSerializers: Array<Path>;
|
|
||||||
testEnvironment: string;
|
|
||||||
testEnvironmentOptions: Record<string, any>;
|
|
||||||
testFailureExitCode: string | number;
|
|
||||||
testLocationInResults: boolean;
|
|
||||||
testMatch: Array<Glob>;
|
|
||||||
testPathIgnorePatterns: Array<string>;
|
|
||||||
testRegex: Array<string>;
|
|
||||||
testRunner: string;
|
|
||||||
testSequencer: string;
|
|
||||||
testURL: string;
|
|
||||||
timers: 'real' | 'fake';
|
|
||||||
transformIgnorePatterns: Array<Glob>;
|
|
||||||
useStderr: boolean;
|
|
||||||
watch: boolean;
|
|
||||||
watchPathIgnorePatterns: Array<string>;
|
|
||||||
watchman: boolean;
|
|
||||||
};
|
|
||||||
export declare type DisplayName = string | {
|
|
||||||
name: string;
|
|
||||||
color: typeof chalk.Color;
|
|
||||||
};
|
|
||||||
export declare type InitialOptionsWithRootDir = InitialOptions & Required<Pick<InitialOptions, 'rootDir'>>;
|
|
||||||
export declare type InitialOptions = Partial<{
|
|
||||||
automock: boolean;
|
|
||||||
bail: boolean | number;
|
|
||||||
browser: boolean;
|
|
||||||
cache: boolean;
|
|
||||||
cacheDirectory: Path;
|
|
||||||
clearMocks: boolean;
|
|
||||||
changedFilesWithAncestor: boolean;
|
|
||||||
changedSince: string;
|
|
||||||
collectCoverage: boolean;
|
|
||||||
collectCoverageFrom: Array<Glob>;
|
|
||||||
collectCoverageOnlyFrom: {
|
|
||||||
[key: string]: boolean;
|
|
||||||
};
|
|
||||||
coverageDirectory: string;
|
|
||||||
coveragePathIgnorePatterns: Array<string>;
|
|
||||||
coverageProvider: CoverageProvider;
|
|
||||||
coverageReporters: Array<string>;
|
|
||||||
coverageThreshold: {
|
|
||||||
global: {
|
|
||||||
[key: string]: number;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
dependencyExtractor: string;
|
|
||||||
detectLeaks: boolean;
|
|
||||||
detectOpenHandles: boolean;
|
|
||||||
displayName: DisplayName;
|
|
||||||
expand: boolean;
|
|
||||||
extraGlobals: Array<string>;
|
|
||||||
filter: Path;
|
|
||||||
findRelatedTests: boolean;
|
|
||||||
forceCoverageMatch: Array<Glob>;
|
|
||||||
forceExit: boolean;
|
|
||||||
json: boolean;
|
|
||||||
globals: ConfigGlobals;
|
|
||||||
globalSetup: string | null | undefined;
|
|
||||||
globalTeardown: string | null | undefined;
|
|
||||||
haste: HasteConfig;
|
|
||||||
reporters: Array<string | ReporterConfig>;
|
|
||||||
logHeapUsage: boolean;
|
|
||||||
lastCommit: boolean;
|
|
||||||
listTests: boolean;
|
|
||||||
mapCoverage: boolean;
|
|
||||||
maxConcurrency: number;
|
|
||||||
maxWorkers: number | string;
|
|
||||||
moduleDirectories: Array<string>;
|
|
||||||
moduleFileExtensions: Array<string>;
|
|
||||||
moduleLoader: Path;
|
|
||||||
moduleNameMapper: {
|
|
||||||
[key: string]: string | Array<string>;
|
|
||||||
};
|
|
||||||
modulePathIgnorePatterns: Array<string>;
|
|
||||||
modulePaths: Array<string>;
|
|
||||||
name: string;
|
|
||||||
noStackTrace: boolean;
|
|
||||||
notify: boolean;
|
|
||||||
notifyMode: string;
|
|
||||||
onlyChanged: boolean;
|
|
||||||
outputFile: Path;
|
|
||||||
passWithNoTests: boolean;
|
|
||||||
preprocessorIgnorePatterns: Array<Glob>;
|
|
||||||
preset: string | null | undefined;
|
|
||||||
prettierPath: string | null | undefined;
|
|
||||||
projects: Array<Glob>;
|
|
||||||
replname: string | null | undefined;
|
|
||||||
resetMocks: boolean;
|
|
||||||
resetModules: boolean;
|
|
||||||
resolver: Path | null | undefined;
|
|
||||||
restoreMocks: boolean;
|
|
||||||
rootDir: Path;
|
|
||||||
roots: Array<Path>;
|
|
||||||
runner: string;
|
|
||||||
runTestsByPath: boolean;
|
|
||||||
scriptPreprocessor: string;
|
|
||||||
setupFiles: Array<Path>;
|
|
||||||
setupTestFrameworkScriptFile: Path;
|
|
||||||
setupFilesAfterEnv: Array<Path>;
|
|
||||||
silent: boolean;
|
|
||||||
skipFilter: boolean;
|
|
||||||
skipNodeResolution: boolean;
|
|
||||||
snapshotResolver: Path;
|
|
||||||
snapshotSerializers: Array<Path>;
|
|
||||||
errorOnDeprecated: boolean;
|
|
||||||
testEnvironment: string;
|
|
||||||
testEnvironmentOptions: Record<string, any>;
|
|
||||||
testFailureExitCode: string | number;
|
|
||||||
testLocationInResults: boolean;
|
|
||||||
testMatch: Array<Glob>;
|
|
||||||
testNamePattern: string;
|
|
||||||
testPathDirs: Array<Path>;
|
|
||||||
testPathIgnorePatterns: Array<string>;
|
|
||||||
testRegex: string | Array<string>;
|
|
||||||
testResultsProcessor: string;
|
|
||||||
testRunner: string;
|
|
||||||
testSequencer: string;
|
|
||||||
testURL: string;
|
|
||||||
testTimeout: number;
|
|
||||||
timers: 'real' | 'fake';
|
|
||||||
transform: {
|
|
||||||
[regex: string]: Path | TransformerConfig;
|
|
||||||
};
|
|
||||||
transformIgnorePatterns: Array<Glob>;
|
|
||||||
watchPathIgnorePatterns: Array<string>;
|
|
||||||
unmockedModulePathPatterns: Array<string>;
|
|
||||||
updateSnapshot: boolean;
|
|
||||||
useStderr: boolean;
|
|
||||||
verbose?: boolean;
|
|
||||||
watch: boolean;
|
|
||||||
watchAll: boolean;
|
|
||||||
watchman: boolean;
|
|
||||||
watchPlugins: Array<string | [string, Record<string, any>]>;
|
|
||||||
}>;
|
|
||||||
export declare type SnapshotUpdateState = 'all' | 'new' | 'none';
|
|
||||||
declare type NotifyMode = 'always' | 'failure' | 'success' | 'change' | 'success-change' | 'failure-change';
|
|
||||||
export declare type CoverageThresholdValue = {
|
|
||||||
branches?: number;
|
|
||||||
functions?: number;
|
|
||||||
lines?: number;
|
|
||||||
statements?: number;
|
|
||||||
};
|
|
||||||
declare type CoverageThreshold = {
|
|
||||||
[path: string]: CoverageThresholdValue;
|
|
||||||
global: CoverageThresholdValue;
|
|
||||||
};
|
|
||||||
export declare type GlobalConfig = {
|
|
||||||
bail: number;
|
|
||||||
changedSince?: string;
|
|
||||||
changedFilesWithAncestor: boolean;
|
|
||||||
collectCoverage: boolean;
|
|
||||||
collectCoverageFrom: Array<Glob>;
|
|
||||||
collectCoverageOnlyFrom?: {
|
|
||||||
[key: string]: boolean;
|
|
||||||
};
|
|
||||||
coverageDirectory: string;
|
|
||||||
coveragePathIgnorePatterns?: Array<string>;
|
|
||||||
coverageProvider: CoverageProvider;
|
|
||||||
coverageReporters: Array<keyof ReportOptions | [keyof ReportOptions, any]>;
|
|
||||||
coverageThreshold?: CoverageThreshold;
|
|
||||||
detectLeaks: boolean;
|
|
||||||
detectOpenHandles: boolean;
|
|
||||||
enabledTestsMap?: {
|
|
||||||
[key: string]: {
|
|
||||||
[key: string]: boolean;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
expand: boolean;
|
|
||||||
filter?: Path;
|
|
||||||
findRelatedTests: boolean;
|
|
||||||
forceExit: boolean;
|
|
||||||
json: boolean;
|
|
||||||
globalSetup?: string;
|
|
||||||
globalTeardown?: string;
|
|
||||||
lastCommit: boolean;
|
|
||||||
logHeapUsage: boolean;
|
|
||||||
listTests: boolean;
|
|
||||||
maxConcurrency: number;
|
|
||||||
maxWorkers: number;
|
|
||||||
noStackTrace: boolean;
|
|
||||||
nonFlagArgs: Array<string>;
|
|
||||||
noSCM?: boolean;
|
|
||||||
notify: boolean;
|
|
||||||
notifyMode: NotifyMode;
|
|
||||||
outputFile?: Path;
|
|
||||||
onlyChanged: boolean;
|
|
||||||
onlyFailures: boolean;
|
|
||||||
passWithNoTests: boolean;
|
|
||||||
projects: Array<Glob>;
|
|
||||||
replname?: string;
|
|
||||||
reporters?: Array<string | ReporterConfig>;
|
|
||||||
runTestsByPath: boolean;
|
|
||||||
rootDir: Path;
|
|
||||||
silent?: boolean;
|
|
||||||
skipFilter: boolean;
|
|
||||||
errorOnDeprecated: boolean;
|
|
||||||
testFailureExitCode: number;
|
|
||||||
testNamePattern?: string;
|
|
||||||
testPathPattern: string;
|
|
||||||
testResultsProcessor?: string;
|
|
||||||
testSequencer: string;
|
|
||||||
testTimeout?: number;
|
|
||||||
updateSnapshot: SnapshotUpdateState;
|
|
||||||
useStderr: boolean;
|
|
||||||
verbose?: boolean;
|
|
||||||
watch: boolean;
|
|
||||||
watchAll: boolean;
|
|
||||||
watchman: boolean;
|
|
||||||
watchPlugins?: Array<{
|
|
||||||
path: string;
|
|
||||||
config: Record<string, any>;
|
|
||||||
}> | null;
|
|
||||||
};
|
|
||||||
export declare type ProjectConfig = {
|
|
||||||
automock: boolean;
|
|
||||||
browser: boolean;
|
|
||||||
cache: boolean;
|
|
||||||
cacheDirectory: Path;
|
|
||||||
clearMocks: boolean;
|
|
||||||
coveragePathIgnorePatterns: Array<string>;
|
|
||||||
cwd: Path;
|
|
||||||
dependencyExtractor?: string;
|
|
||||||
detectLeaks: boolean;
|
|
||||||
detectOpenHandles: boolean;
|
|
||||||
displayName?: DisplayName;
|
|
||||||
errorOnDeprecated: boolean;
|
|
||||||
extraGlobals: Array<keyof NodeJS.Global>;
|
|
||||||
filter?: Path;
|
|
||||||
forceCoverageMatch: Array<Glob>;
|
|
||||||
globalSetup?: string;
|
|
||||||
globalTeardown?: string;
|
|
||||||
globals: ConfigGlobals;
|
|
||||||
haste: HasteConfig;
|
|
||||||
moduleDirectories: Array<string>;
|
|
||||||
moduleFileExtensions: Array<string>;
|
|
||||||
moduleLoader?: Path;
|
|
||||||
moduleNameMapper: Array<[string, string]>;
|
|
||||||
modulePathIgnorePatterns: Array<string>;
|
|
||||||
modulePaths?: Array<string>;
|
|
||||||
name: string;
|
|
||||||
prettierPath: string;
|
|
||||||
resetMocks: boolean;
|
|
||||||
resetModules: boolean;
|
|
||||||
resolver?: Path;
|
|
||||||
restoreMocks: boolean;
|
|
||||||
rootDir: Path;
|
|
||||||
roots: Array<Path>;
|
|
||||||
runner: string;
|
|
||||||
setupFiles: Array<Path>;
|
|
||||||
setupFilesAfterEnv: Array<Path>;
|
|
||||||
skipFilter: boolean;
|
|
||||||
skipNodeResolution?: boolean;
|
|
||||||
snapshotResolver?: Path;
|
|
||||||
snapshotSerializers: Array<Path>;
|
|
||||||
testEnvironment: string;
|
|
||||||
testEnvironmentOptions: Record<string, any>;
|
|
||||||
testMatch: Array<Glob>;
|
|
||||||
testLocationInResults: boolean;
|
|
||||||
testPathIgnorePatterns: Array<string>;
|
|
||||||
testRegex: Array<string | RegExp>;
|
|
||||||
testRunner: string;
|
|
||||||
testURL: string;
|
|
||||||
timers: 'real' | 'fake';
|
|
||||||
transform: Array<[string, Path, Record<string, unknown>]>;
|
|
||||||
transformIgnorePatterns: Array<Glob>;
|
|
||||||
watchPathIgnorePatterns: Array<string>;
|
|
||||||
unmockedModulePathPatterns?: Array<string>;
|
|
||||||
};
|
|
||||||
export declare type Argv = Arguments<Partial<{
|
|
||||||
all: boolean;
|
|
||||||
automock: boolean;
|
|
||||||
bail: boolean | number;
|
|
||||||
browser: boolean;
|
|
||||||
cache: boolean;
|
|
||||||
cacheDirectory: string;
|
|
||||||
changedFilesWithAncestor: boolean;
|
|
||||||
changedSince: string;
|
|
||||||
ci: boolean;
|
|
||||||
clearCache: boolean;
|
|
||||||
clearMocks: boolean;
|
|
||||||
collectCoverage: boolean;
|
|
||||||
collectCoverageFrom: string;
|
|
||||||
collectCoverageOnlyFrom: Array<string>;
|
|
||||||
color: boolean;
|
|
||||||
colors: boolean;
|
|
||||||
config: string;
|
|
||||||
coverage: boolean;
|
|
||||||
coverageDirectory: string;
|
|
||||||
coveragePathIgnorePatterns: Array<string>;
|
|
||||||
coverageReporters: Array<string>;
|
|
||||||
coverageThreshold: string;
|
|
||||||
debug: boolean;
|
|
||||||
env: string;
|
|
||||||
expand: boolean;
|
|
||||||
findRelatedTests: boolean;
|
|
||||||
forceExit: boolean;
|
|
||||||
globals: string;
|
|
||||||
globalSetup: string | null | undefined;
|
|
||||||
globalTeardown: string | null | undefined;
|
|
||||||
haste: string;
|
|
||||||
init: boolean;
|
|
||||||
json: boolean;
|
|
||||||
lastCommit: boolean;
|
|
||||||
logHeapUsage: boolean;
|
|
||||||
maxWorkers: number | string;
|
|
||||||
moduleDirectories: Array<string>;
|
|
||||||
moduleFileExtensions: Array<string>;
|
|
||||||
moduleNameMapper: string;
|
|
||||||
modulePathIgnorePatterns: Array<string>;
|
|
||||||
modulePaths: Array<string>;
|
|
||||||
noStackTrace: boolean;
|
|
||||||
notify: boolean;
|
|
||||||
notifyMode: string;
|
|
||||||
onlyChanged: boolean;
|
|
||||||
outputFile: string;
|
|
||||||
preset: string | null | undefined;
|
|
||||||
projects: Array<string>;
|
|
||||||
prettierPath: string | null | undefined;
|
|
||||||
resetMocks: boolean;
|
|
||||||
resetModules: boolean;
|
|
||||||
resolver: string | null | undefined;
|
|
||||||
restoreMocks: boolean;
|
|
||||||
rootDir: string;
|
|
||||||
roots: Array<string>;
|
|
||||||
runInBand: boolean;
|
|
||||||
setupFiles: Array<string>;
|
|
||||||
setupFilesAfterEnv: Array<string>;
|
|
||||||
showConfig: boolean;
|
|
||||||
silent: boolean;
|
|
||||||
snapshotSerializers: Array<string>;
|
|
||||||
testEnvironment: string;
|
|
||||||
testFailureExitCode: string | null | undefined;
|
|
||||||
testMatch: Array<string>;
|
|
||||||
testNamePattern: string;
|
|
||||||
testPathIgnorePatterns: Array<string>;
|
|
||||||
testPathPattern: Array<string>;
|
|
||||||
testRegex: string | Array<string>;
|
|
||||||
testResultsProcessor: string;
|
|
||||||
testRunner: string;
|
|
||||||
testSequencer: string;
|
|
||||||
testURL: string;
|
|
||||||
testTimeout: number | null | undefined;
|
|
||||||
timers: string;
|
|
||||||
transform: string;
|
|
||||||
transformIgnorePatterns: Array<string>;
|
|
||||||
unmockedModulePathPatterns: Array<string> | null | undefined;
|
|
||||||
updateSnapshot: boolean;
|
|
||||||
useStderr: boolean;
|
|
||||||
verbose: boolean;
|
|
||||||
version: boolean;
|
|
||||||
watch: boolean;
|
|
||||||
watchAll: boolean;
|
|
||||||
watchman: boolean;
|
|
||||||
watchPathIgnorePatterns: Array<string>;
|
|
||||||
}>>;
|
|
||||||
export {};
|
|
||||||
//# sourceMappingURL=Config.d.ts.map
|
|
|
@ -1,78 +0,0 @@
|
||||||
/// <reference types="node" />
|
|
||||||
/**
|
|
||||||
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* This source code is licensed under the MIT license found in the
|
|
||||||
* LICENSE file in the root directory of this source tree.
|
|
||||||
*/
|
|
||||||
/// <reference types="node" />
|
|
||||||
import { CoverageMapData } from 'istanbul-lib-coverage';
|
|
||||||
export declare type DoneFn = (reason?: string | Error) => void;
|
|
||||||
export declare type TestName = string;
|
|
||||||
export declare type TestFn = (done?: DoneFn) => Promise<any> | void | undefined;
|
|
||||||
export declare type BlockFn = () => void;
|
|
||||||
export declare type BlockName = string;
|
|
||||||
export declare type Col = unknown;
|
|
||||||
export declare type Row = Array<Col>;
|
|
||||||
export declare type Table = Array<Row>;
|
|
||||||
export declare type ArrayTable = Table | Row;
|
|
||||||
export declare type TemplateTable = TemplateStringsArray;
|
|
||||||
export declare type TemplateData = Array<unknown>;
|
|
||||||
export declare type EachTable = ArrayTable | TemplateTable;
|
|
||||||
export declare type EachTestFn = (...args: Array<any>) => Promise<any> | void | undefined;
|
|
||||||
declare type Jasmine = {
|
|
||||||
_DEFAULT_TIMEOUT_INTERVAL?: number;
|
|
||||||
addMatchers: Function;
|
|
||||||
};
|
|
||||||
declare type Each = (table: EachTable, ...taggedTemplateData: Array<unknown>) => (title: string, test: EachTestFn, timeout?: number) => void;
|
|
||||||
export interface ItBase {
|
|
||||||
(testName: TestName, fn: TestFn, timeout?: number): void;
|
|
||||||
each: Each;
|
|
||||||
}
|
|
||||||
export interface It extends ItBase {
|
|
||||||
only: ItBase;
|
|
||||||
skip: ItBase;
|
|
||||||
todo: (testName: TestName, ...rest: Array<any>) => void;
|
|
||||||
}
|
|
||||||
export interface ItConcurrentBase {
|
|
||||||
(testName: string, testFn: () => Promise<any>, timeout?: number): void;
|
|
||||||
}
|
|
||||||
export interface ItConcurrentExtended extends ItConcurrentBase {
|
|
||||||
only: ItConcurrentBase;
|
|
||||||
skip: ItConcurrentBase;
|
|
||||||
}
|
|
||||||
export interface ItConcurrent extends It {
|
|
||||||
concurrent: ItConcurrentExtended;
|
|
||||||
}
|
|
||||||
export interface DescribeBase {
|
|
||||||
(blockName: BlockName, blockFn: BlockFn): void;
|
|
||||||
each: Each;
|
|
||||||
}
|
|
||||||
export interface Describe extends DescribeBase {
|
|
||||||
only: DescribeBase;
|
|
||||||
skip: DescribeBase;
|
|
||||||
}
|
|
||||||
export interface GlobalAdditions {
|
|
||||||
it: ItConcurrent;
|
|
||||||
test: ItConcurrent;
|
|
||||||
fit: ItBase & {
|
|
||||||
concurrent?: ItConcurrentBase;
|
|
||||||
};
|
|
||||||
xit: ItBase;
|
|
||||||
xtest: ItBase;
|
|
||||||
describe: Describe;
|
|
||||||
xdescribe: DescribeBase;
|
|
||||||
fdescribe: DescribeBase;
|
|
||||||
__coverage__: CoverageMapData;
|
|
||||||
jasmine: Jasmine;
|
|
||||||
fail: () => void;
|
|
||||||
pending: () => void;
|
|
||||||
spyOn: () => void;
|
|
||||||
spyOnProperty: () => void;
|
|
||||||
}
|
|
||||||
declare type NodeGlobalWithoutAdditions = Pick<NodeJS.Global, Exclude<keyof NodeJS.Global, keyof GlobalAdditions>>;
|
|
||||||
export interface Global extends GlobalAdditions, NodeGlobalWithoutAdditions {
|
|
||||||
[extras: string]: any;
|
|
||||||
}
|
|
||||||
export {};
|
|
||||||
//# sourceMappingURL=Global.d.ts.map
|
|
|
@ -1,31 +0,0 @@
|
||||||
/**
|
|
||||||
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* This source code is licensed under the MIT license found in the
|
|
||||||
* LICENSE file in the root directory of this source tree.
|
|
||||||
*/
|
|
||||||
export declare type Milliseconds = number;
|
|
||||||
declare type Status = 'passed' | 'failed' | 'skipped' | 'pending' | 'todo' | 'disabled';
|
|
||||||
declare type Callsite = {
|
|
||||||
column: number;
|
|
||||||
line: number;
|
|
||||||
};
|
|
||||||
export declare type AssertionResult = {
|
|
||||||
ancestorTitles: Array<string>;
|
|
||||||
duration?: Milliseconds | null;
|
|
||||||
failureMessages: Array<string>;
|
|
||||||
fullName: string;
|
|
||||||
invocations?: number;
|
|
||||||
location?: Callsite | null;
|
|
||||||
numPassingAsserts: number;
|
|
||||||
status: Status;
|
|
||||||
title: string;
|
|
||||||
};
|
|
||||||
export declare type SerializableError = {
|
|
||||||
code?: unknown;
|
|
||||||
message: string;
|
|
||||||
stack: string | null | undefined;
|
|
||||||
type?: string;
|
|
||||||
};
|
|
||||||
export {};
|
|
||||||
//# sourceMappingURL=TestResult.d.ts.map
|
|
|
@ -1,13 +0,0 @@
|
||||||
/**
|
|
||||||
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* This source code is licensed under the MIT license found in the
|
|
||||||
* LICENSE file in the root directory of this source tree.
|
|
||||||
*/
|
|
||||||
export declare type TransformResult = {
|
|
||||||
code: string;
|
|
||||||
originalCode: string;
|
|
||||||
mapCoverage: boolean;
|
|
||||||
sourceMapPath: string | null;
|
|
||||||
};
|
|
||||||
//# sourceMappingURL=Transform.d.ts.map
|
|
|
@ -1,13 +0,0 @@
|
||||||
/**
|
|
||||||
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* This source code is licensed under the MIT license found in the
|
|
||||||
* LICENSE file in the root directory of this source tree.
|
|
||||||
*/
|
|
||||||
import * as Circus from './Circus';
|
|
||||||
import * as Config from './Config';
|
|
||||||
import * as Global from './Global';
|
|
||||||
import * as TestResult from './TestResult';
|
|
||||||
import * as TransformTypes from './Transform';
|
|
||||||
export { Circus, Config, Global, TestResult, TransformTypes };
|
|
||||||
//# sourceMappingURL=index.d.ts.map
|
|
|
@ -1,35 +1,24 @@
|
||||||
{
|
{
|
||||||
"name": "@jest/types",
|
"name": "@jest/types",
|
||||||
"version": "25.3.0",
|
"version": "24.9.0",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/facebook/jest.git",
|
"url": "https://github.com/facebook/jest.git",
|
||||||
"directory": "packages/jest-types"
|
"directory": "packages/jest-types"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 8.3"
|
"node": ">= 6"
|
||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"main": "build/index.js",
|
"main": "build/index.js",
|
||||||
"types": "build/index.d.ts",
|
"types": "build/index.d.ts",
|
||||||
"typesVersions": {
|
|
||||||
"<3.8": {
|
|
||||||
"build/*": [
|
|
||||||
"build/ts3.4/*"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/istanbul-lib-coverage": "^2.0.0",
|
"@types/istanbul-lib-coverage": "^2.0.0",
|
||||||
"@types/istanbul-reports": "^1.1.1",
|
"@types/istanbul-reports": "^1.1.1",
|
||||||
"@types/yargs": "^15.0.0",
|
"@types/yargs": "^13.0.0"
|
||||||
"chalk": "^3.0.0"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"@types/node": "*"
|
|
||||||
},
|
},
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"access": "public"
|
"access": "public"
|
||||||
},
|
},
|
||||||
"gitHead": "45a4936d96d74cdee6b91122a51a556e3ebe6dc8"
|
"gitHead": "9ad0f4bc6b8bdd94989804226c28c9960d9da7d1"
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,12 +5,12 @@
|
||||||
This package contains type definitions for yargs (https://github.com/chevex/yargs).
|
This package contains type definitions for yargs (https://github.com/chevex/yargs).
|
||||||
|
|
||||||
# Details
|
# Details
|
||||||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/yargs.
|
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/yargs
|
||||||
|
|
||||||
### Additional Details
|
Additional Details
|
||||||
* Last updated: Tue, 25 Feb 2020 20:34:01 GMT
|
* Last updated: Wed, 31 Jul 2019 17:12:04 GMT
|
||||||
* Dependencies: [@types/yargs-parser](https://npmjs.com/package/@types/yargs-parser)
|
* Dependencies: @types/yargs-parser
|
||||||
* Global values: none
|
* Global values: none
|
||||||
|
|
||||||
# Credits
|
# Credits
|
||||||
These definitions were written by [Martin Poelstra](https://github.com/poelstra), [Mizunashi Mana](https://github.com/mizunashi-mana), [Jeffery Grajkowski](https://github.com/pushplay), [Jeff Kenney](https://github.com/jeffkenney), [Jimi (Dimitris) Charalampidis](https://github.com/JimiC), [Steffen Viken Valvåg](https://github.com/steffenvv), [Emily Marigold Klassen](https://github.com/forivall), [ExE Boss](https://github.com/ExE-Boss), and [Aankhen](https://github.com/Aankhen).
|
These definitions were written by Martin Poelstra <https://github.com/poelstra>, Mizunashi Mana <https://github.com/mizunashi-mana>, Jeffery Grajkowski <https://github.com/pushplay>, Jeff Kenney <https://github.com/jeffkenney>, Jimi (Dimitris) Charalampidis <https://github.com/JimiC>, Steffen Viken Valvåg <https://github.com/steffenvv>, and Emily Marigold Klassen <https://github.com/forivall>.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Type definitions for yargs 15.0
|
// Type definitions for yargs 13.0
|
||||||
// Project: https://github.com/chevex/yargs, https://yargs.js.org
|
// Project: https://github.com/chevex/yargs, https://yargs.js.org
|
||||||
// Definitions by: Martin Poelstra <https://github.com/poelstra>
|
// Definitions by: Martin Poelstra <https://github.com/poelstra>
|
||||||
// Mizunashi Mana <https://github.com/mizunashi-mana>
|
// Mizunashi Mana <https://github.com/mizunashi-mana>
|
||||||
|
@ -7,8 +7,6 @@
|
||||||
// Jimi (Dimitris) Charalampidis <https://github.com/JimiC>
|
// Jimi (Dimitris) Charalampidis <https://github.com/JimiC>
|
||||||
// Steffen Viken Valvåg <https://github.com/steffenvv>
|
// Steffen Viken Valvåg <https://github.com/steffenvv>
|
||||||
// Emily Marigold Klassen <https://github.com/forivall>
|
// Emily Marigold Klassen <https://github.com/forivall>
|
||||||
// ExE Boss <https://github.com/ExE-Boss>
|
|
||||||
// Aankhen <https://github.com/Aankhen>
|
|
||||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||||
// TypeScript Version: 3.0
|
// TypeScript Version: 3.0
|
||||||
|
|
||||||
|
@ -29,21 +27,12 @@
|
||||||
import { DetailedArguments, Configuration } from 'yargs-parser';
|
import { DetailedArguments, Configuration } from 'yargs-parser';
|
||||||
|
|
||||||
declare namespace yargs {
|
declare namespace yargs {
|
||||||
type BuilderCallback<T, R> = ((args: Argv<T>) => PromiseLike<Argv<R>>) | ((args: Argv<T>) => Argv<R>) | ((args: Argv<T>) => void);
|
// The type parameter T is the expected shape of the parsed options.
|
||||||
|
// Arguments<T> is those options plus _ and $0, and an indexer falling
|
||||||
type ParserConfigurationOptions = Configuration & {
|
// back to unknown for unknown options.
|
||||||
/** Sort commands alphabetically. Default is `false` */
|
//
|
||||||
'sort-commands': boolean;
|
// For the return type / argv property, we create a mapped type over
|
||||||
};
|
// Arguments<T> to simplify the inferred type signature in client code.
|
||||||
|
|
||||||
/**
|
|
||||||
* The type parameter `T` is the expected shape of the parsed options.
|
|
||||||
* `Arguments<T>` is those options plus `_` and `$0`, and an indexer falling
|
|
||||||
* back to `unknown` for unknown options.
|
|
||||||
*
|
|
||||||
* For the return type / `argv` property, we create a mapped type over
|
|
||||||
* `Arguments<T>` to simplify the inferred type signature in client code.
|
|
||||||
*/
|
|
||||||
interface Argv<T = {}> {
|
interface Argv<T = {}> {
|
||||||
(): { [key in keyof Arguments<T>]: Arguments<T>[key] };
|
(): { [key in keyof Arguments<T>]: Arguments<T>[key] };
|
||||||
(args: ReadonlyArray<string>, cwd?: string): Argv<T>;
|
(args: ReadonlyArray<string>, cwd?: string): Argv<T>;
|
||||||
|
@ -141,14 +130,12 @@ declare namespace yargs {
|
||||||
* Set `description` to false to create a hidden command. Hidden commands don't show up in the help output and aren't available for completion.
|
* Set `description` to false to create a hidden command. Hidden commands don't show up in the help output and aren't available for completion.
|
||||||
* @param [builder] Object to give hints about the options that your command accepts.
|
* @param [builder] Object to give hints about the options that your command accepts.
|
||||||
* Can also be a function. This function is executed with a yargs instance, and can be used to provide advanced command specific help.
|
* Can also be a function. This function is executed with a yargs instance, and can be used to provide advanced command specific help.
|
||||||
*
|
|
||||||
* Note that when `void` is returned, the handler `argv` object type will not include command-specific arguments.
|
|
||||||
* @param [handler] Function, which will be executed with the parsed `argv` object.
|
* @param [handler] Function, which will be executed with the parsed `argv` object.
|
||||||
*/
|
*/
|
||||||
command<U = T>(command: string | ReadonlyArray<string>, description: string, builder?: BuilderCallback<T, U>, handler?: (args: Arguments<U>) => void): Argv<U>;
|
command<U>(command: string | ReadonlyArray<string>, description: string, builder?: (args: Argv<T>) => Argv<U>, handler?: (args: Arguments<U>) => void): Argv<T>;
|
||||||
command<O extends { [key: string]: Options }>(command: string | ReadonlyArray<string>, description: string, builder?: O, handler?: (args: Arguments<InferredOptionTypes<O>>) => void): Argv<T>;
|
command<O extends { [key: string]: Options }>(command: string | ReadonlyArray<string>, description: string, builder?: O, handler?: (args: Arguments<InferredOptionTypes<O>>) => void): Argv<T>;
|
||||||
command<U>(command: string | ReadonlyArray<string>, description: string, module: CommandModule<T, U>): Argv<U>;
|
command<U>(command: string | ReadonlyArray<string>, description: string, module: CommandModule<T, U>): Argv<U>;
|
||||||
command<U = T>(command: string | ReadonlyArray<string>, showInHelp: false, builder?: BuilderCallback<T, U>, handler?: (args: Arguments<U>) => void): Argv<T>;
|
command<U>(command: string | ReadonlyArray<string>, showInHelp: false, builder?: (args: Argv<T>) => Argv<U>, handler?: (args: Arguments<U>) => void): Argv<T>;
|
||||||
command<O extends { [key: string]: Options }>(command: string | ReadonlyArray<string>, showInHelp: false, builder?: O, handler?: (args: Arguments<InferredOptionTypes<O>>) => void): Argv<T>;
|
command<O extends { [key: string]: Options }>(command: string | ReadonlyArray<string>, showInHelp: false, builder?: O, handler?: (args: Arguments<InferredOptionTypes<O>>) => void): Argv<T>;
|
||||||
command<U>(command: string | ReadonlyArray<string>, showInHelp: false, module: CommandModule<T, U>): Argv<U>;
|
command<U>(command: string | ReadonlyArray<string>, showInHelp: false, module: CommandModule<T, U>): Argv<U>;
|
||||||
command<U>(module: CommandModule<T, U>): Argv<U>;
|
command<U>(module: CommandModule<T, U>): Argv<U>;
|
||||||
|
@ -301,7 +288,7 @@ declare namespace yargs {
|
||||||
* Method to execute when a failure occurs, rather than printing the failure message.
|
* Method to execute when a failure occurs, rather than printing the failure message.
|
||||||
* @param func Is called with the failure message that would have been printed, the Error instance originally thrown and yargs state when the failure occurred.
|
* @param func Is called with the failure message that would have been printed, the Error instance originally thrown and yargs state when the failure occurred.
|
||||||
*/
|
*/
|
||||||
fail(func: (msg: string, err: Error, yargs: Argv<T>) => any): Argv<T>;
|
fail(func: (msg: string, err: Error) => any): Argv<T>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allows to programmatically get completion choices for any line.
|
* Allows to programmatically get completion choices for any line.
|
||||||
|
@ -394,12 +381,6 @@ declare namespace yargs {
|
||||||
number<K extends keyof T>(key: K | ReadonlyArray<K>): Argv<Omit<T, K> & { [key in K]: ToNumber<T[key]> }>;
|
number<K extends keyof T>(key: K | ReadonlyArray<K>): Argv<Omit<T, K> & { [key in K]: ToNumber<T[key]> }>;
|
||||||
number<K extends string>(key: K | ReadonlyArray<K>): Argv<T & { [key in K]: number | undefined }>;
|
number<K extends string>(key: K | ReadonlyArray<K>): Argv<T & { [key in K]: number | undefined }>;
|
||||||
|
|
||||||
/**
|
|
||||||
* Method to execute when a command finishes successfully.
|
|
||||||
* @param func Is called with the successful result of the command that finished.
|
|
||||||
*/
|
|
||||||
onFinishCommand(func: (result: any) => void): Argv<T>;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method can be used to make yargs aware of options that could exist.
|
* This method can be used to make yargs aware of options that could exist.
|
||||||
* You can also pass an opt object which can hold further customization, like `.alias()`, `.demandOption()` etc. for that option.
|
* You can also pass an opt object which can hold further customization, like `.alias()`, `.demandOption()` etc. for that option.
|
||||||
|
@ -433,7 +414,7 @@ declare namespace yargs {
|
||||||
parsed: DetailedArguments | false;
|
parsed: DetailedArguments | false;
|
||||||
|
|
||||||
/** Allows to configure advanced yargs features. */
|
/** Allows to configure advanced yargs features. */
|
||||||
parserConfiguration(configuration: Partial<ParserConfigurationOptions>): Argv<T>;
|
parserConfiguration(configuration: Partial<Configuration>): Argv<T>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Similar to `config()`, indicates that yargs should interpret the object from the specified key in package.json as a configuration object.
|
* Similar to `config()`, indicates that yargs should interpret the object from the specified key in package.json as a configuration object.
|
||||||
|
@ -683,8 +664,6 @@ declare namespace yargs {
|
||||||
interface PositionalOptions {
|
interface PositionalOptions {
|
||||||
/** string or array of strings, see `alias()` */
|
/** string or array of strings, see `alias()` */
|
||||||
alias?: string | ReadonlyArray<string>;
|
alias?: string | ReadonlyArray<string>;
|
||||||
/** boolean, interpret option as an array, see `array()` */
|
|
||||||
array?: boolean;
|
|
||||||
/** value or array of values, limit valid option arguments to a predefined set, see `choices()` */
|
/** value or array of values, limit valid option arguments to a predefined set, see `choices()` */
|
||||||
choices?: Choices;
|
choices?: Choices;
|
||||||
/** function, coerce or transform parsed command line values into another value, see `coerce()` */
|
/** function, coerce or transform parsed command line values into another value, see `coerce()` */
|
||||||
|
@ -693,8 +672,6 @@ declare namespace yargs {
|
||||||
conflicts?: string | ReadonlyArray<string> | { [key: string]: string | ReadonlyArray<string> };
|
conflicts?: string | ReadonlyArray<string> | { [key: string]: string | ReadonlyArray<string> };
|
||||||
/** value, set a default value for the option, see `default()` */
|
/** value, set a default value for the option, see `default()` */
|
||||||
default?: any;
|
default?: any;
|
||||||
/** boolean or string, demand the option be given, with optional error message, see `demandOption()` */
|
|
||||||
demandOption?: boolean | string;
|
|
||||||
/** string, the option description for help content, see `describe()` */
|
/** string, the option description for help content, see `describe()` */
|
||||||
desc?: string;
|
desc?: string;
|
||||||
/** string, the option description for help content, see `describe()` */
|
/** string, the option description for help content, see `describe()` */
|
||||||
|
@ -771,7 +748,7 @@ declare namespace yargs {
|
||||||
}
|
}
|
||||||
|
|
||||||
type ParseCallback<T = {}> = (err: Error | undefined, argv: Arguments<T>, output: string) => void;
|
type ParseCallback<T = {}> = (err: Error | undefined, argv: Arguments<T>, output: string) => void;
|
||||||
type CommandBuilder<T = {}, U = {}> = { [key: string]: Options } | ((args: Argv<T>) => Argv<U>) | ((args: Argv<T>) => PromiseLike<Argv<U>>);
|
type CommandBuilder<T = {}, U = {}> = { [key: string]: Options } | ((args: Argv<T>) => Argv<U>);
|
||||||
type SyncCompletionFunction = (current: string, argv: any) => string[];
|
type SyncCompletionFunction = (current: string, argv: any) => string[];
|
||||||
type AsyncCompletionFunction = (current: string, argv: any, done: (completion: ReadonlyArray<string>) => void) => void;
|
type AsyncCompletionFunction = (current: string, argv: any, done: (completion: ReadonlyArray<string>) => void) => void;
|
||||||
type PromiseCompletionFunction = (current: string, argv: any) => Promise<string[]>;
|
type PromiseCompletionFunction = (current: string, argv: any) => Promise<string[]>;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@types/yargs",
|
"name": "@types/yargs",
|
||||||
"version": "15.0.4",
|
"version": "13.0.2",
|
||||||
"description": "TypeScript definitions for yargs",
|
"description": "TypeScript definitions for yargs",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"contributors": [
|
"contributors": [
|
||||||
|
@ -38,20 +38,10 @@
|
||||||
"name": "Emily Marigold Klassen",
|
"name": "Emily Marigold Klassen",
|
||||||
"url": "https://github.com/forivall",
|
"url": "https://github.com/forivall",
|
||||||
"githubUsername": "forivall"
|
"githubUsername": "forivall"
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "ExE Boss",
|
|
||||||
"url": "https://github.com/ExE-Boss",
|
|
||||||
"githubUsername": "ExE-Boss"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Aankhen",
|
|
||||||
"url": "https://github.com/Aankhen",
|
|
||||||
"githubUsername": "Aankhen"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"main": "",
|
"main": "",
|
||||||
"types": "index.d.ts",
|
"types": "index",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
||||||
|
@ -61,6 +51,6 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/yargs-parser": "*"
|
"@types/yargs-parser": "*"
|
||||||
},
|
},
|
||||||
"typesPublisherContentHash": "33123d2b50bbbc5d15307f8a14b565cbb797530f625c3087b83b21aceb528536",
|
"typesPublisherContentHash": "5a8204a9fcea5ff2f6fd239ea4db72637ab00c6e3c82ff1855070c7ecc25394e",
|
||||||
"typeScriptVersion": "3.0"
|
"typeScriptVersion": "3.0"
|
||||||
}
|
}
|
|
@ -5,5 +5,5 @@ export = Yargs;
|
||||||
declare function Yargs(
|
declare function Yargs(
|
||||||
processArgs?: ReadonlyArray<string>,
|
processArgs?: ReadonlyArray<string>,
|
||||||
cwd?: string,
|
cwd?: string,
|
||||||
parentRequire?: NodeRequire,
|
parentRequire?: NodeRequireFunction,
|
||||||
): Argv;
|
): Argv;
|
||||||
|
|
|
@ -1,197 +0,0 @@
|
||||||
import * as cssColors from 'color-name';
|
|
||||||
|
|
||||||
declare namespace ansiStyles {
|
|
||||||
interface ColorConvert {
|
|
||||||
/**
|
|
||||||
The RGB color space.
|
|
||||||
|
|
||||||
@param red - (`0`-`255`)
|
|
||||||
@param green - (`0`-`255`)
|
|
||||||
@param blue - (`0`-`255`)
|
|
||||||
*/
|
|
||||||
rgb(red: number, green: number, blue: number): string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
The RGB HEX color space.
|
|
||||||
|
|
||||||
@param hex - A hexadecimal string containing RGB data.
|
|
||||||
*/
|
|
||||||
hex(hex: string): string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
@param keyword - A CSS color name.
|
|
||||||
*/
|
|
||||||
keyword(keyword: keyof typeof cssColors): string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
The HSL color space.
|
|
||||||
|
|
||||||
@param hue - (`0`-`360`)
|
|
||||||
@param saturation - (`0`-`100`)
|
|
||||||
@param lightness - (`0`-`100`)
|
|
||||||
*/
|
|
||||||
hsl(hue: number, saturation: number, lightness: number): string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
The HSV color space.
|
|
||||||
|
|
||||||
@param hue - (`0`-`360`)
|
|
||||||
@param saturation - (`0`-`100`)
|
|
||||||
@param value - (`0`-`100`)
|
|
||||||
*/
|
|
||||||
hsv(hue: number, saturation: number, value: number): string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
The HSV color space.
|
|
||||||
|
|
||||||
@param hue - (`0`-`360`)
|
|
||||||
@param whiteness - (`0`-`100`)
|
|
||||||
@param blackness - (`0`-`100`)
|
|
||||||
*/
|
|
||||||
hwb(hue: number, whiteness: number, blackness: number): string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
Use a [4-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#3/4-bit) to set text color.
|
|
||||||
*/
|
|
||||||
ansi(ansi: number): string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
Use an [8-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) to set text color.
|
|
||||||
*/
|
|
||||||
ansi256(ansi: number): string;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface CSPair {
|
|
||||||
/**
|
|
||||||
The ANSI terminal control sequence for starting this style.
|
|
||||||
*/
|
|
||||||
readonly open: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
The ANSI terminal control sequence for ending this style.
|
|
||||||
*/
|
|
||||||
readonly close: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface ColorBase {
|
|
||||||
readonly ansi: ColorConvert;
|
|
||||||
readonly ansi256: ColorConvert;
|
|
||||||
readonly ansi16m: ColorConvert;
|
|
||||||
|
|
||||||
/**
|
|
||||||
The ANSI terminal control sequence for ending this color.
|
|
||||||
*/
|
|
||||||
readonly close: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Modifier {
|
|
||||||
/**
|
|
||||||
Resets the current color chain.
|
|
||||||
*/
|
|
||||||
readonly reset: CSPair;
|
|
||||||
|
|
||||||
/**
|
|
||||||
Make text bold.
|
|
||||||
*/
|
|
||||||
readonly bold: CSPair;
|
|
||||||
|
|
||||||
/**
|
|
||||||
Emitting only a small amount of light.
|
|
||||||
*/
|
|
||||||
readonly dim: CSPair;
|
|
||||||
|
|
||||||
/**
|
|
||||||
Make text italic. (Not widely supported)
|
|
||||||
*/
|
|
||||||
readonly italic: CSPair;
|
|
||||||
|
|
||||||
/**
|
|
||||||
Make text underline. (Not widely supported)
|
|
||||||
*/
|
|
||||||
readonly underline: CSPair;
|
|
||||||
|
|
||||||
/**
|
|
||||||
Inverse background and foreground colors.
|
|
||||||
*/
|
|
||||||
readonly inverse: CSPair;
|
|
||||||
|
|
||||||
/**
|
|
||||||
Prints the text, but makes it invisible.
|
|
||||||
*/
|
|
||||||
readonly hidden: CSPair;
|
|
||||||
|
|
||||||
/**
|
|
||||||
Puts a horizontal line through the center of the text. (Not widely supported)
|
|
||||||
*/
|
|
||||||
readonly strikethrough: CSPair;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface ForegroundColor {
|
|
||||||
readonly black: CSPair;
|
|
||||||
readonly red: CSPair;
|
|
||||||
readonly green: CSPair;
|
|
||||||
readonly yellow: CSPair;
|
|
||||||
readonly blue: CSPair;
|
|
||||||
readonly cyan: CSPair;
|
|
||||||
readonly magenta: CSPair;
|
|
||||||
readonly white: CSPair;
|
|
||||||
|
|
||||||
/**
|
|
||||||
Alias for `blackBright`.
|
|
||||||
*/
|
|
||||||
readonly gray: CSPair;
|
|
||||||
|
|
||||||
/**
|
|
||||||
Alias for `blackBright`.
|
|
||||||
*/
|
|
||||||
readonly grey: CSPair;
|
|
||||||
|
|
||||||
readonly blackBright: CSPair;
|
|
||||||
readonly redBright: CSPair;
|
|
||||||
readonly greenBright: CSPair;
|
|
||||||
readonly yellowBright: CSPair;
|
|
||||||
readonly blueBright: CSPair;
|
|
||||||
readonly cyanBright: CSPair;
|
|
||||||
readonly magentaBright: CSPair;
|
|
||||||
readonly whiteBright: CSPair;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface BackgroundColor {
|
|
||||||
readonly bgBlack: CSPair;
|
|
||||||
readonly bgRed: CSPair;
|
|
||||||
readonly bgGreen: CSPair;
|
|
||||||
readonly bgYellow: CSPair;
|
|
||||||
readonly bgBlue: CSPair;
|
|
||||||
readonly bgCyan: CSPair;
|
|
||||||
readonly bgMagenta: CSPair;
|
|
||||||
readonly bgWhite: CSPair;
|
|
||||||
|
|
||||||
/**
|
|
||||||
Alias for `bgBlackBright`.
|
|
||||||
*/
|
|
||||||
readonly bgGray: CSPair;
|
|
||||||
|
|
||||||
/**
|
|
||||||
Alias for `bgBlackBright`.
|
|
||||||
*/
|
|
||||||
readonly bgGrey: CSPair;
|
|
||||||
|
|
||||||
readonly bgBlackBright: CSPair;
|
|
||||||
readonly bgRedBright: CSPair;
|
|
||||||
readonly bgGreenBright: CSPair;
|
|
||||||
readonly bgYellowBright: CSPair;
|
|
||||||
readonly bgBlueBright: CSPair;
|
|
||||||
readonly bgCyanBright: CSPair;
|
|
||||||
readonly bgMagentaBright: CSPair;
|
|
||||||
readonly bgWhiteBright: CSPair;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
declare const ansiStyles: {
|
|
||||||
readonly modifier: ansiStyles.Modifier;
|
|
||||||
readonly color: ansiStyles.ForegroundColor & ansiStyles.ColorBase;
|
|
||||||
readonly bgColor: ansiStyles.BackgroundColor & ansiStyles.ColorBase;
|
|
||||||
readonly codes: ReadonlyMap<number, number>;
|
|
||||||
} & ansiStyles.BackgroundColor & ansiStyles.ForegroundColor & ansiStyles.Modifier;
|
|
||||||
|
|
||||||
export = ansiStyles;
|
|
|
@ -1,63 +1,21 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
const colorConvert = require('color-convert');
|
||||||
|
|
||||||
const wrapAnsi16 = (fn, offset) => (...args) => {
|
const wrapAnsi16 = (fn, offset) => function () {
|
||||||
const code = fn(...args);
|
const code = fn.apply(colorConvert, arguments);
|
||||||
return `\u001B[${code + offset}m`;
|
return `\u001B[${code + offset}m`;
|
||||||
};
|
};
|
||||||
|
|
||||||
const wrapAnsi256 = (fn, offset) => (...args) => {
|
const wrapAnsi256 = (fn, offset) => function () {
|
||||||
const code = fn(...args);
|
const code = fn.apply(colorConvert, arguments);
|
||||||
return `\u001B[${38 + offset};5;${code}m`;
|
return `\u001B[${38 + offset};5;${code}m`;
|
||||||
};
|
};
|
||||||
|
|
||||||
const wrapAnsi16m = (fn, offset) => (...args) => {
|
const wrapAnsi16m = (fn, offset) => function () {
|
||||||
const rgb = fn(...args);
|
const rgb = fn.apply(colorConvert, arguments);
|
||||||
return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
|
return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
|
||||||
};
|
};
|
||||||
|
|
||||||
const ansi2ansi = n => n;
|
|
||||||
const rgb2rgb = (r, g, b) => [r, g, b];
|
|
||||||
|
|
||||||
const setLazyProperty = (object, property, get) => {
|
|
||||||
Object.defineProperty(object, property, {
|
|
||||||
get: () => {
|
|
||||||
const value = get();
|
|
||||||
|
|
||||||
Object.defineProperty(object, property, {
|
|
||||||
value,
|
|
||||||
enumerable: true,
|
|
||||||
configurable: true
|
|
||||||
});
|
|
||||||
|
|
||||||
return value;
|
|
||||||
},
|
|
||||||
enumerable: true,
|
|
||||||
configurable: true
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/** @type {typeof import('color-convert')} */
|
|
||||||
let colorConvert;
|
|
||||||
const makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => {
|
|
||||||
if (colorConvert === undefined) {
|
|
||||||
colorConvert = require('color-convert');
|
|
||||||
}
|
|
||||||
|
|
||||||
const offset = isBackground ? 10 : 0;
|
|
||||||
const styles = {};
|
|
||||||
|
|
||||||
for (const [sourceSpace, suite] of Object.entries(colorConvert)) {
|
|
||||||
const name = sourceSpace === 'ansi16' ? 'ansi' : sourceSpace;
|
|
||||||
if (sourceSpace === targetSpace) {
|
|
||||||
styles[name] = wrap(identity, offset);
|
|
||||||
} else if (typeof suite === 'object') {
|
|
||||||
styles[name] = wrap(suite[targetSpace], offset);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return styles;
|
|
||||||
};
|
|
||||||
|
|
||||||
function assembleStyles() {
|
function assembleStyles() {
|
||||||
const codes = new Map();
|
const codes = new Map();
|
||||||
const styles = {
|
const styles = {
|
||||||
|
@ -81,9 +39,9 @@ function assembleStyles() {
|
||||||
magenta: [35, 39],
|
magenta: [35, 39],
|
||||||
cyan: [36, 39],
|
cyan: [36, 39],
|
||||||
white: [37, 39],
|
white: [37, 39],
|
||||||
|
gray: [90, 39],
|
||||||
|
|
||||||
// Bright color
|
// Bright color
|
||||||
blackBright: [90, 39],
|
|
||||||
redBright: [91, 39],
|
redBright: [91, 39],
|
||||||
greenBright: [92, 39],
|
greenBright: [92, 39],
|
||||||
yellowBright: [93, 39],
|
yellowBright: [93, 39],
|
||||||
|
@ -114,14 +72,15 @@ function assembleStyles() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Alias bright black as gray (and grey)
|
// Fix humans
|
||||||
styles.color.gray = styles.color.blackBright;
|
styles.color.grey = styles.color.gray;
|
||||||
styles.bgColor.bgGray = styles.bgColor.bgBlackBright;
|
|
||||||
styles.color.grey = styles.color.blackBright;
|
for (const groupName of Object.keys(styles)) {
|
||||||
styles.bgColor.bgGrey = styles.bgColor.bgBlackBright;
|
const group = styles[groupName];
|
||||||
|
|
||||||
|
for (const styleName of Object.keys(group)) {
|
||||||
|
const style = group[styleName];
|
||||||
|
|
||||||
for (const [groupName, group] of Object.entries(styles)) {
|
|
||||||
for (const [styleName, style] of Object.entries(group)) {
|
|
||||||
styles[styleName] = {
|
styles[styleName] = {
|
||||||
open: `\u001B[${style[0]}m`,
|
open: `\u001B[${style[0]}m`,
|
||||||
close: `\u001B[${style[1]}m`
|
close: `\u001B[${style[1]}m`
|
||||||
|
@ -136,22 +95,65 @@ function assembleStyles() {
|
||||||
value: group,
|
value: group,
|
||||||
enumerable: false
|
enumerable: false
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Object.defineProperty(styles, 'codes', {
|
||||||
|
value: codes,
|
||||||
|
enumerable: false
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Object.defineProperty(styles, 'codes', {
|
const ansi2ansi = n => n;
|
||||||
value: codes,
|
const rgb2rgb = (r, g, b) => [r, g, b];
|
||||||
enumerable: false
|
|
||||||
});
|
|
||||||
|
|
||||||
styles.color.close = '\u001B[39m';
|
styles.color.close = '\u001B[39m';
|
||||||
styles.bgColor.close = '\u001B[49m';
|
styles.bgColor.close = '\u001B[49m';
|
||||||
|
|
||||||
setLazyProperty(styles.color, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, false));
|
styles.color.ansi = {
|
||||||
setLazyProperty(styles.color, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, false));
|
ansi: wrapAnsi16(ansi2ansi, 0)
|
||||||
setLazyProperty(styles.color, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, false));
|
};
|
||||||
setLazyProperty(styles.bgColor, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, true));
|
styles.color.ansi256 = {
|
||||||
setLazyProperty(styles.bgColor, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, true));
|
ansi256: wrapAnsi256(ansi2ansi, 0)
|
||||||
setLazyProperty(styles.bgColor, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, true));
|
};
|
||||||
|
styles.color.ansi16m = {
|
||||||
|
rgb: wrapAnsi16m(rgb2rgb, 0)
|
||||||
|
};
|
||||||
|
|
||||||
|
styles.bgColor.ansi = {
|
||||||
|
ansi: wrapAnsi16(ansi2ansi, 10)
|
||||||
|
};
|
||||||
|
styles.bgColor.ansi256 = {
|
||||||
|
ansi256: wrapAnsi256(ansi2ansi, 10)
|
||||||
|
};
|
||||||
|
styles.bgColor.ansi16m = {
|
||||||
|
rgb: wrapAnsi16m(rgb2rgb, 10)
|
||||||
|
};
|
||||||
|
|
||||||
|
for (let key of Object.keys(colorConvert)) {
|
||||||
|
if (typeof colorConvert[key] !== 'object') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const suite = colorConvert[key];
|
||||||
|
|
||||||
|
if (key === 'ansi16') {
|
||||||
|
key = 'ansi';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ('ansi16' in suite) {
|
||||||
|
styles.color.ansi[key] = wrapAnsi16(suite.ansi16, 0);
|
||||||
|
styles.bgColor.ansi[key] = wrapAnsi16(suite.ansi16, 10);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ('ansi256' in suite) {
|
||||||
|
styles.color.ansi256[key] = wrapAnsi256(suite.ansi256, 0);
|
||||||
|
styles.bgColor.ansi256[key] = wrapAnsi256(suite.ansi256, 10);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ('rgb' in suite) {
|
||||||
|
styles.color.ansi16m[key] = wrapAnsi16m(suite.rgb, 0);
|
||||||
|
styles.bgColor.ansi16m[key] = wrapAnsi16m(suite.rgb, 10);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return styles;
|
return styles;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,25 +1,23 @@
|
||||||
{
|
{
|
||||||
"name": "ansi-styles",
|
"name": "ansi-styles",
|
||||||
"version": "4.2.1",
|
"version": "3.2.1",
|
||||||
"description": "ANSI escape codes for styling strings in the terminal",
|
"description": "ANSI escape codes for styling strings in the terminal",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"repository": "chalk/ansi-styles",
|
"repository": "chalk/ansi-styles",
|
||||||
"funding": "https://github.com/chalk/ansi-styles?sponsor=1",
|
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Sindre Sorhus",
|
"name": "Sindre Sorhus",
|
||||||
"email": "sindresorhus@gmail.com",
|
"email": "sindresorhus@gmail.com",
|
||||||
"url": "sindresorhus.com"
|
"url": "sindresorhus.com"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=8"
|
"node": ">=4"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "xo && ava && tsd",
|
"test": "xo && ava",
|
||||||
"screenshot": "svg-term --command='node screenshot' --out=screenshot.svg --padding=3 --width=55 --height=3 --at=1000 --no-cursor"
|
"screenshot": "svg-term --command='node screenshot' --out=screenshot.svg --padding=3 --width=55 --height=3 --at=1000 --no-cursor"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"index.js",
|
"index.js"
|
||||||
"index.d.ts"
|
|
||||||
],
|
],
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"ansi",
|
"ansi",
|
||||||
|
@ -44,14 +42,15 @@
|
||||||
"text"
|
"text"
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/color-name": "^1.1.1",
|
"color-convert": "^1.9.0"
|
||||||
"color-convert": "^2.0.1"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/color-convert": "^1.9.0",
|
"ava": "*",
|
||||||
"ava": "^2.3.0",
|
"babel-polyfill": "^6.23.0",
|
||||||
"svg-term-cli": "^2.1.1",
|
"svg-term-cli": "^2.1.1",
|
||||||
"tsd": "^0.11.0",
|
"xo": "*"
|
||||||
"xo": "^0.25.3"
|
},
|
||||||
|
"ava": {
|
||||||
|
"require": "babel-polyfill"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
# ansi-styles [![Build Status](https://travis-ci.org/chalk/ansi-styles.svg?branch=master)](https://travis-ci.org/chalk/ansi-styles)
|
# ansi-styles [![Build Status](https://travis-ci.org/chalk/ansi-styles.svg?branch=master)](https://travis-ci.org/chalk/ansi-styles)
|
||||||
|
|
||||||
> [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) for styling strings in the terminal
|
> [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) for styling strings in the terminal
|
||||||
|
|
||||||
You probably want the higher-level [chalk](https://github.com/chalk/chalk) module for styling your strings.
|
You probably want the higher-level [chalk](https://github.com/chalk/chalk) module for styling your strings.
|
||||||
|
|
||||||
<img src="screenshot.svg" width="900">
|
<img src="https://cdn.rawgit.com/chalk/ansi-styles/8261697c95bf34b6c7767e2cbe9941a851d59385/screenshot.svg" width="900">
|
||||||
|
|
||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
|
@ -12,6 +13,7 @@ You probably want the higher-level [chalk](https://github.com/chalk/chalk) modul
|
||||||
$ npm install ansi-styles
|
$ npm install ansi-styles
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
```js
|
```js
|
||||||
|
@ -27,13 +29,14 @@ console.log(`${style.green.open}Hello world!${style.green.close}`);
|
||||||
// original color.
|
// original color.
|
||||||
console.log(style.bgColor.ansi.hsl(120, 80, 72) + 'Hello world!' + style.bgColor.close);
|
console.log(style.bgColor.ansi.hsl(120, 80, 72) + 'Hello world!' + style.bgColor.close);
|
||||||
console.log(style.color.ansi256.rgb(199, 20, 250) + 'Hello world!' + style.color.close);
|
console.log(style.color.ansi256.rgb(199, 20, 250) + 'Hello world!' + style.color.close);
|
||||||
console.log(style.color.ansi16m.hex('#abcdef') + 'Hello world!' + style.color.close);
|
console.log(style.color.ansi16m.hex('#ABCDEF') + 'Hello world!' + style.color.close);
|
||||||
```
|
```
|
||||||
|
|
||||||
## API
|
## API
|
||||||
|
|
||||||
Each style has an `open` and `close` property.
|
Each style has an `open` and `close` property.
|
||||||
|
|
||||||
|
|
||||||
## Styles
|
## Styles
|
||||||
|
|
||||||
### Modifiers
|
### Modifiers
|
||||||
|
@ -57,7 +60,7 @@ Each style has an `open` and `close` property.
|
||||||
- `magenta`
|
- `magenta`
|
||||||
- `cyan`
|
- `cyan`
|
||||||
- `white`
|
- `white`
|
||||||
- `blackBright` (alias: `gray`, `grey`)
|
- `gray` ("bright black")
|
||||||
- `redBright`
|
- `redBright`
|
||||||
- `greenBright`
|
- `greenBright`
|
||||||
- `yellowBright`
|
- `yellowBright`
|
||||||
|
@ -76,7 +79,7 @@ Each style has an `open` and `close` property.
|
||||||
- `bgMagenta`
|
- `bgMagenta`
|
||||||
- `bgCyan`
|
- `bgCyan`
|
||||||
- `bgWhite`
|
- `bgWhite`
|
||||||
- `bgBlackBright` (alias: `bgGray`, `bgGrey`)
|
- `bgBlackBright`
|
||||||
- `bgRedBright`
|
- `bgRedBright`
|
||||||
- `bgGreenBright`
|
- `bgGreenBright`
|
||||||
- `bgYellowBright`
|
- `bgYellowBright`
|
||||||
|
@ -85,6 +88,7 @@ Each style has an `open` and `close` property.
|
||||||
- `bgCyanBright`
|
- `bgCyanBright`
|
||||||
- `bgWhiteBright`
|
- `bgWhiteBright`
|
||||||
|
|
||||||
|
|
||||||
## Advanced usage
|
## Advanced usage
|
||||||
|
|
||||||
By default, you get a map of styles, but the styles are also available as groups. They are non-enumerable so they don't show up unless you access them explicitly. This makes it easier to expose only a subset in a higher-level module.
|
By default, you get a map of styles, but the styles are also available as groups. They are non-enumerable so they don't show up unless you access them explicitly. This makes it easier to expose only a subset in a higher-level module.
|
||||||
|
@ -108,21 +112,11 @@ console.log(style.codes.get(36));
|
||||||
//=> 39
|
//=> 39
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## [256 / 16 million (TrueColor) support](https://gist.github.com/XVilka/8346728)
|
## [256 / 16 million (TrueColor) support](https://gist.github.com/XVilka/8346728)
|
||||||
|
|
||||||
`ansi-styles` uses the [`color-convert`](https://github.com/Qix-/color-convert) package to allow for converting between various colors and ANSI escapes, with support for 256 and 16 million colors.
|
`ansi-styles` uses the [`color-convert`](https://github.com/Qix-/color-convert) package to allow for converting between various colors and ANSI escapes, with support for 256 and 16 million colors.
|
||||||
|
|
||||||
The following color spaces from `color-convert` are supported:
|
|
||||||
|
|
||||||
- `rgb`
|
|
||||||
- `hex`
|
|
||||||
- `keyword`
|
|
||||||
- `hsl`
|
|
||||||
- `hsv`
|
|
||||||
- `hwb`
|
|
||||||
- `ansi`
|
|
||||||
- `ansi256`
|
|
||||||
|
|
||||||
To use these, call the associated conversion function with the intended output, for example:
|
To use these, call the associated conversion function with the intended output, for example:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
|
@ -136,23 +130,18 @@ style.color.ansi16m.hex('#C0FFEE'); // Hex (RGB) to 16 million color foreground
|
||||||
style.bgColor.ansi16m.hex('#C0FFEE'); // Hex (RGB) to 16 million color background code
|
style.bgColor.ansi16m.hex('#C0FFEE'); // Hex (RGB) to 16 million color background code
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## Related
|
## Related
|
||||||
|
|
||||||
- [ansi-escapes](https://github.com/sindresorhus/ansi-escapes) - ANSI escape codes for manipulating the terminal
|
- [ansi-escapes](https://github.com/sindresorhus/ansi-escapes) - ANSI escape codes for manipulating the terminal
|
||||||
|
|
||||||
|
|
||||||
## Maintainers
|
## Maintainers
|
||||||
|
|
||||||
- [Sindre Sorhus](https://github.com/sindresorhus)
|
- [Sindre Sorhus](https://github.com/sindresorhus)
|
||||||
- [Josh Junon](https://github.com/qix-)
|
- [Josh Junon](https://github.com/qix-)
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
<div align="center">
|
## License
|
||||||
<b>
|
|
||||||
<a href="https://tidelift.com/subscription/pkg/npm-ansi-styles?utm_source=npm-ansi-styles&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
|
MIT
|
||||||
</b>
|
|
||||||
<br>
|
|
||||||
<sub>
|
|
||||||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
|
||||||
</sub>
|
|
||||||
</div>
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
The ISC License
|
The ISC License
|
||||||
|
|
||||||
Copyright (c) 2019 Elan Shanker, Paul Miller (https://paulmillr.com)
|
Copyright (c) 2014 Elan Shanker
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
Permission to use, copy, modify, and/or distribute this software for any
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
purpose with or without fee is hereby granted, provided that the above
|
||||||
|
|
|
@ -7,14 +7,16 @@ allowing a very flexible user-defined config to define things like file paths.
|
||||||
|
|
||||||
__Note: This module has Bash-parity, please be aware that Windows-style backslashes are not supported as separators. See https://github.com/micromatch/micromatch#backslashes for more information.__
|
__Note: This module has Bash-parity, please be aware that Windows-style backslashes are not supported as separators. See https://github.com/micromatch/micromatch#backslashes for more information.__
|
||||||
|
|
||||||
|
[![NPM](https://nodei.co/npm/anymatch.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/anymatch/)
|
||||||
|
[![NPM](https://nodei.co/npm-dl/anymatch.png?height=3&months=9)](https://nodei.co/npm-dl/anymatch/)
|
||||||
|
|
||||||
Usage
|
Usage
|
||||||
-----
|
-----
|
||||||
```sh
|
```sh
|
||||||
npm install anymatch
|
npm install anymatch --save
|
||||||
```
|
```
|
||||||
|
|
||||||
#### anymatch(matchers, testString, [returnIndex], [options])
|
#### anymatch (matchers, testString, [returnIndex], [startIndex], [endIndex])
|
||||||
* __matchers__: (_Array|String|RegExp|Function_)
|
* __matchers__: (_Array|String|RegExp|Function_)
|
||||||
String to be directly matched, string with glob patterns, regular expression
|
String to be directly matched, string with glob patterns, regular expression
|
||||||
test, function that takes the testString as an argument and returns a truthy
|
test, function that takes the testString as an argument and returns a truthy
|
||||||
|
@ -23,15 +25,26 @@ value if it should be matched, or an array of any number and mix of these types.
|
||||||
passed as an array, the first element of the array will be used as the
|
passed as an array, the first element of the array will be used as the
|
||||||
`testString` for non-function matchers, while the entire array will be applied
|
`testString` for non-function matchers, while the entire array will be applied
|
||||||
as the arguments for function matchers.
|
as the arguments for function matchers.
|
||||||
* __options__: (_Object_ [optional]_) Any of the [picomatch](https://github.com/micromatch/picomatch#options) options.
|
* __returnIndex__: (_Boolean [optional]_) If true, return the array index of
|
||||||
* __returnIndex__: (_Boolean [optional]_) If true, return the array index of
|
|
||||||
the first matcher that that testString matched, or -1 if no match, instead of a
|
the first matcher that that testString matched, or -1 if no match, instead of a
|
||||||
boolean result.
|
boolean result.
|
||||||
|
* __startIndex, endIndex__: (_Integer [optional]_) Can be used to define a
|
||||||
|
subset out of the array of provided matchers to test against. Can be useful
|
||||||
|
with bound matcher functions (see below). When used with `returnIndex = true`
|
||||||
|
preserves original indexing. Behaves the same as `Array.prototype.slice` (i.e.
|
||||||
|
includes array members up to, but not including endIndex).
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const anymatch = require('anymatch');
|
var anymatch = require('anymatch');
|
||||||
|
|
||||||
const matchers = [ 'path/to/file.js', 'path/anyjs/**/*.js', /foo.js$/, string => string.includes('bar') && string.length > 10 ] ;
|
var matchers = [
|
||||||
|
'path/to/file.js',
|
||||||
|
'path/anyjs/**/*.js',
|
||||||
|
/foo\.js$/,
|
||||||
|
function (string) {
|
||||||
|
return string.indexOf('bar') !== -1 && string.length > 10
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
anymatch(matchers, 'path/to/file.js'); // true
|
anymatch(matchers, 'path/to/file.js'); // true
|
||||||
anymatch(matchers, 'path/anyjs/baz.js'); // true
|
anymatch(matchers, 'path/anyjs/baz.js'); // true
|
||||||
|
@ -40,10 +53,13 @@ anymatch(matchers, 'path/to/bar.js'); // true
|
||||||
anymatch(matchers, 'bar.js'); // false
|
anymatch(matchers, 'bar.js'); // false
|
||||||
|
|
||||||
// returnIndex = true
|
// returnIndex = true
|
||||||
anymatch(matchers, 'foo.js', {returnIndex: true}); // 2
|
anymatch(matchers, 'foo.js', true); // 2
|
||||||
anymatch(matchers, 'path/anyjs/foo.js', {returnIndex: true}); // 1
|
anymatch(matchers, 'path/anyjs/foo.js', true); // 1
|
||||||
|
|
||||||
// any picomatc
|
// skip matchers
|
||||||
|
anymatch(matchers, 'path/to/file.js', false, 1); // false
|
||||||
|
anymatch(matchers, 'path/anyjs/foo.js', true, 2, 3); // 2
|
||||||
|
anymatch(matchers, 'path/to/bar.js', true, 0, 3); // -1
|
||||||
|
|
||||||
// using globs to match directories and their children
|
// using globs to match directories and their children
|
||||||
anymatch('node_modules', 'node_modules'); // true
|
anymatch('node_modules', 'node_modules'); // true
|
||||||
|
@ -51,34 +67,30 @@ anymatch('node_modules', 'node_modules/somelib/index.js'); // false
|
||||||
anymatch('node_modules/**', 'node_modules/somelib/index.js'); // true
|
anymatch('node_modules/**', 'node_modules/somelib/index.js'); // true
|
||||||
anymatch('node_modules/**', '/absolute/path/to/node_modules/somelib/index.js'); // false
|
anymatch('node_modules/**', '/absolute/path/to/node_modules/somelib/index.js'); // false
|
||||||
anymatch('**/node_modules/**', '/absolute/path/to/node_modules/somelib/index.js'); // true
|
anymatch('**/node_modules/**', '/absolute/path/to/node_modules/somelib/index.js'); // true
|
||||||
|
|
||||||
const matcher = anymatch(matchers);
|
|
||||||
['foo.js', 'bar.js'].filter(matcher); // [ 'foo.js' ]
|
|
||||||
anymatch master* ❯
|
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
#### anymatch(matchers)
|
#### anymatch (matchers)
|
||||||
You can also pass in only your matcher(s) to get a curried function that has
|
You can also pass in only your matcher(s) to get a curried function that has
|
||||||
already been bound to the provided matching criteria. This can be used as an
|
already been bound to the provided matching criteria. This can be used as an
|
||||||
`Array#filter` callback.
|
`Array.prototype.filter` callback.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
var matcher = anymatch(matchers);
|
var matcher = anymatch(matchers);
|
||||||
|
|
||||||
matcher('path/to/file.js'); // true
|
matcher('path/to/file.js'); // true
|
||||||
matcher('path/anyjs/baz.js', true); // 1
|
matcher('path/anyjs/baz.js', true); // 1
|
||||||
|
matcher('path/anyjs/baz.js', true, 2); // -1
|
||||||
|
|
||||||
['foo.js', 'bar.js'].filter(matcher); // ['foo.js']
|
['foo.js', 'bar.js'].filter(matcher); // ['foo.js']
|
||||||
```
|
```
|
||||||
|
|
||||||
Changelog
|
Change Log
|
||||||
----------
|
----------
|
||||||
[See release notes page on GitHub](https://github.com/micromatch/anymatch/releases)
|
[See release notes page on GitHub](https://github.com/micromatch/anymatch/releases)
|
||||||
|
|
||||||
- **v3.0:** Removed `startIndex` and `endIndex` arguments. Node 8.x-only.
|
NOTE: As of v2.0.0, [micromatch](https://github.com/jonschlinkert/micromatch) moves away from minimatch-parity and inline with Bash. This includes handling backslashes differently (see https://github.com/micromatch/micromatch#backslashes for more information).
|
||||||
- **v2.0:** [micromatch](https://github.com/jonschlinkert/micromatch) moves away from minimatch-parity and inline with Bash. This includes handling backslashes differently (see https://github.com/micromatch/micromatch#backslashes for more information).
|
|
||||||
- **v1.2:** anymatch uses [micromatch](https://github.com/jonschlinkert/micromatch)
|
NOTE: As of v1.2.0, anymatch uses [micromatch](https://github.com/jonschlinkert/micromatch)
|
||||||
for glob pattern matching. Issues with glob pattern matching should be
|
for glob pattern matching. Issues with glob pattern matching should be
|
||||||
reported directly to the [micromatch issue tracker](https://github.com/jonschlinkert/micromatch/issues).
|
reported directly to the [micromatch issue tracker](https://github.com/jonschlinkert/micromatch/issues).
|
||||||
|
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
type AnymatchFn = (testString: string) => boolean;
|
|
||||||
type AnymatchPattern = string|RegExp|AnymatchFn;
|
|
||||||
type AnymatchMatcher = AnymatchPattern|AnymatchPattern[]
|
|
||||||
type AnymatchTester = {
|
|
||||||
(testString: string|any[], returnIndex: true): number;
|
|
||||||
(testString: string|any[]): boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
type PicomatchOptions = {dot: boolean};
|
|
||||||
|
|
||||||
declare const anymatch: {
|
|
||||||
(matchers: AnymatchMatcher): AnymatchTester;
|
|
||||||
(matchers: AnymatchMatcher, testString: string|any[], returnIndex: true | PicomatchOptions): number;
|
|
||||||
(matchers: AnymatchMatcher, testString: string|any[]): boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export {AnymatchMatcher as Matcher}
|
|
||||||
export {AnymatchTester as Tester}
|
|
||||||
export default anymatch
|
|
|
@ -1,102 +1,67 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
var micromatch = require('micromatch');
|
||||||
|
var normalize = require('normalize-path');
|
||||||
|
var path = require('path'); // required for tests.
|
||||||
|
var arrify = function(a) { return a == null ? [] : (Array.isArray(a) ? a : [a]); };
|
||||||
|
|
||||||
const picomatch = require('picomatch');
|
var anymatch = function(criteria, value, returnIndex, startIndex, endIndex) {
|
||||||
const normalizePath = require('normalize-path');
|
criteria = arrify(criteria);
|
||||||
|
value = arrify(value);
|
||||||
/**
|
if (arguments.length === 1) {
|
||||||
* @typedef {(testString: string) => boolean} AnymatchFn
|
return anymatch.bind(null, criteria.map(function(criterion) {
|
||||||
* @typedef {string|RegExp|AnymatchFn} AnymatchPattern
|
return typeof criterion === 'string' && criterion[0] !== '!' ?
|
||||||
* @typedef {AnymatchPattern|AnymatchPattern[]} AnymatchMatcher
|
micromatch.matcher(criterion) : criterion;
|
||||||
*/
|
}));
|
||||||
const BANG = '!';
|
|
||||||
const DEFAULT_OPTIONS = {returnIndex: false};
|
|
||||||
const arrify = (item) => Array.isArray(item) ? item : [item];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {AnymatchPattern} matcher
|
|
||||||
* @param {object} options
|
|
||||||
* @returns {AnymatchFn}
|
|
||||||
*/
|
|
||||||
const createPattern = (matcher, options) => {
|
|
||||||
if (typeof matcher === 'function') {
|
|
||||||
return matcher;
|
|
||||||
}
|
}
|
||||||
if (typeof matcher === 'string') {
|
startIndex = startIndex || 0;
|
||||||
const glob = picomatch(matcher, options);
|
var string = value[0];
|
||||||
return (string) => matcher === string || glob(string);
|
var altString, altValue;
|
||||||
|
var matched = false;
|
||||||
|
var matchIndex = -1;
|
||||||
|
function testCriteria(criterion, index) {
|
||||||
|
var result;
|
||||||
|
switch (Object.prototype.toString.call(criterion)) {
|
||||||
|
case '[object String]':
|
||||||
|
result = string === criterion || altString && altString === criterion;
|
||||||
|
result = result || micromatch.isMatch(string, criterion);
|
||||||
|
break;
|
||||||
|
case '[object RegExp]':
|
||||||
|
result = criterion.test(string) || altString && criterion.test(altString);
|
||||||
|
break;
|
||||||
|
case '[object Function]':
|
||||||
|
result = criterion.apply(null, value);
|
||||||
|
result = result || altValue && criterion.apply(null, altValue);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
|
if (result) {
|
||||||
|
matchIndex = index + startIndex;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
if (matcher instanceof RegExp) {
|
var crit = criteria;
|
||||||
return (string) => matcher.test(string);
|
var negGlobs = crit.reduce(function(arr, criterion, index) {
|
||||||
|
if (typeof criterion === 'string' && criterion[0] === '!') {
|
||||||
|
if (crit === criteria) {
|
||||||
|
// make a copy before modifying
|
||||||
|
crit = crit.slice();
|
||||||
|
}
|
||||||
|
crit[index] = null;
|
||||||
|
arr.push(criterion.substr(1));
|
||||||
|
}
|
||||||
|
return arr;
|
||||||
|
}, []);
|
||||||
|
if (!negGlobs.length || !micromatch.any(string, negGlobs)) {
|
||||||
|
if (path.sep === '\\' && typeof string === 'string') {
|
||||||
|
altString = normalize(string);
|
||||||
|
altString = altString === string ? null : altString;
|
||||||
|
if (altString) altValue = [altString].concat(value.slice(1));
|
||||||
|
}
|
||||||
|
matched = crit.slice(startIndex, endIndex).some(testCriteria);
|
||||||
}
|
}
|
||||||
return (string) => false;
|
return returnIndex === true ? matchIndex : matched;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {Array<Function>} patterns
|
|
||||||
* @param {Array<Function>} negPatterns
|
|
||||||
* @param {String|Array} args
|
|
||||||
* @param {Boolean} returnIndex
|
|
||||||
* @returns {boolean|number}
|
|
||||||
*/
|
|
||||||
const matchPatterns = (patterns, negPatterns, args, returnIndex) => {
|
|
||||||
const isList = Array.isArray(args);
|
|
||||||
const _path = isList ? args[0] : args;
|
|
||||||
if (!isList && typeof _path !== 'string') {
|
|
||||||
throw new TypeError('anymatch: second argument must be a string: got ' +
|
|
||||||
Object.prototype.toString.call(_path))
|
|
||||||
}
|
|
||||||
const path = normalizePath(_path);
|
|
||||||
|
|
||||||
for (let index = 0; index < negPatterns.length; index++) {
|
|
||||||
const nglob = negPatterns[index];
|
|
||||||
if (nglob(path)) {
|
|
||||||
return returnIndex ? -1 : false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const applied = isList && [path].concat(args.slice(1));
|
|
||||||
for (let index = 0; index < patterns.length; index++) {
|
|
||||||
const pattern = patterns[index];
|
|
||||||
if (isList ? pattern(...applied) : pattern(path)) {
|
|
||||||
return returnIndex ? index : true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return returnIndex ? -1 : false;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {AnymatchMatcher} matchers
|
|
||||||
* @param {Array|string} testString
|
|
||||||
* @param {object} options
|
|
||||||
* @returns {boolean|number|Function}
|
|
||||||
*/
|
|
||||||
const anymatch = (matchers, testString, options = DEFAULT_OPTIONS) => {
|
|
||||||
if (matchers == null) {
|
|
||||||
throw new TypeError('anymatch: specify first argument');
|
|
||||||
}
|
|
||||||
const opts = typeof options === 'boolean' ? {returnIndex: options} : options;
|
|
||||||
const returnIndex = opts.returnIndex || false;
|
|
||||||
|
|
||||||
// Early cache for matchers.
|
|
||||||
const mtchers = arrify(matchers);
|
|
||||||
const negatedGlobs = mtchers
|
|
||||||
.filter(item => typeof item === 'string' && item.charAt(0) === BANG)
|
|
||||||
.map(item => item.slice(1))
|
|
||||||
.map(item => picomatch(item, opts));
|
|
||||||
const patterns = mtchers.map(matcher => createPattern(matcher, opts));
|
|
||||||
|
|
||||||
if (testString == null) {
|
|
||||||
return (testString, ri = false) => {
|
|
||||||
const returnIndex = typeof ri === 'boolean' ? ri : false;
|
|
||||||
return matchPatterns(patterns, negatedGlobs, testString, returnIndex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return matchPatterns(patterns, negatedGlobs, testString, returnIndex);
|
|
||||||
};
|
|
||||||
|
|
||||||
anymatch.default = anymatch;
|
|
||||||
module.exports = anymatch;
|
module.exports = anymatch;
|
||||||
|
|
|
@ -1,18 +1,13 @@
|
||||||
{
|
{
|
||||||
"name": "anymatch",
|
"name": "anymatch",
|
||||||
"version": "3.1.1",
|
"version": "2.0.0",
|
||||||
"description": "Matches strings against configurable strings, globs, regular expressions, and/or functions",
|
"description": "Matches strings against configurable strings, globs, regular expressions, and/or functions",
|
||||||
"files": [
|
"files": [
|
||||||
"index.js",
|
"index.js"
|
||||||
"index.d.ts"
|
|
||||||
],
|
],
|
||||||
"dependencies": {
|
|
||||||
"normalize-path": "^3.0.0",
|
|
||||||
"picomatch": "^2.0.4"
|
|
||||||
},
|
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Elan Shanker",
|
"name": "Elan Shanker",
|
||||||
"url": "https://github.com/es128"
|
"url": "http://github.com/es128"
|
||||||
},
|
},
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"homepage": "https://github.com/micromatch/anymatch",
|
"homepage": "https://github.com/micromatch/anymatch",
|
||||||
|
@ -20,6 +15,9 @@
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/micromatch/anymatch"
|
"url": "https://github.com/micromatch/anymatch"
|
||||||
},
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/micromatch/anymatch/issues"
|
||||||
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"match",
|
"match",
|
||||||
"any",
|
"any",
|
||||||
|
@ -35,14 +33,15 @@
|
||||||
"function"
|
"function"
|
||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "nyc mocha",
|
"test": "istanbul cover _mocha && cat ./coverage/lcov.info | coveralls"
|
||||||
"mocha": "mocha"
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"micromatch": "^3.1.4",
|
||||||
|
"normalize-path": "^2.1.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"mocha": "^6.1.3",
|
"coveralls": "^2.7.0",
|
||||||
"nyc": "^14.0.0"
|
"istanbul": "^0.4.5",
|
||||||
},
|
"mocha": "^3.0.0"
|
||||||
"engines": {
|
|
||||||
"node": ">= 8"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,18 +2,6 @@
|
||||||
|
|
||||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||||
|
|
||||||
## [6.0.0](https://github.com/istanbuljs/babel-plugin-istanbul/compare/v5.2.0...v6.0.0) (2019-12-20)
|
|
||||||
|
|
||||||
|
|
||||||
### ⚠ BREAKING CHANGES
|
|
||||||
|
|
||||||
* Drop node.js 6 (#226)
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* Add support for instrumenter options ([#227](https://github.com/istanbuljs/babel-plugin-istanbul/issues/227)) ([fe08f5b](https://github.com/istanbuljs/babel-plugin-istanbul/commit/fe08f5b8282136c7ed9375fa32148586bd6a7e28)), closes [#208](https://github.com/istanbuljs/babel-plugin-istanbul/issues/208) [#212](https://github.com/istanbuljs/babel-plugin-istanbul/issues/212)
|
|
||||||
* Drop node.js 6 ([#226](https://github.com/istanbuljs/babel-plugin-istanbul/issues/226)) ([93db21a](https://github.com/istanbuljs/babel-plugin-istanbul/commit/93db21aa2bbdbb06fb784f52c24a7847fad6be92)), closes [#209](https://github.com/istanbuljs/babel-plugin-istanbul/issues/209)
|
|
||||||
|
|
||||||
## [5.2.0](https://github.com/istanbuljs/babel-plugin-istanbul/compare/v5.1.4...v5.2.0) (2019-07-18)
|
## [5.2.0](https://github.com/istanbuljs/babel-plugin-istanbul/compare/v5.1.4...v5.2.0) (2019-07-18)
|
||||||
|
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue