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

js-mvc-framework

Package Overview
Dependencies
Maintainers
0
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

js-mvc-framework - npm Package Compare versions

Comparing version 1.2.27 to 1.2.28

demonstrament/.certificates.js

82

demonstrament/application/pilers/ejs.piler.js

@@ -11,44 +11,50 @@ import createDir from '../coutil/createDir/index.js'

if($settings.outputType === 'server') {
const model = JSON.parse(
await readFile($settings.model)
)
const viewPile = await ejs.renderFile($settings.input, model, {
async: true,
localsName: '$content',
root: [
path.join(
process.env.PWD, 'application/templates',
)
],
})
const viewPileBeautify = beautify.html(viewPile, {
maxPreserveNewlines: 0,
indentSize: 2,
indentChar: ' ',
})
writeFile($settings.output, viewPileBeautify, ($err) => console.log)
try {
const model = JSON.parse(
await readFile($settings.model)
)
const viewPile = await ejs.renderFile($settings.input, model, {
async: true,
localsName: '$content',
root: [
path.join(
process.env.PWD, 'application/templates',
)
],
})
const viewPileBeautify = beautify.html(viewPile, {
maxPreserveNewlines: 0,
indentSize: 2,
indentChar: ' ',
})
writeFile($settings.output, viewPileBeautify, ($err) => console.log)
}
catch($err) { console.log($err) }
}
// Client
else if($settings.outputType === 'client') {
const viewTemplate = await readFile($path)
.then(($viewTemplate) => $viewTemplate.toString())
const viewPile = ejs.compile(viewTemplate, {
_with: false,
localsName: '$content',
client: true,
compileDebug: false,
})
const viewPileString = [
'export default', viewPile.toString()
].join(' ')
const viewPileBeautify = beautify.js(viewPileString, {
maxPreserveNewlines: 0,
indentSize: 2,
indentChar: ' ',
})
const viewPilePath = $path
.replace(new RegExp(/\$/), '')
.replace(new RegExp(/.ejs$/), '.js')
writeFile(viewPilePath, viewPileBeautify, ($err) => console.log)
try {
const viewTemplate = await readFile($path)
.then(($viewTemplate) => $viewTemplate.toString())
const viewPile = ejs.compile(viewTemplate, {
_with: false,
localsName: '$content',
client: true,
compileDebug: false,
})
const viewPileString = [
'export default', viewPile.toString()
].join(' ')
const viewPileBeautify = beautify.js(viewPileString, {
maxPreserveNewlines: 0,
indentSize: 2,
indentChar: ' ',
})
const viewPilePath = $path
.replace(new RegExp(/\$/), '')
.replace(new RegExp(/.ejs$/), '.js')
writeFile(viewPilePath, viewPileBeautify, ($err) => console.log)
}
catch($err) { console.log($err) }
}
}

@@ -5,11 +5,14 @@ import * as rollup from 'rollup'

await createDir($settings.output)
const rollupPile = await rollup.rollup({
external: $settings.external,
input: $settings.input,
})
await rollupPile.write({
file: $settings.output,
format: 'es',
sourcemap: true
})
try {
const rollupPile = await rollup.rollup({
external: $settings.external,
input: $settings.input,
})
await rollupPile.write({
file: $settings.output,
format: 'es',
sourcemap: true
})
}
catch($err) { console.log($err) }
}

@@ -16,5 +16,4 @@ import path from 'node:path'

)
var sassPile
try {
sassPile = sass.compile($settings.input, {
const sassPile = sass.compile($settings.input, {
sourceMap: true,

@@ -25,8 +24,8 @@ sourceMapIncludeSources: true,

})
const sassPileCSS = sassPile.css.concat(sassPileSourceMapPend)
const sassPileSourceMap =JSON.stringify(sassPile.sourceMap)
await writeFile(sassPilePath, sassPileCSS)
await writeFile(sassPileSourceMapPath, sassPileSourceMap)
}
catch($err) { return }
const sassPileCSS = sassPile.css.concat(sassPileSourceMapPend)
const sassPileSourceMap =JSON.stringify(sassPile.sourceMap)
await writeFile(sassPilePath, sassPileCSS)
await writeFile(sassPileSourceMapPath, sassPileSourceMap)
catch($err) { console.log($err) }
}

@@ -8,21 +8,27 @@ import createDir from '../coutil/createDir/index.js'

if($settings.outputType === 'path') {
await createDir($settings.output)
await cp($path, path.join(
$settings.output
), {
force: true,
recursive: true,
})
try {
await createDir($settings.output)
await cp($path, path.join(
$settings.output
), {
force: true,
recursive: true,
})
}
catch($err) { console.log($err) }
}
else if($settings.outputType === 'glob') {
await createDir($path)
await cp($path, $path.replace(
new RegExp(`^${$route.source}`),
$route.target
), {
force: true,
recursive: true,
})
try {
await createDir($path)
await cp($path, $path.replace(
new RegExp(`^${$route.source}`),
$route.target
), {
force: true,
recursive: true,
})
}
catch($err) { console.log($err) }
}
}
}

@@ -42,17 +42,9 @@ import { Control } from '/dependencies/mvc-framework.js'

"": {
"name": "Index Alias",
"name": "index-alias",
"class": "Index",
},
"/": {
"name": "Index",
"name": "index",
"class": "Index",
},
"/subfolder": {
"name": "Subfolder",
"class": "Subfolder",
},
"/subfolder/:fileID": {
"name": "Subfolder File",
"class": "SubfolderFile",
}
}

@@ -63,4 +55,7 @@ }

events: {
"routers.location.default.window load": function route($event) {
this.routers.location.default.navigate()
},
"routers.location.default route": function route($event) {
this.start()
console.log($event.type, $event)
},

@@ -67,0 +62,0 @@ // "routers.location.default error": ($event) => {

@@ -13,3 +13,7 @@ import { recursiveAssign } from '../../Coutil/index.js'

#_route
#_enable
#_boundPopState
#regularExpressions = {
windowLocationOrigin: new RegExp(`^${this.window.location.origin}`)
}
constructor($settings, $options) {

@@ -20,5 +24,3 @@ super(

)
this.window
this.enableEvents()
// this.#popState()
}

@@ -28,4 +30,2 @@ get window() {

this.#_window = window
this.#_window.addEventListener('load', this.#boundPopState, { once: true })
this.#_window.addEventListener('popstate', this.#boundPopState)
return this.#_window

@@ -52,2 +52,13 @@ }

get route() { return this.#_route }
get enable() { return this.#_enable }
set enable($enable) {
if(this.#_enable === $enable) return
if(this.#_enable === true) {
this.#_window.addEventListener('popstate', this.#boundPopState)
}
else if(this.#_enable === false) {
this.#_window.removeEventListener('popstate', this.#boundPopState)
}
this.#_enable = $enable
}
get #boundPopState() {

@@ -58,7 +69,15 @@ if(this.#_boundPopState !== undefined) return this.#_boundPopState

}
#popState($event) { this.navigate($event.currentTarget.location) }
// Methods
#popState() {
navigate($path) {
$path = ($path === undefined) ? String(this.window.location) : $path
const { windowLocationOrigin } = this.#regularExpressions
let url
if($path.match(windowLocationOrigin)) { url = new URL($path) }
else { url = new URL($path, this.window.location.origin) }
const { pathname, hash, href, origin } = url
const preterRoute = this.route
if(preterRoute) preterRoute.active = false
const { pathname, hash } = this.window.location
if(preterRoute) {
preterRoute.active = false
}
const path = (this.hashpath) ? hash.slice(1) : pathname

@@ -68,3 +87,3 @@ const { route, location } = this.#matchRoute(path)

route.active = true
location.state = history.state
location.state = this.window.history.state
location.pathname = this.window.location.pathname

@@ -102,3 +121,3 @@ location.hash = this.window.location.hash

const routeSettings = recursiveAssign({
basename: $routePath,
pathname: $routePath,
}, $routeSettings)

@@ -105,0 +124,0 @@ this.#_routes[$routePath] = new Route(routeSettings)

@@ -10,2 +10,3 @@ import { match } from '../../../node_modules/path-to-regexp/dist/index.js'

this.#settings = $settings
console.log(this)
}

@@ -19,3 +20,3 @@ get #settings() { return this.#_settings }

}
get basename() { return this.#settings.basename }
get pathname() { return this.#settings.pathname }
get enable() {

@@ -42,5 +43,5 @@ if(this.#_enable !== undefined) return this.#_enable

if(this.#_match !== undefined) return this.#_match
this.#_match = match(this.basename)
this.#_match = match(this.pathname)
return this.#_match
}
}
{
"name": "js-mvc-framework",
"author": "Thomas Patrick Welborn",
"version": "1.2.27",
"version": "1.2.28",
"type": "module",

@@ -6,0 +6,0 @@ "scripts": {

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

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