Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

basisjs-tools

Package Overview
Dependencies
Maintainers
1
Versions
96
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

basisjs-tools - npm Package Compare versions

Comparing version 0.0.33 to 0.0.34

lib/build/html/coffeecompiler.js

9

lib/build/css/extract.js

@@ -58,3 +58,3 @@

file.link(flow.files.add({
var styleFile = flow.files.add({
type: 'style',

@@ -66,4 +66,9 @@ baseURI: file.baseURI,

content: html_at.getText(node)
}));
});
if (attrs['build-filename'])
styleFile.sourceFilename = attrs['build-filename'];
file.link(styleFile);
break;

@@ -70,0 +75,0 @@

@@ -115,3 +115,29 @@ var htmlparser = require('htmlparser2');

token[key] = cfg[key];
},
insertBefore: function(refToken, token){
if (refToken.parent)
{
var children = refToken.parent.children;
var idx = children.indexOf(refToken);
token.parent = refToken.parent;
if (idx == -1)
children.push(token);
else
children.splice(idx, 0, token);
}
},
insertAfter: function(refToken, token){
if (refToken.parent)
{
var children = refToken.parent.children;
var idx = children.indexOf(refToken);
token.parent = refToken.parent;
if (idx == -1)
children.push(token);
else
children.splice(idx + 1, 0, token);
}
}
};

@@ -12,2 +12,3 @@

preprocessFile(flow, file);
processFile(file);

@@ -28,5 +29,26 @@

