New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

node-kpc

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-kpc - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

sample/expect/app/name-fac.js

2

index.js

@@ -75,4 +75,4 @@ var esprima = require('esprima');

ret.modules = kissyAddFunctions.map(tools.getKissyModuleInfo);
escodegen.attachComments(ast, ast.comments, ast.tokens);
escodegen.attachComments(ast, ast.comments, ast.tokens);
ret.genCode = escodegen.generate(ast, genOptions);

@@ -79,0 +79,0 @@

@@ -216,2 +216,3 @@ var path = require('path');

function fixModuleName(astAdd, srcFile, pkg) {
var callExpression = astAdd.expression;

@@ -221,6 +222,8 @@ var args = callExpression.arguments;

var moduleName = getModuleName(pkg, srcFile);
newArgs.push(toAst(moduleName));
if (!args.length || args.length === 3) {

@@ -230,8 +233,15 @@ return astAdd;

// KISSY.add(function(){}), KISSY.add('foo');
if (args[0].type === 'FunctionExpression' || args.length === 1) {
if (args.length > 1 && args[0].type === esprima.Syntax.Literal) {
newArgs.push(args[0]);
newArgs.push(args[1]);
newArgs.push(checkKISSYRequire(args[0], args[1]));
} else if (args[0].type === 'FunctionExpression' || args.length === 1) {
newArgs.push(toAst(moduleName));
newArgs.push(args[0]);
newArgs.push(checkKISSYRequire(args[0], args[1]));
}
callExpression.arguments = newArgs;

@@ -238,0 +248,0 @@

{
"name": "node-kpc",
"version": "0.1.0",
"version": "0.1.1",
"description": "build KISSY packages",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -10,4 +10,5 @@ # KPC

- Simple
- For KISSY 1.3 or 1.4 only
- For Online Combo Only
- KISSY 1.3+
- Online combo only
- Support CJS Style

@@ -24,3 +25,3 @@ ## Installation

#### Build a Package!
#### Case1. Build all file in a Package

@@ -42,4 +43,53 @@ ``` js

#### Specify Files to build
<table>
<thead>
<tr>
<th>Before</th>
<th>After</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<pre>
sample/src
├── app
│   ├── cjs-full.js
│   ├── cjs.js
│   ├── fac-config.js
│   ├── name-fac-config.js
│   ├── no-kissy.js
│   ├── object.js
│   └── string.js
└── pages
└── home
├── index.js
└── mod.js
</pre>
</td>
<td>
<pre>
sample/build
├── app
│   ├── cjs-full.js
│   ├── cjs.js
│   ├── fac-config.js
│   ├── name-fac-config.js
│   ├── no-kissy.js
│   ├── object.js
│   └── string.js
├── map.js
└── pages
└── home
├── index.js
└── mod.js
</pre>
</td>
</tr>
</tbody>
</table>
#### Case2. Specify Files to build
``` js

@@ -56,13 +106,55 @@ var kpc = require('node-kpc');

depFile: 'sample/build/map.js' //
}, [
'sample/src/app/*.js',
'sample/src/pages/*.js'
]);
}, ['sample/src/app/*.js']);
```
After build:
<table>
<thead>
<tr>
<th>src</th>
<th>dest</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<pre>
sample/src
├── app
│   ├── cjs-full.js
│   ├── cjs.js
│   ├── fac-config.js
│   ├── name-fac-config.js
│   ├── no-kissy.js
│   ├── object.js
│   └── string.js
└── pages
└── home
├── index.js
└── mod.js
</pre>
</td>
<td>
<pre>
sample/build
├── app
│   ├── cjs-full.js
│   ├── cjs.js
│   ├── fac-config.js
│   ├── name-fac-config.js
│   ├── no-kissy.js
│   ├── object.js
│   └── string.js
└─ map.js
</pre>
</td>
</tr>
</tbody>
</table>
#### Compile a package (all file in package path)
#### Case3. Compile a package (all file in package path)
````js

@@ -118,3 +210,3 @@ var kpc = require('node-kpc');

#### Specify files to compile
#### Case4. Specify files to compile

@@ -121,0 +213,0 @@ ````js

@@ -19,3 +19,3 @@ var expect = require('expect.js');

it('should compile all files', function(){
expect(pkg.files.length).to.be(9);
expect(pkg.files.length).to.be(10);

@@ -67,3 +67,3 @@ pkg.files.forEach(function(file) {

it('should compile 7 files', function(){
expect(pkg.files.length).to.be(7);
expect(pkg.files.length).to.be(8);
});

@@ -70,0 +70,0 @@ });

@@ -34,5 +34,11 @@ var expect = require('expect.js');

it('should build dep file', function () {
it('should kissy module with name and factory', function () {
fileEql('sample/build/map.js', 'sample/expect/map.js');
});
it('should build dep file', function () {
fileEql('sample/build/app/name-fac.js', 'sample/expect/app/name-fac.js');
});
it('should build cjs style module (app/cjs.js)', function () {

@@ -39,0 +45,0 @@ fileEql('sample/build/app/cjs.js', 'sample/expect/app/cjs.js');

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