interface, glob: serve source maps externally

This commit is contained in:
Liam Fitzgerald 2020-10-14 13:26:40 +10:00
parent 6794a930b5
commit f14c0ee19e
4 changed files with 44 additions and 12 deletions

View File

@ -85,20 +85,33 @@
%glob-make
:_ this
=/ home=path /(scot %p our.bowl)/home/(scot %da now.bowl)
=+ .^(=tube:clay %cc (weld home /js/mime))
=+ .^(=js=tube:clay %cc (weld home /js/mime))
=+ .^(=map=tube:clay %cc (weld home /map/mime))
=+ .^(arch %cy (weld home /app/landscape/js/bundle))
=/ bundle=path
%- need
^- (unit path)
=/ bundle-hash=@t
%- need
^- (unit @t)
%- ~(rep by dir)
|= [[file=@t ~] out=(unit path)]
|= [[file=@t ~] out=(unit @t)]
?^ out out
?. =((end 3 5 file) 'index')
~
`/[file]/js
=+ .^(js=@t %cx :(weld home /app/landscape/js/bundle bundle))
=+ !<(=mime (tube !>(js)))
=/ =glob:glob (~(put by *glob:glob) bundle mime)
?. ?& =((end 3 6 file) 'index.')
!=('sj.' (end 3 3 (swp 3 file)))
==
out
``@t`(rsh 3 6 file)
=/ js-name
(cat 3 'index.' bundle-hash)
=/ map-name
(cat 3 js-name '.js')
=+ .^(js=@t %cx :(weld home /app/landscape/js/bundle /[js-name]/js))
=+ .^(map=@t %cx :(weld home /app/landscape/js/bundle /[map-name]/map))
=+ !<(=js=mime (js-tube !>(js)))
=+ !<(=map=mime (map-tube !>(map)))
=/ =glob:glob
%- ~(gas by *glob:glob)
:~ /[js-name]/js^js-mime
/[map-name]/map^map-mime
==
=/ =path /(cat 3 'glob-' (scot %uv (sham glob)))/glob
[%pass /make %agent [our.bowl %hood] %poke %drum-put !>([path (jam glob)])]~
::

18
pkg/arvo/mar/map.hoon Normal file
View File

@ -0,0 +1,18 @@
::
:::: /hoon/map/mar
:: Mark for js source maps
/? 310
::
=, eyre
|_ mud/@
++ grow
|%
++ mime [/application/octet-stream (as-octs:mimes:html (@t mud))]
--
++ grab
|% :: convert from
++ mime |=({p/mite q/octs} (@t q.q))
++ noun cord :: clam from %noun
--
++ grad %mime
--

View File

@ -43,7 +43,7 @@ module.exports = {
resolve: {
extensions: ['.js', '.ts', '.tsx']
},
devtool: 'none',
devtool: 'source-map',
// devServer: {
// contentBase: path.join(__dirname, './'),
// hot: true,

View File

@ -1,6 +1,7 @@
import React, { useRef, useCallback } from "react";
import { RouteComponentProps } from "react-router-dom";
import { Col } from "@tlon/indigo-react";
import _ from 'lodash';
import { Association } from "~/types/metadata-update";
import { StoreState } from "~/logic/store/type";