Skip to content

Commit 193d5b0

Browse files
committed
first commit
0 parents  commit 193d5b0

File tree

7 files changed

+103
-0
lines changed

7 files changed

+103
-0
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.DS_Store
2+
.nyc_output
3+
coverage/
4+
node_modules/

.npmignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.DS_Store
2+
.nyc_output
3+
.eslintrc.json
4+
.travis.yml
5+
coverage/
6+
node_modules/
7+
rollup/
8+
test/

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package-lock=false

cjs/index.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
'use strict';
2+
module.exports = class ESXToken {
3+
// property/ies + interpolations + templates
4+
static STATIC_TYPE = 1 << 0; // 1
5+
static MIXED_TYPE = 1 << 1; // 2
6+
static RUNTIME_TYPE = 1 << 2; // 4
7+
static TEMPLATE_TYPE = 1 << 3; // 8
8+
9+
// angle-brackets kind
10+
static ELEMENT_TYPE = 1 << 6; // 64
11+
static FRAGMENT_TYPE = 1 << 7; // 128
12+
static COMPONENT_TYPE = 1 << 8; // 256
13+
14+
// the following utilities DO NOT NEED TO BE AVAILABLE or standardized
15+
// these are here to simplify, via a namespace, a possible Babel transformer
16+
17+
// child / properties
18+
static create = (type, value) => ({__proto__: ESXToken.prototype, type, value});
19+
20+
// specialized cases
21+
static property = (type, name, value) => ({__proto__: ESXToken.prototype, type, name, value});
22+
static template = (id, value) => ({__proto__: ESXToken.prototype, type: ESXToken.TEMPLATE_TYPE, id, value});
23+
static chevron = (type, value, properties, children) => ({__proto__: ESXToken.prototype, type, value, properties, children});
24+
static fragment = (...children) => ESXToken.chevron(ESXToken.FRAGMENT_TYPE, null, null, children);
25+
static element = (tag, properties, ...children) => ESXToken.chevron(ESXToken.ELEMENT_TYPE, tag, properties, children);
26+
static component = (fn, properties, ...children) => ESXToken.chevron(ESXToken.COMPONENT_TYPE, fn, properties, children);
27+
}

cjs/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"type":"commonjs"}

esm/index.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
export default class ESXToken {
2+
// property/ies + interpolations + templates
3+
static STATIC_TYPE = 1 << 0; // 1
4+
static MIXED_TYPE = 1 << 1; // 2
5+
static RUNTIME_TYPE = 1 << 2; // 4
6+
static TEMPLATE_TYPE = 1 << 3; // 8
7+
8+
// angle-brackets kind
9+
static ELEMENT_TYPE = 1 << 6; // 64
10+
static FRAGMENT_TYPE = 1 << 7; // 128
11+
static COMPONENT_TYPE = 1 << 8; // 256
12+
13+
// the following utilities DO NOT NEED TO BE AVAILABLE or standardized
14+
// these are here to simplify, via a namespace, a possible Babel transformer
15+
16+
// child / properties
17+
static create = (type, value) => ({__proto__: ESXToken.prototype, type, value});
18+
19+
// specialized cases
20+
static property = (type, name, value) => ({__proto__: ESXToken.prototype, type, name, value});
21+
static template = (id, value) => ({__proto__: ESXToken.prototype, type: ESXToken.TEMPLATE_TYPE, id, value});
22+
static chevron = (type, value, properties, children) => ({__proto__: ESXToken.prototype, type, value, properties, children});
23+
static fragment = (...children) => ESXToken.chevron(ESXToken.FRAGMENT_TYPE, null, null, children);
24+
static element = (tag, properties, ...children) => ESXToken.chevron(ESXToken.ELEMENT_TYPE, tag, properties, children);
25+
static component = (fn, properties, ...children) => ESXToken.chevron(ESXToken.COMPONENT_TYPE, fn, properties, children);
26+
}

package.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"name": "esxtoken",
3+
"version": "0.0.0",
4+
"description": "The ESXToken class",
5+
"main": "./cjs/index.js",
6+
"scripts": {
7+
"build": "npm run cjs",
8+
"cjs": "ascjs --no-default esm cjs"
9+
},
10+
"keywords": [
11+
"esx",
12+
"polyfill"
13+
],
14+
"author": "Andrea Giammarchi",
15+
"license": "ISC",
16+
"devDependencies": {
17+
"ascjs": "^5.0.1"
18+
},
19+
"module": "./esm/index.js",
20+
"type": "module",
21+
"exports": {
22+
".": {
23+
"import": "./esm/index.js",
24+
"default": "./cjs/index.js"
25+
},
26+
"./package.json": "./package.json"
27+
},
28+
"repository": {
29+
"type": "git",
30+
"url": "git+https://github.com/ungap/esxtoken.git"
31+
},
32+
"bugs": {
33+
"url": "https://github.com/ungap/esxtoken/issues"
34+
},
35+
"homepage": "https://github.com/ungap/esxtoken#readme"
36+
}

0 commit comments

Comments
 (0)