function preprocessFile(flow, file){
var handlers = (flow.options.preprocess && flow.options.preprocess.html) || []//'./py.js'];
file.content = handlers.reduce(function(result, processorPath){
try {
var processor = require(processorPath);
if (typeof processor.process == 'function')
return processor.process(result, file, flow);
else
{
flow.console.log('[WARN] Preprocessor has no process function. Skipped.');
}
} catch(e) {
flow.console.log('[WARN] Error on preprocessor load: ' + e);
}
return result;
}, file.content);
}
function processFile(file){
// get ast
var ast = at.parse(file.content);
//process.exit();

@@ -33,0 +55,0 @@ // debug output

@@ -80,2 +80,3 @@

// input file graph
options.target == 'file-map' ? require('./misc/makeFileMap') : false,
options.target == 'input-graph' ? require('./misc/makeInputGraph') : false,

@@ -82,0 +83,0 @@

@@ -114,3 +114,3 @@

case 'basis':
var isCoreFile = basisFile && (flow.options.jsSingleFile || name == 'basis');
var isCoreFile = basisFile && flow.js.rootNSFile[name] === basisFile; //(flow.options.jsSingleFile || name == 'basis');
var throwCodes = package.reduce(function(res, file){

@@ -117,0 +117,0 @@ res.push.apply(res, file.throwCodes);

@@ -5,2 +5,3 @@

var utils = require('../misc/utils');
var path = require('path');

@@ -105,7 +106,3 @@ var NON_WHITESPACE = /[^\s\r\n]/;

fconsole.log('[i] basis.js marker found (basis-config attribute)');
scriptFile.htmlFile = file;
scriptFile.basisScript = true;
scriptFile.basisConfig = attrs[configAttr] || '';
scriptFile.namespace = 'basis';
scriptFile.package = 'basis';
processBasisFile(flow, scriptFile, file, attrs[configAttr] || '');
}

@@ -120,3 +117,3 @@

file.link(flow.files.add({
var scriptFile = flow.files.add({
htmlNode: node,

@@ -128,4 +125,9 @@ type: 'script',

package: 'script' + (scriptSequenceId || '')
}));
})
if (attrs['build-filename'])
scriptFile.sourceFilename = attrs['build-filename'];
file.link(scriptFile);
fconsole.endl();

@@ -161,55 +163,5 @@ }

//
// Search for basis.js
// Check for basis.js
//
fconsole.start('Search for basis.js');
for (var i = 0, file; file = queue[i]; i++)
if (file.type == 'script' && file.basisScript)
{
fconsole.log('[OK] basis.js found at path ' + file.relpath);
flow.js.rootNSFile.basis = file;
flow.js.basisScript = file.filename;
//
// parse basis config
//
fconsole.start('Parse config:');
var config = {};
try {
config = Function('return{' + file.basisConfig + '}')();
} catch(e) {
fconsole.log('[WARN] basis-config parse fault: ' + e);
}
if (!config.path)
config.path = {};
for (var key in config.path)
{
flow.js.rootBaseURI[key] = file.htmlFile.resolve(config.path[key]) + '/';
fconsole.log('Path found for ' + key + ': ' + config.path[key] + ' -> ' + flow.js.rootBaseURI[key]);
}
if (config.autoload)
{
var filename = file.htmlFile.resolve((flow.js.rootBaseURI[config.autoload] || '') + config.autoload + '.js');
fconsole.log('Autoload for `' + config.autoload + '` found: ' + filename);
var autoloadFile = flow.files.add({
filename: filename,
namespace: config.autoload,
package: 'basis'//config.autoload
});
createScope(autoloadFile, flow);
flow.js.rootNSFile[config.autoload] = autoloadFile;
flow.js.globalScope.put(config.autoload, 'global', {}); // ?? remove
}
fconsole.end();
break;
}
if (!flow.js.basisScript)

@@ -220,4 +172,2 @@ {

fconsole.endl();
//

@@ -248,3 +198,51 @@ // Process files

function processBasisFile(flow, file, htmlFile, attrValue){
var fconsole = flow.console;
file.htmlFile = htmlFile;
file.basisScript = true;
file.basisConfig = attrValue;
file.namespace = 'basis';
file.package = 'basis';
flow.js.rootNSFile.basis = file;
flow.js.basisScript = file.filename;
//
// parse basis config
//
fconsole.start(' Parse config:');
var config = {};
try {
config = Function('return{' + file.basisConfig + '}')();
} catch(e) {
fconsole.log(' [WARN] basis-config parse fault: ' + e);
}
if (!config.path)
config.path = {};
for (var key in config.path)
{
flow.js.rootBaseURI[key] = file.htmlFile.resolve(config.path[key]) + '/';
fconsole.log(' * Path found for `' + key + '`: ' + config.path[key] + ' -> ' + flow.js.rootBaseURI[key]);
}
if (config.autoload)
{
fconsole.log(' * Autoload for `' + config.autoload + '` found: ' + file.htmlFile.resolve((flow.js.rootBaseURI[config.autoload] || '') + config.autoload + '.js'));
html_at.insertAfter(file.htmlNode, {
type: 'tag',
name: 'script',
children: [{
type: 'text',
data: 'basis.require("' + config.autoload + '");'
}]
});
}
fconsole.end();
}
function getFileContext(file){

@@ -457,7 +455,8 @@ return {

// TODO: resolve filename relative to html file
var filename = flow.js.rootBaseURI[root] ? path.resolve(flow.js.rootBaseURI[root] + root + '.js') : root + '.js';
var filename = path.resolve(flow.js.rootBaseURI[root] || path.dirname(flow.options.file), root + '.js');
rootFile = flow.files.add({
isBasisModule: true,
filename: filename,
namespace: root,
package: 'basis'//root
package: root
});

@@ -464,0 +463,0 @@ flow.js.rootNSFile[root] = rootFile;

@@ -12,4 +12,8 @@

{
//file.package = 'script';
fconsole.log(file.package + ' <- ' + file.relpath);
var rootFile = flow.js.rootNSFile[file.package];
if (rootFile && rootFile.isBasisModule)
{
fconsole.log('basis <- ' + file.package + ' (' + file.relpath + ')');
file.package = 'basis';
}
}

@@ -16,0 +20,0 @@ }

@@ -22,2 +22,4 @@

'.svg': 'svg',
'.cur': 'image',
'.ico': 'image',
'.bmp': 'image',

@@ -24,0 +26,0 @@ '.gif': 'image',

@@ -55,3 +55,3 @@ /* graph generator */

if (!file.graphName)
file.graphName = '[no filename ' + (noFilenameSeed++) + ']';
file.graphName = file.sourceFilename || '[no filename ' + (noFilenameSeed++) + ']';
return '"' + file.graphName + '"';

@@ -58,0 +58,0 @@ }

@@ -19,3 +19,3 @@

var targets = ['zip', 'input-graph', 'output-graph', 'fs']; // last is default
var targets = ['zip', 'file-map', 'input-graph', 'output-graph', 'fs']; // last is default
var handlers = {

@@ -22,0 +22,0 @@ pack: function(){

{
"name": "basisjs-tools",
"title": "Basis developer tools",
"version": "0.0.33",
"version": "0.0.34",
"homepage": "https://github.com/lahmatiy/basisjs-tools",

@@ -6,0 +6,0 @@ "description": "Developer tools for basis.js framework",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc