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

maishu-chitu-scaffold

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

maishu-chitu-scaffold - npm Package Compare versions

Comparing version 1.14.0 to 1.15.0

.vscode/launch.json

5

demo/nws-config.js

@@ -1,4 +0,3 @@

const { pathConcat } = require("../../node-mvc/out");
const { getVirtualPaths } = require("../index");
let fileVirtualPaths = getVirtualPaths("static", pathConcat(__dirname, "static"));
const { sourceVirtualPaths } = require("../index");
let fileVirtualPaths = sourceVirtualPaths(__dirname);

@@ -5,0 +4,0 @@ module.exports = {

13

demo/package.json
{
"dependencies": {
"maishu-chitu-react": "^1.27.0",
"crossroads": "^0.12.2",
"maishu-chitu": "^3.28.0",
"maishu-chitu-react": "^1.30.0",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"requirejs": "^2.3.6"
"requirejs": "^2.3.6",
"signals": "^1.0.0"
},
"devDependencies": {
"@types/react": "^17.0.0"
"@babel/preset-env": "^7.13.12",
"@types/react": "^17.0.0",
"maishu-node-mvc": "^2.18.2",
"maishu-nws-mvc": "^1.7.3"
},

@@ -16,2 +21,2 @@ "name": "maishu-chitu-scaffold",

}
}
}
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"jsx": "react",
"noEmit": true
"noEmit": true,
"experimentalDecorators": true
}
}

@@ -9,5 +9,24 @@ "use strict";

let error = new Error(msg);
error.name = Errors.prototype.notPhysicalPath.name;
return error;
}
physicalPathNotExists(path) {
let msg = `Path '${path}' is not exists.`;
let error = new Error(msg);
error.name = Errors.prototype.physicalPathNotExists.name;
return error;
}
baseRouterNull() {
let msg = `Base router is null.`;
let error = new Error(msg);
error.name = Errors.prototype.baseRouterNull.name;
return error;
}
notMatchBaseRouter(url, router) {
let msg = `The url '${url}' is not match base router '${router}'.`;
let error = new Error(msg);
error.name = Errors.prototype.notMatchBaseRouter.name;
return error;
}
}
exports.errors = new Errors();

@@ -7,6 +7,25 @@ import { Errors as BaseErrors } from "maishu-toolkit";

let error = new Error(msg);
error.name = Errors.prototype.notPhysicalPath.name;
return error;
}
physicalPathNotExists(path: string) {
let msg = `Path '${path}' is not exists.`;
let error = new Error(msg);
error.name = Errors.prototype.physicalPathNotExists.name;
return error;
}
baseRouterNull() {
let msg = `Base router is null.`;
let error = new Error(msg);
error.name = Errors.prototype.baseRouterNull.name;
return error;
}
notMatchBaseRouter(url: string, router: string) {
let msg = `The url '${url}' is not match base router '${router}'.`;
let error = new Error(msg);
error.name = Errors.prototype.notMatchBaseRouter.name;
return error;
}
}
export let errors = new Errors();
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getVirtualPaths = void 0;
exports.sourceVirtualPaths = exports.getVirtualPaths = void 0;
const fs = require("fs");

@@ -8,2 +8,3 @@ const path = require("path");

const errors_1 = require("./errors");
const maishu_node_mvc_1 = require("maishu-node-mvc");
/** @param {string} [basePath] */

@@ -39,1 +40,30 @@ function getVirtualPaths(basePath, targetPath) {

exports.getVirtualPaths = getVirtualPaths;
/**
* 获取文件虚拟路径
* @param {string|VirtualDirectory} [rootDirectory]
*/
function sourceVirtualPaths(rootDirectory) {
if (!rootDirectory)
throw errors_1.errors.argumentNull("rootDirectory");
let root = typeof rootDirectory == "string" ? new maishu_node_mvc_1.VirtualDirectory(rootDirectory) : rootDirectory;
let virtualDirectories = ["static", "controllers"];
let result = {};
virtualDirectories.forEach(dir => {
let dirPhysicalPath = maishu_toolkit_1.pathConcat(__dirname, dir);
let files = fs.readdirSync(dirPhysicalPath);
for (let i = 0; i < files.length; i++) {
let p = maishu_toolkit_1.pathConcat(dirPhysicalPath, files[i]);
if (!fs.statSync(p).isFile())
continue;
if (files[i].endsWith(".d.ts"))
continue;
let dirRelativePath = maishu_toolkit_1.pathConcat(dir, files[i]);
if (root != null && root.findFile(dirRelativePath))
continue;
let virtuaPath = maishu_toolkit_1.pathConcat(dir, files[i]);
result[virtuaPath] = p;
}
});
return result;
}
exports.sourceVirtualPaths = sourceVirtualPaths;

@@ -5,2 +5,3 @@ import * as fs from "fs";

import { errors } from "./errors";
import { VirtualDirectory } from "maishu-node-mvc";

@@ -45,2 +46,41 @@ /** @param {string} [basePath] */

/**
* 获取文件虚拟路径
* @param {string|VirtualDirectory} [rootDirectory]
*/
export function sourceVirtualPaths(rootDirectory: string | VirtualDirectory) {
if (!rootDirectory)
throw errors.argumentNull("rootDirectory");
let root = typeof rootDirectory == "string" ? new VirtualDirectory(rootDirectory) : rootDirectory;
let virtualDirectories = ["static", "controllers"];
let result: { [key: string]: string } = {};
virtualDirectories.forEach(dir => {
let dirPhysicalPath = pathConcat(__dirname, dir);
let files = fs.readdirSync(dirPhysicalPath);
for (let i = 0; i < files.length; i++) {
let p = pathConcat(dirPhysicalPath, files[i]);
if (!fs.statSync(p).isFile())
continue;
if (files[i].endsWith(".d.ts"))
continue;
let dirRelativePath = pathConcat(dir, files[i]);
if (root != null && root.findFile(dirRelativePath))
continue;
let virtuaPath = pathConcat(dir, files[i]);
result[virtuaPath] = p;
}
})
return result;
}
{
"dependencies": {
"maishu-chitu-react": "^1.27.0",
"crossroads": "^0.12.2",
"maishu-chitu-react": "^1.30.0",
"maishu-requirejs-plugins": "^1.3.0",
"maishu-toolkit": "^1.6.1",
"requirejs": "^2.3.6"
"requirejs": "^2.3.6",
"url-pattern": "^1.0.3"
},

@@ -15,4 +18,6 @@ "devDependencies": {

"@babel/plugin-transform-typescript": "^7.8.3",
"@types/babel__core": "^7.1.14",
"@types/crossroads": "0.0.30",
"@types/node": "^14.14.33",
"maishu-requirejs-plugins": "^1.3.0",
"maishu-node-mvc": "^2.18.2",
"mocha": "^8.3.0",

@@ -24,3 +29,3 @@ "react": "^17.0.2",

"name": "maishu-chitu-scaffold",
"version": "1.14.0"
"version": "1.15.0"
}

@@ -10,1 +10,2 @@ exports["react"] = require("react");

exports["text"] = require("maishu-requirejs-plugins/lib/text");
exports["url-pattern"] = require("url-pattern");

@@ -6,2 +6,3 @@ {

"strict": true,
"experimentalDecorators": true
},

@@ -8,0 +9,0 @@ "compileOnSave": true,

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

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