Commit bef2d77a authored by Akari Labs's avatar Akari Labs

line endings i guess

parent 3461ff7f
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# TypeScript v1 declaration files
typings/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
.env.test
# parcel-bundler cache (https://parceljs.org/)
.cache
# next.js build output
.next
# nuxt.js build output
.nuxt
# vuepress build output
.vuepress/dist
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# TypeScript v1 declaration files
typings/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
.env.test
# parcel-bundler cache (https://parceljs.org/)
.cache
# next.js build output
.next
# nuxt.js build output
.nuxt
# vuepress build output
.vuepress/dist
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
\ No newline at end of file
MIT License
Copyright (c) 2019 caela akari
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.
MIT License
Copyright (c) 2019 caela akari
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.
# inert2
# inert2
jsx compilation and rendering without react
\ No newline at end of file
const buble = require('buble');
const { JSDOM } = require('jsdom');
const dom = new JSDOM();
const getDom = require('./inertdom');
const inertdom = getDom(dom.window);
function transform(code) {
return `const inert = require(${JSON.stringify(__filename)}); ${buble.transform(code, {
jsx: 'inert.render',
objectAssign: 'Object.assign',
target: { chrome: 52 }
}).code}`;
}
module.exports = {
install() {
require.extensions['.jsx'] = (module, filename) => module._compile(transform(fs.readFileSync(filename, 'utf8')), filename);
},
render(tag, attrs, ...children) {
return inertdom.apply(null, arguments).outerHTML;
}
const buble = require('buble');
const { JSDOM } = require('jsdom');
const dom = new JSDOM();
const getDom = require('./inertdom');
const inertdom = getDom(dom.window);
function transform(code) {
return `const inert = require(${JSON.stringify(__filename)}); ${buble.transform(code, {
jsx: 'inert.render',
objectAssign: 'Object.assign',
target: { chrome: 52 }
}).code}`;
}
module.exports = {
install() {
require.extensions['.jsx'] = (module, filename) => module._compile(transform(fs.readFileSync(filename, 'utf8')), filename);
},
render(tag, attrs, ...children) {
return inertdom.apply(null, arguments).outerHTML;
}
};
\ No newline at end of file
/*
inertDOM
a ridiculously simple jsx dom function
Copyright 2019 caela and astra akari (lp0 and nocebo)
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.
*/
module.exports = function getDom(window) {
return function dom(tag, attrs, ...children) {
function reduceChild(child) {
if (Array.isArray(child)) return child.map(reduceChild);
return [child];
}
if (children.length === 1 && Array.isArray(children[0])) children = children[0];
if (children.length !== 0)
children = children.map(reduceChild)
.reduce((p, c) => p.concat(c));
var element;
switch (typeof tag) {
case 'function':
element = tag(attrs || {}, children);
break;
case 'string':
element = window.document.createElement(tag);
if (attrs) Object.keys(attrs).forEach(k => {
const a = attrs[k];
switch (typeof a) {
case 'boolean':
if (a) element.setAttribute(k, '');
break;
case 'function':
// a bit of a hack, but it works
if (k.startsWith('on')) {
element[k] = a;
break;
}
default:
element.setAttribute(k, a);
break;
}
});
function addChild(child) {
if (Array.isArray(child)) child.forEach(addChild);
else if (child instanceof window.HTMLElement) element.appendChild(child);
else if (child) element.append(child.toString());
}
addChild(children);
break;
}
return element;
}
/*
inertDOM
a ridiculously simple jsx dom function
Copyright 2019 caela and astra akari (lp0 and nocebo)
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.
*/
module.exports = function getDom(window) {
return function dom(tag, attrs, ...children) {
function reduceChild(child) {
if (Array.isArray(child)) return child.map(reduceChild);
return [child];
}
if (children.length === 1 && Array.isArray(children[0])) children = children[0];
if (children.length !== 0)
children = children.map(reduceChild)
.reduce((p, c) => p.concat(c));
var element;
switch (typeof tag) {
case 'function':
element = tag(attrs || {}, children);
break;
case 'string':
element = window.document.createElement(tag);
if (attrs) Object.keys(attrs).forEach(k => {
const a = attrs[k];
switch (typeof a) {
case 'boolean':
if (a) element.setAttribute(k, '');
break;
case 'function':
// a bit of a hack, but it works
if (k.startsWith('on')) {
element[k] = a;
break;
}
default:
element.setAttribute(k, a);
break;
}
});
function addChild(child) {
if (Array.isArray(child)) child.forEach(addChild);
else if (child instanceof window.HTMLElement) element.appendChild(child);
else if (child) element.append(child.toString());
}
addChild(children);
break;
}
return element;
}
}
\ No newline at end of file
{
"friendly_name": "inert",
"modules": {
"dom": {
"filename": "inertdom.js",
"provides": "jsx"
}
}
{
"friendly_name": "inert",
"modules": {
"dom": {
"filename": "inertdom.js",
"provides": "jsx"
}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment