@quilted/deno 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.quilt/jest/cache/haste-map-0d1fc0b2d0d6281bd555d7e706dc9986-33077ddc4445b8892d3a131c692f283d-2476e5caf667965f67e0306dc239f39f +0 -0
- package/.quilt/jest/cache/haste-map-39c473e25d2c113fabcf6ef63ff713e6-33077ddc4445b8892d3a131c692f283d-e7be052fff861377dbd13fb6283a7ebd +0 -0
- package/.quilt/jest/cache/haste-map-91c110a0020c6344757e7ecd75abc315-33077ddc4445b8892d3a131c692f283d-e8dbeaae2ab6a61a73f4f5dd75e91d8a +0 -0
- package/CHANGELOG.md +15 -0
- package/build/cjs/craft.cjs +1 -1
- package/build/esnext/request-router.esnext +2 -7
- package/build/tsconfig.tsbuildinfo +1 -1
- package/configuration/rollup.config.js +3 -0
- package/package.json +7 -22
- package/tsconfig.json +1 -1
- package/build/cjs/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/TemplateTag/TemplateTag.cjs +0 -168
- package/build/cjs/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/commaLists/commaLists.cjs +0 -8
- package/build/cjs/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/commaListsAnd/commaListsAnd.cjs +0 -8
- package/build/cjs/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/commaListsOr/commaListsOr.cjs +0 -8
- package/build/cjs/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/html/html.cjs +0 -10
- package/build/cjs/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/inlineArrayTransformer/inlineArrayTransformer.cjs +0 -48
- package/build/cjs/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/inlineLists/inlineLists.cjs +0 -8
- package/build/cjs/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/oneLine/oneLine.cjs +0 -7
- package/build/cjs/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/oneLineCommaLists/oneLineCommaLists.cjs +0 -8
- package/build/cjs/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/oneLineCommaListsAnd/oneLineCommaListsAnd.cjs +0 -8
- package/build/cjs/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/oneLineCommaListsOr/oneLineCommaListsOr.cjs +0 -8
- package/build/cjs/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/oneLineInlineLists/oneLineInlineLists.cjs +0 -8
- package/build/cjs/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/oneLineTrim/oneLineTrim.cjs +0 -7
- package/build/cjs/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/removeNonPrintingValuesTransformer/removeNonPrintingValuesTransformer.cjs +0 -23
- package/build/cjs/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/replaceResultTransformer/replaceResultTransformer.cjs +0 -22
- package/build/cjs/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/replaceSubstitutionTransformer/replaceSubstitutionTransformer.cjs +0 -22
- package/build/cjs/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/safeHtml/safeHtml.cjs +0 -10
- package/build/cjs/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/splitStringTransformer/splitStringTransformer.cjs +0 -20
- package/build/cjs/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/stripIndent/stripIndent.cjs +0 -11
- package/build/cjs/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/stripIndentTransformer/stripIndentTransformer.cjs +0 -37
- package/build/cjs/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/stripIndents/stripIndents.cjs +0 -7
- package/build/cjs/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/trimResultTransformer/trimResultTransformer.cjs +0 -33
- package/build/esm/craft.mjs +0 -104
- package/build/esm/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/TemplateTag/TemplateTag.mjs +0 -164
- package/build/esm/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/commaLists/commaLists.mjs +0 -6
- package/build/esm/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/commaListsAnd/commaListsAnd.mjs +0 -6
- package/build/esm/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/commaListsOr/commaListsOr.mjs +0 -6
- package/build/esm/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/html/html.mjs +0 -8
- package/build/esm/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/inlineArrayTransformer/inlineArrayTransformer.mjs +0 -44
- package/build/esm/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/inlineLists/inlineLists.mjs +0 -6
- package/build/esm/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/oneLine/oneLine.mjs +0 -5
- package/build/esm/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/oneLineCommaLists/oneLineCommaLists.mjs +0 -6
- package/build/esm/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/oneLineCommaListsAnd/oneLineCommaListsAnd.mjs +0 -6
- package/build/esm/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/oneLineCommaListsOr/oneLineCommaListsOr.mjs +0 -6
- package/build/esm/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/oneLineInlineLists/oneLineInlineLists.mjs +0 -6
- package/build/esm/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/oneLineTrim/oneLineTrim.mjs +0 -5
- package/build/esm/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/removeNonPrintingValuesTransformer/removeNonPrintingValuesTransformer.mjs +0 -19
- package/build/esm/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/replaceResultTransformer/replaceResultTransformer.mjs +0 -18
- package/build/esm/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/replaceSubstitutionTransformer/replaceSubstitutionTransformer.mjs +0 -18
- package/build/esm/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/safeHtml/safeHtml.mjs +0 -8
- package/build/esm/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/splitStringTransformer/splitStringTransformer.mjs +0 -16
- package/build/esm/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/stripIndent/stripIndent.mjs +0 -7
- package/build/esm/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/stripIndentTransformer/stripIndentTransformer.mjs +0 -33
- package/build/esm/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/stripIndents/stripIndents.mjs +0 -5
- package/build/esm/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/trimResultTransformer/trimResultTransformer.mjs +0 -29
- package/build/esnext/craft.esnext +0 -104
- package/build/esnext/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/TemplateTag/TemplateTag.esnext +0 -164
- package/build/esnext/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/commaLists/commaLists.esnext +0 -6
- package/build/esnext/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/commaListsAnd/commaListsAnd.esnext +0 -6
- package/build/esnext/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/commaListsOr/commaListsOr.esnext +0 -6
- package/build/esnext/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/html/html.esnext +0 -8
- package/build/esnext/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/inlineArrayTransformer/inlineArrayTransformer.esnext +0 -44
- package/build/esnext/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/inlineLists/inlineLists.esnext +0 -6
- package/build/esnext/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/oneLine/oneLine.esnext +0 -5
- package/build/esnext/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/oneLineCommaLists/oneLineCommaLists.esnext +0 -6
- package/build/esnext/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/oneLineCommaListsAnd/oneLineCommaListsAnd.esnext +0 -6
- package/build/esnext/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/oneLineCommaListsOr/oneLineCommaListsOr.esnext +0 -6
- package/build/esnext/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/oneLineInlineLists/oneLineInlineLists.esnext +0 -6
- package/build/esnext/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/oneLineTrim/oneLineTrim.esnext +0 -5
- package/build/esnext/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/removeNonPrintingValuesTransformer/removeNonPrintingValuesTransformer.esnext +0 -19
- package/build/esnext/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/replaceResultTransformer/replaceResultTransformer.esnext +0 -18
- package/build/esnext/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/replaceSubstitutionTransformer/replaceSubstitutionTransformer.esnext +0 -18
- package/build/esnext/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/safeHtml/safeHtml.esnext +0 -8
- package/build/esnext/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/splitStringTransformer/splitStringTransformer.esnext +0 -16
- package/build/esnext/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/stripIndent/stripIndent.esnext +0 -7
- package/build/esnext/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/stripIndentTransformer/stripIndentTransformer.esnext +0 -33
- package/build/esnext/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/stripIndents/stripIndents.esnext +0 -5
- package/build/esnext/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/trimResultTransformer/trimResultTransformer.esnext +0 -29
- package/quilt.project.ts +0 -5
- package/source/craft.ts +0 -128
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import TemplateTag from '../TemplateTag/TemplateTag.esnext';
|
|
2
|
-
import inlineArrayTransformer from '../inlineArrayTransformer/inlineArrayTransformer.esnext';
|
|
3
|
-
import trimResultTransformer from '../trimResultTransformer/trimResultTransformer.esnext';
|
|
4
|
-
import replaceResultTransformer from '../replaceResultTransformer/replaceResultTransformer.esnext';
|
|
5
|
-
|
|
6
|
-
new TemplateTag(inlineArrayTransformer({ separator: ',' }), replaceResultTransformer(/(?:\s+)/g, ' '), trimResultTransformer);
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import TemplateTag from '../TemplateTag/TemplateTag.esnext';
|
|
2
|
-
import inlineArrayTransformer from '../inlineArrayTransformer/inlineArrayTransformer.esnext';
|
|
3
|
-
import trimResultTransformer from '../trimResultTransformer/trimResultTransformer.esnext';
|
|
4
|
-
import replaceResultTransformer from '../replaceResultTransformer/replaceResultTransformer.esnext';
|
|
5
|
-
|
|
6
|
-
new TemplateTag(inlineArrayTransformer({ separator: ',', conjunction: 'and' }), replaceResultTransformer(/(?:\s+)/g, ' '), trimResultTransformer);
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import TemplateTag from '../TemplateTag/TemplateTag.esnext';
|
|
2
|
-
import inlineArrayTransformer from '../inlineArrayTransformer/inlineArrayTransformer.esnext';
|
|
3
|
-
import trimResultTransformer from '../trimResultTransformer/trimResultTransformer.esnext';
|
|
4
|
-
import replaceResultTransformer from '../replaceResultTransformer/replaceResultTransformer.esnext';
|
|
5
|
-
|
|
6
|
-
new TemplateTag(inlineArrayTransformer({ separator: ',', conjunction: 'or' }), replaceResultTransformer(/(?:\s+)/g, ' '), trimResultTransformer);
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import TemplateTag from '../TemplateTag/TemplateTag.esnext';
|
|
2
|
-
import inlineArrayTransformer from '../inlineArrayTransformer/inlineArrayTransformer.esnext';
|
|
3
|
-
import trimResultTransformer from '../trimResultTransformer/trimResultTransformer.esnext';
|
|
4
|
-
import replaceResultTransformer from '../replaceResultTransformer/replaceResultTransformer.esnext';
|
|
5
|
-
|
|
6
|
-
new TemplateTag(inlineArrayTransformer, replaceResultTransformer(/(?:\s+)/g, ' '), trimResultTransformer);
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import TemplateTag from '../TemplateTag/TemplateTag.esnext';
|
|
2
|
-
import trimResultTransformer from '../trimResultTransformer/trimResultTransformer.esnext';
|
|
3
|
-
import replaceResultTransformer from '../replaceResultTransformer/replaceResultTransformer.esnext';
|
|
4
|
-
|
|
5
|
-
new TemplateTag(replaceResultTransformer(/(?:\n\s*)/g, ''), trimResultTransformer);
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
var isValidValue = function isValidValue(x) {
|
|
2
|
-
return x != null && !Number.isNaN(x) && typeof x !== 'boolean';
|
|
3
|
-
};
|
|
4
|
-
|
|
5
|
-
var removeNonPrintingValuesTransformer = function removeNonPrintingValuesTransformer() {
|
|
6
|
-
return {
|
|
7
|
-
onSubstitution: function onSubstitution(substitution) {
|
|
8
|
-
if (Array.isArray(substitution)) {
|
|
9
|
-
return substitution.filter(isValidValue);
|
|
10
|
-
}
|
|
11
|
-
if (isValidValue(substitution)) {
|
|
12
|
-
return substitution;
|
|
13
|
-
}
|
|
14
|
-
return '';
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export { removeNonPrintingValuesTransformer as default };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Replaces tabs, newlines and spaces with the chosen value when they occur in sequences
|
|
3
|
-
* @param {(String|RegExp)} replaceWhat - the value or pattern that should be replaced
|
|
4
|
-
* @param {*} replaceWith - the replacement value
|
|
5
|
-
* @return {Object} - a TemplateTag transformer
|
|
6
|
-
*/
|
|
7
|
-
var replaceResultTransformer = function replaceResultTransformer(replaceWhat, replaceWith) {
|
|
8
|
-
return {
|
|
9
|
-
onEndResult: function onEndResult(endResult) {
|
|
10
|
-
if (replaceWhat == null || replaceWith == null) {
|
|
11
|
-
throw new Error('replaceResultTransformer requires at least 2 arguments.');
|
|
12
|
-
}
|
|
13
|
-
return endResult.replace(replaceWhat, replaceWith);
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export { replaceResultTransformer as default };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
var replaceSubstitutionTransformer = function replaceSubstitutionTransformer(replaceWhat, replaceWith) {
|
|
2
|
-
return {
|
|
3
|
-
onSubstitution: function onSubstitution(substitution, resultSoFar) {
|
|
4
|
-
if (replaceWhat == null || replaceWith == null) {
|
|
5
|
-
throw new Error('replaceSubstitutionTransformer requires at least 2 arguments.');
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
// Do not touch if null or undefined
|
|
9
|
-
if (substitution == null) {
|
|
10
|
-
return substitution;
|
|
11
|
-
} else {
|
|
12
|
-
return substitution.toString().replace(replaceWhat, replaceWith);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export { replaceSubstitutionTransformer as default };
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import TemplateTag from '../TemplateTag/TemplateTag.esnext';
|
|
2
|
-
import stripIndentTransformer from '../stripIndentTransformer/stripIndentTransformer.esnext';
|
|
3
|
-
import inlineArrayTransformer from '../inlineArrayTransformer/inlineArrayTransformer.esnext';
|
|
4
|
-
import trimResultTransformer from '../trimResultTransformer/trimResultTransformer.esnext';
|
|
5
|
-
import splitStringTransformer from '../splitStringTransformer/splitStringTransformer.esnext';
|
|
6
|
-
import replaceSubstitutionTransformer from '../replaceSubstitutionTransformer/replaceSubstitutionTransformer.esnext';
|
|
7
|
-
|
|
8
|
-
new TemplateTag(splitStringTransformer('\n'), inlineArrayTransformer, stripIndentTransformer, trimResultTransformer, replaceSubstitutionTransformer(/&/g, '&'), replaceSubstitutionTransformer(/</g, '<'), replaceSubstitutionTransformer(/>/g, '>'), replaceSubstitutionTransformer(/"/g, '"'), replaceSubstitutionTransformer(/'/g, '''), replaceSubstitutionTransformer(/`/g, '`'));
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
var splitStringTransformer = function splitStringTransformer(splitBy) {
|
|
2
|
-
return {
|
|
3
|
-
onSubstitution: function onSubstitution(substitution, resultSoFar) {
|
|
4
|
-
if (splitBy != null && typeof splitBy === 'string') {
|
|
5
|
-
if (typeof substitution === 'string' && substitution.includes(splitBy)) {
|
|
6
|
-
substitution = substitution.split(splitBy);
|
|
7
|
-
}
|
|
8
|
-
} else {
|
|
9
|
-
throw new Error('You need to specify a string character to split by.');
|
|
10
|
-
}
|
|
11
|
-
return substitution;
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export { splitStringTransformer as default };
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import TemplateTag from '../TemplateTag/TemplateTag.esnext';
|
|
2
|
-
import stripIndentTransformer from '../stripIndentTransformer/stripIndentTransformer.esnext';
|
|
3
|
-
import trimResultTransformer from '../trimResultTransformer/trimResultTransformer.esnext';
|
|
4
|
-
|
|
5
|
-
var stripIndent = new TemplateTag(stripIndentTransformer, trimResultTransformer);
|
|
6
|
-
|
|
7
|
-
export { stripIndent as default };
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* strips indentation from a template literal
|
|
5
|
-
* @param {String} type = 'initial' - whether to remove all indentation or just leading indentation. can be 'all' or 'initial'
|
|
6
|
-
* @return {Object} - a TemplateTag transformer
|
|
7
|
-
*/
|
|
8
|
-
var stripIndentTransformer = function stripIndentTransformer() {
|
|
9
|
-
var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'initial';
|
|
10
|
-
return {
|
|
11
|
-
onEndResult: function onEndResult(endResult) {
|
|
12
|
-
if (type === 'initial') {
|
|
13
|
-
// remove the shortest leading indentation from each line
|
|
14
|
-
var match = endResult.match(/^[^\S\n]*(?=\S)/gm);
|
|
15
|
-
var indent = match && Math.min.apply(Math, _toConsumableArray(match.map(function (el) {
|
|
16
|
-
return el.length;
|
|
17
|
-
})));
|
|
18
|
-
if (indent) {
|
|
19
|
-
var regexp = new RegExp('^.{' + indent + '}', 'gm');
|
|
20
|
-
return endResult.replace(regexp, '');
|
|
21
|
-
}
|
|
22
|
-
return endResult;
|
|
23
|
-
}
|
|
24
|
-
if (type === 'all') {
|
|
25
|
-
// remove all indentation from each line
|
|
26
|
-
return endResult.replace(/^[^\S\n]+/gm, '');
|
|
27
|
-
}
|
|
28
|
-
throw new Error('Unknown type: ' + type);
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export { stripIndentTransformer as default };
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import TemplateTag from '../TemplateTag/TemplateTag.esnext';
|
|
2
|
-
import stripIndentTransformer from '../stripIndentTransformer/stripIndentTransformer.esnext';
|
|
3
|
-
import trimResultTransformer from '../trimResultTransformer/trimResultTransformer.esnext';
|
|
4
|
-
|
|
5
|
-
new TemplateTag(stripIndentTransformer('all'), trimResultTransformer);
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* TemplateTag transformer that trims whitespace on the end result of a tagged template
|
|
3
|
-
* @param {String} side = '' - The side of the string to trim. Can be 'start' or 'end' (alternatively 'left' or 'right')
|
|
4
|
-
* @return {Object} - a TemplateTag transformer
|
|
5
|
-
*/
|
|
6
|
-
var trimResultTransformer = function trimResultTransformer() {
|
|
7
|
-
var side = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
8
|
-
return {
|
|
9
|
-
onEndResult: function onEndResult(endResult) {
|
|
10
|
-
if (side === '') {
|
|
11
|
-
return endResult.trim();
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
side = side.toLowerCase();
|
|
15
|
-
|
|
16
|
-
if (side === 'start' || side === 'left') {
|
|
17
|
-
return endResult.replace(/^\s*/, '');
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
if (side === 'end' || side === 'right') {
|
|
21
|
-
return endResult.replace(/\s*$/, '');
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
throw new Error('Side not supported: ' + side);
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export { trimResultTransformer as default };
|
package/quilt.project.ts
DELETED
package/source/craft.ts
DELETED
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
import {stripIndent} from 'common-tags';
|
|
2
|
-
|
|
3
|
-
import {createProjectPlugin, MAGIC_MODULE_REQUEST_ROUTER} from '@quilted/craft';
|
|
4
|
-
import type {
|
|
5
|
-
Project,
|
|
6
|
-
BuildProjectOptions,
|
|
7
|
-
DevelopProjectOptions,
|
|
8
|
-
ResolvedBuildProjectConfigurationHooks,
|
|
9
|
-
ResolvedDevelopProjectConfigurationHooks,
|
|
10
|
-
} from '@quilted/craft/kit';
|
|
11
|
-
import type {PolyfillFeature} from '@quilted/craft/polyfills';
|
|
12
|
-
import type {} from '@quilted/craft/browserslist';
|
|
13
|
-
|
|
14
|
-
export interface Options {}
|
|
15
|
-
|
|
16
|
-
export interface DenoDevelopHooks {}
|
|
17
|
-
|
|
18
|
-
declare module '@quilted/craft/kit' {
|
|
19
|
-
interface DevelopProjectConfigurationHooks extends DenoDevelopHooks {}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Configures any code generated for this project to run on Deno.
|
|
24
|
-
*/
|
|
25
|
-
export function deno(_: Options = {}) {
|
|
26
|
-
return createProjectPlugin({
|
|
27
|
-
name: 'Quilt.Deno',
|
|
28
|
-
build({project, configure}) {
|
|
29
|
-
configure(
|
|
30
|
-
addConfiguration({
|
|
31
|
-
project,
|
|
32
|
-
mode: 'production',
|
|
33
|
-
}),
|
|
34
|
-
);
|
|
35
|
-
},
|
|
36
|
-
// develop({project, configure, hooks}) {
|
|
37
|
-
// hooks<DenoDevelopHooks>(() => ({}));
|
|
38
|
-
|
|
39
|
-
// configure(
|
|
40
|
-
// addConfiguration({
|
|
41
|
-
// project,
|
|
42
|
-
// mode: 'development',
|
|
43
|
-
// }),
|
|
44
|
-
// );
|
|
45
|
-
// },
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function addConfiguration({mode}: {mode: string; project: Project}) {
|
|
50
|
-
return (
|
|
51
|
-
{
|
|
52
|
-
runtimes,
|
|
53
|
-
browserslistTargets,
|
|
54
|
-
rollupPlugins,
|
|
55
|
-
rollupNodeBundle,
|
|
56
|
-
quiltRequestRouterPort,
|
|
57
|
-
quiltRequestRouterHost,
|
|
58
|
-
quiltServiceOutputFormat,
|
|
59
|
-
quiltAppServerOutputFormat,
|
|
60
|
-
quiltRequestRouterRuntimeContent,
|
|
61
|
-
quiltPolyfillFeaturesForEnvironment,
|
|
62
|
-
quiltRuntimeEnvironmentVariables,
|
|
63
|
-
}: Partial<
|
|
64
|
-
ResolvedBuildProjectConfigurationHooks &
|
|
65
|
-
ResolvedDevelopProjectConfigurationHooks
|
|
66
|
-
>,
|
|
67
|
-
options: Partial<BuildProjectOptions & DevelopProjectOptions>,
|
|
68
|
-
) => {
|
|
69
|
-
if (!options.quiltAppServer && !options.quiltService) {
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
runtimes?.(() => [{target: 'deno'}]);
|
|
74
|
-
|
|
75
|
-
browserslistTargets?.(() => ['last 1 chrome version']);
|
|
76
|
-
|
|
77
|
-
rollupPlugins?.(async (plugins) => {
|
|
78
|
-
const {rollupReplaceProcessEnv} = await import('@quilted/craft/rollup');
|
|
79
|
-
|
|
80
|
-
return [
|
|
81
|
-
...plugins,
|
|
82
|
-
await rollupReplaceProcessEnv({mode, preserve: false}),
|
|
83
|
-
];
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
rollupNodeBundle?.(() => true);
|
|
87
|
-
|
|
88
|
-
quiltRuntimeEnvironmentVariables?.(() => `Deno.env.toObject()`);
|
|
89
|
-
|
|
90
|
-
quiltServiceOutputFormat?.(() => 'module');
|
|
91
|
-
quiltAppServerOutputFormat?.(() => 'module');
|
|
92
|
-
|
|
93
|
-
const polyfillsWithNativeWorkersSupport = new Set<PolyfillFeature>([
|
|
94
|
-
'crypto',
|
|
95
|
-
'fetch',
|
|
96
|
-
'abort-controller',
|
|
97
|
-
]);
|
|
98
|
-
|
|
99
|
-
quiltPolyfillFeaturesForEnvironment?.((features) => {
|
|
100
|
-
return features.filter(
|
|
101
|
-
(feature) => !polyfillsWithNativeWorkersSupport.has(feature),
|
|
102
|
-
);
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
// @see https://deno.land/api@v1.37.0?s=Deno.ServeOptions
|
|
106
|
-
quiltRequestRouterRuntimeContent?.(async () => {
|
|
107
|
-
const [port, host] = await Promise.all([
|
|
108
|
-
quiltRequestRouterPort!.run(undefined),
|
|
109
|
-
quiltRequestRouterHost!.run(undefined),
|
|
110
|
-
]);
|
|
111
|
-
|
|
112
|
-
return stripIndent`
|
|
113
|
-
import {createServeHandler} from '@quilted/deno/request-router';
|
|
114
|
-
import RequestRouter from ${JSON.stringify(
|
|
115
|
-
MAGIC_MODULE_REQUEST_ROUTER,
|
|
116
|
-
)};
|
|
117
|
-
|
|
118
|
-
const port = ${
|
|
119
|
-
port ?? `Number.parseInt(Deno.env.get('PORT') ?? '8080', 10)`
|
|
120
|
-
};
|
|
121
|
-
const hostname = ${host ? JSON.stringify(host) : 'undefined'};
|
|
122
|
-
const handleRequest = createServeHandler(RequestRouter);
|
|
123
|
-
|
|
124
|
-
Deno.serve({port, hostname}, handleRequest);
|
|
125
|
-
`;
|
|
126
|
-
});
|
|
127
|
-
};
|
|
128
|
-
}
|