chore(NA): remove src folder from kbn-h** pkgs

This commit is contained in:
Tiago Costa 2022-08-10 04:18:32 +01:00
parent ec5610bd5d
commit dcdf72bcc1
No known key found for this signature in database
GPG key ID: BAECC2D04A04C6EA
19 changed files with 83 additions and 71 deletions

View file

@ -1,10 +1,10 @@
1,11c1,21
< global.handlebarsEnv = null;
<
<
< beforeEach(function() {
< global.handlebarsEnv = Handlebars.create();
< });
<
<
< describe('basic context', function() {
< it('most basic', function() {
< expectTemplate('{{foo}}')
@ -17,15 +17,15 @@
> * Elasticsearch B.V. licenses this file to you under the MIT License.
> * See `packages/kbn-handlebars/LICENSE` for more information.
> */
>
> import Handlebars from '..';
>
> import Handlebars from '../..';
> import { expectTemplate } from '../__jest__/test_bench';
>
>
> describe('basic context', () => {
> it('most basic', () => {
> expectTemplate('{{foo}}').withInput({ foo: 'foo' }).toCompileTo('foo');
> });
>
>
> it('escaping', () => {
> expectTemplate('\\{{foo}}').withInput({ foo: 'food' }).toCompileTo('{{foo}}');
> expectTemplate('content \\{{foo}}').withInput({ foo: 'food' }).toCompileTo('content {{foo}}');
@ -37,24 +37,24 @@
< expectTemplate('\\{{foo}}')
< .withInput({ foo: 'food' })
< .toCompileTo('{{foo}}');
<
<
< expectTemplate('content \\{{foo}}')
< .withInput({ foo: 'food' })
< .toCompileTo('content {{foo}}');
<
<
< expectTemplate('\\\\{{foo}}')
< .withInput({ foo: 'food' })
< .toCompileTo('\\food');
<
<
< expectTemplate('content \\\\{{foo}}')
< .withInput({ foo: 'food' })
< .toCompileTo('content \\food');
<
<
< expectTemplate('\\\\ {{foo}}')
< .withInput({ foo: 'food' })
< .toCompileTo('\\\\ food');
< });
<
<
< it('compiling with a basic context', function() {
---
> it('compiling with a basic context', () => {
@ -87,23 +87,23 @@
68d52
< .withMessage('comments are ignored')
72,76c56
<
<
< expectTemplate(' {{~!-- long-comment --~}} blah').toCompileTo(
< 'blah'
< );
<
<
---
> expectTemplate(' {{~!-- long-comment --~}} blah').toCompileTo('blah');
78,82c58
<
<
< expectTemplate(' {{!-- long-comment --~}} blah').toCompileTo(
< ' blah'
< );
<
<
---
> expectTemplate(' {{!-- long-comment --~}} blah').toCompileTo(' blah');
84,87c60
<
<
< expectTemplate(' {{~!-- long-comment --}} blah').toCompileTo(
< ' blah'
< );
@ -198,7 +198,7 @@
---
> it('newlines', () => {
190d150
<
<
194,223c154,160
< it('escaping text', function() {
< expectTemplate("Awesome's")
@ -206,25 +206,25 @@
< "text is escaped so that it doesn't get caught on single quotes"
< )
< .toCompileTo("Awesome's");
<
<
< expectTemplate('Awesome\\')
< .withMessage("text is escaped so that the closing quote can't be ignored")
< .toCompileTo('Awesome\\');
<
<
< expectTemplate('Awesome\\\\ foo')
< .withMessage("text is escaped so that it doesn't mess up backslashes")
< .toCompileTo('Awesome\\\\ foo');
<
<
< expectTemplate('Awesome {{foo}}')
< .withInput({ foo: '\\' })
< .withMessage("text is escaped so that it doesn't mess up backslashes")
< .toCompileTo('Awesome \\');
<
<
< expectTemplate(" ' ' ")
< .withMessage('double quotes never produce invalid javascript')
< .toCompileTo(" ' ' ");
< });
<
<
< it('escaping expressions', function() {
< expectTemplate('{{{awesome}}}')
< .withInput({ awesome: "&'\\<>" })
@ -246,7 +246,7 @@
---
> it('escaping expressions', () => {
> expectTemplate('{{{awesome}}}').withInput({ awesome: "&'\\<>" }).toCompileTo("&'\\<>");
>
>
> expectTemplate('{{&awesome}}').withInput({ awesome: "&'\\<>" }).toCompileTo("&'\\<>");
232d168
< .withMessage('by default expressions should be escaped')
@ -540,7 +540,7 @@
---
> it('pass string literals', () => {
538,541c440
<
<
< expectTemplate('{{"foo"}}')
< .withInput({ foo: 'bar' })
< .toCompileTo('bar');
@ -555,19 +555,19 @@
---
> it('pass number literals', () => {
552,556c451
<
<
< expectTemplate('{{12}}')
< .withInput({ '12': 'bar' })
< .toCompileTo('bar');
<
<
---
> expectTemplate('{{12}}').withInput({ '12': 'bar' }).toCompileTo('bar');
558,562c453
<
<
< expectTemplate('{{12.34}}')
< .withInput({ '12.34': 'bar' })
< .toCompileTo('bar');
<
<
---
> expectTemplate('{{12.34}}').withInput({ '12.34': 'bar' }).toCompileTo('bar');
565c456
@ -583,11 +583,11 @@
---
> it('pass boolean literals', () => {
574,581c465,466
<
<
< expectTemplate('{{true}}')
< .withInput({ '': 'foo' })
< .toCompileTo('');
<
<
< expectTemplate('{{false}}')
< .withInput({ false: 'foo' })
< .toCompileTo('foo');

View file

@ -8,10 +8,10 @@
> * Elasticsearch B.V. licenses this file to you under the MIT License.
> * See `packages/kbn-handlebars/LICENSE` for more information.
> */
>
>
> import Handlebars from '..';
> import { expectTemplate } from '../__jest__/test_bench';
>
>
> describe('subexpressions', () => {
> it('arg-less helper', () => {
5c15
@ -219,7 +219,7 @@
< })
< .toCompileTo('<input aria-label="Name" placeholder="Example User" />');
< });
<
<
< it('in string params mode,', function() {
< expectTemplate('{{snog (blorg foo x=y) yeah a=b}}')
< .withCompileOptions({ stringParams: true })
@ -243,7 +243,7 @@
< );
< return a + b;
214,231d182
<
<
< blorg: function(a, options) {
< equals(
< options.types.length,
@ -264,7 +264,7 @@
233,248c184
< .toCompileTo('fooyeah');
< });
<
<
< it('as hashes in string params mode', function() {
< expectTemplate('{{blog fun=(bork)}}')
< .withCompileOptions({ stringParams: true })

View file

@ -12,16 +12,16 @@
< 'SafeString is equivalent to its underlying string'
< );
< });
<
<
< it('it should not escape SafeString properties', function() {
< var name = new Handlebars.SafeString('<em>Sean O&#x27;Malley</em>');
<
<
< expectTemplate('{{name}}')
< .withInput({ name: name })
< .toCompileTo('<em>Sean O&#x27;Malley</em>');
< });
< });
<
<
< describe('#escapeExpression', function() {
< it('shouhld escape html', function() {
< equals(
@ -33,7 +33,7 @@
< it('should not escape SafeString', function() {
< var string = new Handlebars.SafeString('foo<&"\'>');
< equals(Handlebars.Utils.escapeExpression(string), 'foo<&"\'>');
<
<
< var obj = {
< toHTML: function() {
< return 'foo<&"\'>';
@ -45,7 +45,7 @@
< equals(Handlebars.Utils.escapeExpression(''), '');
< equals(Handlebars.Utils.escapeExpression(undefined), '');
< equals(Handlebars.Utils.escapeExpression(null), '');
<
<
< equals(Handlebars.Utils.escapeExpression(false), 'false');
< equals(Handlebars.Utils.escapeExpression(0), '0');
< });
@ -54,7 +54,7 @@
< equals(Handlebars.Utils.escapeExpression([]), [].toString());
< });
< });
<
<
< describe('#isEmpty', function() {
< it('should not be empty', function() {
< equals(Handlebars.Utils.isEmpty(undefined), true);
@ -63,7 +63,7 @@
< equals(Handlebars.Utils.isEmpty(''), true);
< equals(Handlebars.Utils.isEmpty([]), true);
< });
<
<
< it('should be empty', function() {
< equals(Handlebars.Utils.isEmpty(0), false);
< equals(Handlebars.Utils.isEmpty([1]), false);
@ -71,18 +71,18 @@
< equals(Handlebars.Utils.isEmpty({ bar: 1 }), false);
< });
< });
<
<
< describe('#extend', function() {
< it('should ignore prototype values', function() {
< function A() {
< this.a = 1;
< }
< A.prototype.b = 4;
<
<
< var b = { b: 2 };
<
<
< Handlebars.Utils.extend(b, new A());
<
<
< equals(b.a, 1);
< equals(b.b, 2);
---
@ -92,10 +92,10 @@
> * Elasticsearch B.V. licenses this file to you under the MIT License.
> * See `packages/kbn-handlebars/LICENSE` for more information.
> */
>
>
> import Handlebars from '..';
> import { expectTemplate } from '../__jest__/test_bench';
>
>
> describe('utils', function () {
> describe('#SafeString', function () {
> it('constructing a safestring from a string and checking its type', function () {
@ -103,7 +103,7 @@
> expect(safe).toBeInstanceOf(Handlebars.SafeString);
> expect(safe.toString()).toEqual('testing 1, 2, 3');
> });
>
>
> it('it should not escape SafeString properties', function () {
> const name = new Handlebars.SafeString('<em>Sean O&#x27;Malley</em>');
> expectTemplate('{{name}}').withInput({ name }).toCompileTo('<em>Sean O&#x27;Malley</em>');

View file

@ -8,11 +8,21 @@ TYPES_PKG_REQUIRE_NAME = "@types/kbn__handlebars"
SOURCE_FILES = glob(
[
"src/**/*.ts",
"**/*.ts",
],
exclude = [
"**/*.config.js",
"**/*.mock.*",
"**/*.test.*",
"**/*.stories.*",
"**/__jest__/**",
"**/__snapshots__/**",
"**/integration_tests/**",
"**/mocks/**",
"**/scripts/**",
"**/storybook/**",
"**/test_fixtures/**",
"**/test_helpers/**",
],
)
@ -42,14 +52,12 @@ jsts_transpiler(
name = "target_node",
srcs = SRCS,
build_pkg_name = package_name(),
root_input_dir = "src",
)
jsts_transpiler(
name = "target_web",
srcs = SRCS,
build_pkg_name = package_name(),
root_input_dir = "src",
web = True,
)
@ -71,7 +79,6 @@ ts_project(
declaration_map = True,
emit_declaration_only = True,
out_dir = "target_types",
root_dir = "src",
tsconfig = ":tsconfig",
)

View file

@ -11,7 +11,7 @@
*/
import Handlebars from '.';
import { expectTemplate } from './__jest__/test_bench';
import { expectTemplate } from './src/__jest__/test_bench';
it('Handlebars.create', () => {
expect(Handlebars.create()).toMatchSnapshot();

View file

@ -3,7 +3,7 @@
* See `packages/kbn-handlebars/LICENSE` for more information.
*/
import Handlebars, { ExtendedCompileOptions, ExtendedRuntimeOptions } from '..';
import Handlebars, { ExtendedCompileOptions, ExtendedRuntimeOptions } from '../..';
declare global {
var kbnHandlebarsEnv: typeof Handlebars | null; // eslint-disable-line no-var

View file

@ -5,7 +5,7 @@
* See `packages/kbn-handlebars/LICENSE` for more information.
*/
import Handlebars from '..';
import Handlebars from '../..';
import { expectTemplate } from '../__jest__/test_bench';
describe('basic context', () => {

View file

@ -7,7 +7,7 @@
/* eslint-disable max-classes-per-file */
import Handlebars from '..';
import Handlebars from '../..';
import { expectTemplate } from '../__jest__/test_bench';
describe('builtin helpers', () => {

View file

@ -5,7 +5,7 @@
* See `packages/kbn-handlebars/LICENSE` for more information.
*/
import Handlebars from '..';
import Handlebars from '../..';
describe('compiler', () => {
const compileFns = ['compile', 'compileAST'];

View file

@ -5,7 +5,7 @@
* See `packages/kbn-handlebars/LICENSE` for more information.
*/
import Handlebars from '..';
import Handlebars from '../..';
import { expectTemplate } from '../__jest__/test_bench';
describe('data', () => {

View file

@ -5,7 +5,7 @@
* See `packages/kbn-handlebars/LICENSE` for more information.
*/
import Handlebars from '..';
import Handlebars from '../..';
import { expectTemplate } from '../__jest__/test_bench';
beforeEach(() => {

View file

@ -5,7 +5,7 @@
* See `packages/kbn-handlebars/LICENSE` for more information.
*/
import Handlebars from '..';
import Handlebars from '../..';
import { expectTemplate } from '../__jest__/test_bench';
describe('security issues', () => {

View file

@ -5,7 +5,7 @@
* See `packages/kbn-handlebars/LICENSE` for more information.
*/
import Handlebars from '..';
import Handlebars from '../..';
import { expectTemplate } from '../__jest__/test_bench';
describe('subexpressions', () => {

View file

@ -5,7 +5,7 @@
* See `packages/kbn-handlebars/LICENSE` for more information.
*/
import Handlebars from '..';
import Handlebars from '../..';
import { expectTemplate } from '../__jest__/test_bench';
describe('utils', function () {

View file

@ -5,13 +5,12 @@
"declarationMap": true,
"emitDeclarationOnly": true,
"outDir": "./target_types",
"rootDir": "src",
"types": [
"jest",
"node"
]
},
"include": [
"src/**/*.ts"
"**/*.ts"
]
}

View file

@ -7,11 +7,20 @@ PKG_REQUIRE_NAME = "@kbn/hapi-mocks"
SOURCE_FILES = glob(
[
"src/**/*.ts",
"**/*.ts",
],
exclude = [
"**/*.config.js",
"**/*.mock.*",
"**/*.test.*",
"**/*.stories.*",
"**/__snapshots__/**",
"**/integration_tests/**",
"**/mocks/**",
"**/scripts/**",
"**/storybook/**",
"**/test_fixtures/**",
"**/test_helpers/**",
],
)
@ -43,7 +52,6 @@ jsts_transpiler(
name = "target_node",
srcs = SRCS,
build_pkg_name = package_name(),
root_input_dir = "src",
)
ts_config(
@ -64,7 +72,6 @@ ts_project(
declaration_map = True,
emit_declaration_only = True,
out_dir = "target_types",
root_dir = "src",
tsconfig = ":tsconfig",
)

View file

@ -6,7 +6,7 @@
* Side Public License, v 1.
*/
import { createRequestMock } from './request';
import { createRequestMock } from './src/request';
export const hapiMocks = {
createRequest: createRequestMock,

View file

@ -5,7 +5,6 @@
"declarationMap": true,
"emitDeclarationOnly": true,
"outDir": "target_types",
"rootDir": "src",
"stripInternal": false,
"types": [
"jest",
@ -13,6 +12,6 @@
]
},
"include": [
"src/**/*"
"**/*.ts"
]
}