aboutsummaryrefslogtreecommitdiffstats
path: root/root
diff options
context:
space:
mode:
authors-ol <s+removethis@s-ol.nu>2020-12-09 11:16:29 +0000
committers-ol <s+removethis@s-ol.nu>2020-12-09 11:16:29 +0000
commit2e454714a19c044577b6c24e06f86cf43226fe6a (patch)
tree1e84414723b322610ca1120d4c1d52e8de2fddc0 /root
parentremove BROWSER.root (diff)
downloadmmm-2e454714a19c044577b6c24e06f86cf43226fe6a.tar.gz
mmm-2e454714a19c044577b6c24e06f86cf43226fe6a.zip
remove legacy PLUGINS
Diffstat (limited to 'root')
-rw-r--r--root/$mmm/plugins/json/converts: text$moonscript -> table.moon54
-rw-r--r--root/$mmm/plugins/static/converts: text$moonscript -> table.moon59
2 files changed, 33 insertions, 80 deletions
diff --git a/root/$mmm/plugins/json/converts: text$moonscript -> table.moon b/root/$mmm/plugins/json/converts: text$moonscript -> table.moon
deleted file mode 100644
index 7b150a5..0000000
--- a/root/$mmm/plugins/json/converts: text$moonscript -> table.moon
+++ /dev/null
@@ -1,54 +0,0 @@
-encode = (obj) ->
- switch type obj
- when 'string'
- string.format '%q', obj
- when 'table'
- if obj[1] or not next obj
- "[#{table.concat [encode c for c in *obj], ','}]"
- else
- "{#{table.concat ["#{encode k}: #{encode v}" for k,v in pairs obj], ', '}}"
- when 'number'
- tostring obj
- when 'boolean'
- tostring obj
- when 'nil'
- 'null'
- else
- error "unknown type '#{type obj}'"
-
-decode = if MODE == 'CLIENT'
- import Array, Object, JSON from js.global
-
- fix = (val) ->
- switch type val
- when 'userdata'
- if Array\isArray val
- [fix x for x in js.of val]
- else
- {(fix e[0]), (fix e[1]) for e in js.of Object\entries(val)}
- else
- val
-
- encode
- decode = (str) -> fix JSON\parse str
-else if cjson = require 'cjson'
- cjson.decode
-else
- warn 'only partial JSON support, please install cjson'
-
-
-{
- {
- inp: 'table',
- out: 'text/json',
- cost: 2
- transform: (val) => encode val
- }
- if decode
- {
- inp: 'text/json'
- out: 'table'
- cost: 1
- transform: (val) => decode val
- }
-}
diff --git a/root/$mmm/plugins/static/converts: text$moonscript -> table.moon b/root/$mmm/plugins/static/converts: text$moonscript -> table.moon
index e230856..b3c6182 100644
--- a/root/$mmm/plugins/static/converts: text$moonscript -> table.moon
+++ b/root/$mmm/plugins/static/converts: text$moonscript -> table.moon
@@ -1,34 +1,41 @@
-if not STATIC
- return
+if STATIC
+ extensions = {
+ 'image/jpeg': 'jpg'
+ 'image/png': 'png'
+ 'image/svg+xml': 'svg'
-extensions = {
- 'image/jpeg': 'jpg'
- 'image/png': 'png'
- 'image/svg+xml': 'svg'
+ 'video/webm': 'webm'
+ 'video/mp4': 'mp4'
- 'video/webm': 'webm'
- 'video/mp4': 'mp4'
+ 'text/javascript': 'js'
+ 'text/css': 'css'
- 'text/javascript': 'js'
- 'text/css': 'css'
-
- 'model/gltf-binary': 'glb'
-}
+ 'model/gltf-binary': 'glb'
+ }
-{
{
- inp: '(.+)',
- out: 'URL -> %1',
- cost: 5
- transform: (val, fileder, key) =>
- escaped_from = @from\gsub '/', '_'
- if ext = extensions[@from]
- escaped_from ..= ".#{ext}"
+ {
+ inp: '(.+)',
+ out: 'URL -> %1',
+ cost: 5
+ transform: (val, fileder, key) =>
+ escaped_from = @from\gsub '/', '_'
+ if ext = extensions[@from]
+ escaped_from ..= ".#{ext}"
- prefix = STATIC.root or ''
+ prefix = STATIC.root or ''
- prefix .. with url = "#{fileder.path}/#{key.name}:#{escaped_from}"
- print " rendering asset #{url}"
- STATIC.spit url, val
+ prefix .. with url = "#{fileder.path}/#{key.name}:#{escaped_from}"
+ print " rendering asset #{url}"
+ STATIC.spit url, val
+ }
+ }
+else
+ {
+ {
+ inp: '(.+)',
+ out: 'URL -> %1',
+ cost: 5
+ transform: (_, fileder, key) => "#{fileder.path}/#{key.name}:#{@from}"
+ }
}
-}