Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cascade
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Akari Labs
cascade
Commits
d839a0c1
Commit
d839a0c1
authored
Jun 20, 2019
by
Akari Labs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bugs in array-style webpack hook
parent
5f4c634a
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
152 additions
and
52 deletions
+152
-52
.gitignore
.gitignore
+88
-0
index.js
index.js
+1
-1
modules/cascade.orchestra.js
modules/cascade.orchestra.js
+0
-0
modules/cascade.webpack.abstraction.js
modules/cascade.webpack.abstraction.js
+61
-51
modules/cascade.webpack.js
modules/cascade.webpack.js
+2
-0
No files found.
.gitignore
0 → 100644
View file @
d839a0c1
# 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
index.js
View file @
d839a0c1
...
...
@@ -3,7 +3,7 @@ const path = require('path');
const
modules
=
path
.
join
(
__dirname
,
'
modules
'
);
module
.
exports
=
nanopack
=>
{
nanopack
.
pushFile
(
path
.
join
(
modules
,
'
cascade.orchestra
te
.js
'
),
{
nanopack
.
pushFile
(
path
.
join
(
modules
,
'
cascade.orchestra.js
'
),
{
provides
:
'
conductor
'
});
nanopack
.
pushFile
(
path
.
join
(
modules
,
'
cascade.webpack.abstraction.js
'
));
...
...
modules/cascade.orchestra
te
.js
→
modules/cascade.orchestra.js
View file @
d839a0c1
File moved
modules/cascade.webpack.abstraction.js
View file @
d839a0c1
...
...
@@ -22,8 +22,8 @@ module.exports = {
hookWebpack
(
pushHook
,
mod
)
{
var
_webpack
;
var
_style
;
var
_webpack
,
_push
;
var
_style
=
style
.
unknown
;
var
_insmod_acc
=
9000
;
// insert a module into webpack
...
...
@@ -34,7 +34,7 @@ module.exports = {
_webpack
([
++
_insmod_acc
],
[
mod
],
[
0
]);
break
;
case
style
.
array
:
_
webpack
.
push
([
++
_insmod_acc
],
[
mod
],
[[
0
]]);
_
push
.
apply
(
_webpack
,
[[[
++
_insmod_acc
],
{
cascade
:
mod
},
[[
'
cascade
'
]]
]]);
break
;
default
:
console
.
warn
(
'
cant insmod, unrecognized webpack type
'
);
...
...
@@ -42,56 +42,66 @@ module.exports = {
}
}
function
setIntercept
(
webpack
)
{
switch
(
typeof
webpack
)
{
case
'
function
'
:
const
params
=
getParams
(
webpack
);
if
(
params
.
length
===
3
||
params
.
length
===
2
)
{
// probably just a relatively normal webpack config
// we naively assume that if there are 2 parameters, it will still be ok
// pleromafe's webpack doesnt take a third parameter, but luckily javascript doesnt give a fuck
_style
=
style
.
func
;
_webpack
=
(
x
,
mod
,
main
)
=>
webpack
(
x
,
pushHook
(
mod
),
main
);
}
else
{
// god fucking damn it
// okay i have no fucking idea what to do with you
console
.
warn
(
'
cant hook webpack: unrecognized prototype for webpackJsonp
'
);
_webpack
=
webpack
;
}
// hacky but i dont really know how else to go about this
// pleromafe's webpack fails if we insmod before returning from webpackJsonp setter
setTimeout
(()
=>
insmod
(
mod
),
10
);
break
;
case
'
object
'
:
if
(
webpack
instanceof
Array
&&
push
in
webpack
)
{
_style
=
style
.
array
;
if
(
webpack
.
push
.
hooked
||
webpack
.
push
===
Array
.
prototype
.
push
)
return
_webpack
=
webpack
;
const
_push
=
webpack
.
push
;
webpack
.
push
=
(
x
)
=>
_push
.
apply
(
webpack
,
[
x
[
0
],
pushHook
(
x
[
1
]),
x
[
2
]])
webpack
.
push
.
hooked
=
true
;
_webpack
=
webpack
;
this
.
insmod
(
mod
);
}
else
return
console
.
warn
(
'
cant hook webpack: webpackJsonp is an object, but isnt an array
'
);
break
;
default
:
console
.
warn
(
'
cant hook webpack: i have no idea what webpackJsonp even is
'
);
break
;
}
}
Object
.
defineProperty
(
window
,
'
webpackJsonp
'
,
{
get
:
()
=>
_webpack
,
set
:
setIntercept
set
(
webpack
)
{
switch
(
typeof
webpack
)
{
case
'
function
'
:
const
params
=
getParams
(
webpack
);
if
(
params
.
length
===
3
||
params
.
length
===
2
)
{
// probably just a relatively normal webpack config
// we naively assume that if there are 2 parameters, it will still be ok
// pleromafe's webpack doesnt take a third parameter, but luckily javascript doesnt give a fuck
_style
=
style
.
func
;
_webpack
=
(
x
,
mod
,
main
)
=>
webpack
(
x
,
pushHook
(
mod
),
main
);
}
else
{
// god fucking damn it
// okay i have no fucking idea what to do with you
console
.
warn
(
'
cant hook webpack: unrecognized prototype for webpackJsonp
'
);
_webpack
=
webpack
;
return
;
}
// hacky but i dont really know how else to go about this
// pleromafe's webpack fails if we insmod before returning from webpackJsonp setter
setTimeout
(()
=>
insmod
(
mod
),
10
);
break
;
case
'
object
'
:
if
(
webpack
instanceof
Array
&&
webpack
.
push
)
{
_style
=
style
.
array
;
if
(
webpack
.
push
.
hooked
||
webpack
.
push
===
Array
.
prototype
.
push
)
{
_webpack
=
webpack
;
return
;
}
_push
=
webpack
.
push
;
webpack
.
push
=
(
x
,
mod
,
main
)
=>
{
if
(
!
mod
)
{
mod
=
x
[
1
];
main
=
x
[
2
];
x
=
x
[
0
];
}
return
_push
.
apply
(
webpack
,
[[
x
,
pushHook
(
mod
),
main
]]);
}
webpack
.
push
.
hooked
=
true
;
_webpack
=
webpack
;
insmod
(
mod
);
}
else
return
console
.
warn
(
'
cant hook webpack: webpackJsonp is an object, but isnt an array
'
);
break
;
default
:
console
.
warn
(
'
cant hook webpack: i have no idea what webpackJsonp even is
'
);
_webpack
=
webpack
;
return
;
}
}
});
}
...
...
modules/cascade.webpack.js
View file @
d839a0c1
...
...
@@ -120,6 +120,7 @@ module.exports = {
},
instrumentation
:
{
cascade
(
j
)
{
const
defines
=
j
.
cascade
;
if
(
defines
.
replacements
)
defines
.
replacements
.
forEach
(
replacement
=>
...
...
@@ -134,6 +135,7 @@ module.exports = {
postCtor
.
push
(
callback
);
});
}
}
};
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment