Clojurians
#cljs-dev
<
2018-07-11
>

This page is not created by, affiliated with, or supported by Slack Technologies, Inc.

miikka07:07:59

Hey, to check me understanding of cljs compiler... I'm thinking of replacing doo's usage of cljs.build.api/watch with hawk to give us more control over the watching behavior. I'd need to re-implement the logic that is in cljs.closure/watch, but that's all, right?

dnolen14:07:53

yep, ClojureScript’s watch functionality is very simple / naive by design

juhoteperi15:07:29

Has someone checked if scoped npm modules work with latest Closure-compiler?

dnolen15:07:29

I haven’t

juhoteperi15:07:44

Oh well I found existing configuration

juhoteperi15:07:06

Compiling build :client-npm to "target/cljsbuild/client-npm/public/js/main.js" from ["src"]...
path.js:39
    throw new ERR_INVALID_ARG_TYPE('path', 'string', path);
    ^

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type boolean
    at assertPath (path.js:39:11)
    at Object.resolve (path.js:1090:7)
    at Deps.<anonymous> ([eval]:204:40)
    at Deps.emit (events.js:187:15)
    at endReadableNT (/home/juho/Source/reagent/examples/material-ui/node_modules/readable-stream/lib/_stream_readable.js:1010:12)
    at process._tickCallback (internal/process/next_tick.js:174:19)
Looks like our code might have some problems now

dnolen15:07:16

looks like a JS side problem?

juhoteperi15:07:38

No I think that is from our module-deps code

juhoteperi15:07:45

The node module indexing

juhoteperi15:07:36

Foreign libs providing and using global-exports with scoped names, like @material-ui/core/styles also have some problems

dnolen15:07:32

yeah that’s what I meant - issues on the JS side of things of our stuff

juhoteperi16:07:13

I'll finish my material-ui example with old foreign-libs names and look at this later.

juhoteperi16:07:06

The problem with global-exports might be just that the key must be symbol, not string, which is required if name has multiple /

ambrosebs17:07:55

I'm looking through cljs.core, and I see some types implementing equiv on Object. I can't find where this method is documented and/or used? (is this gclosure, js core..?)

dnolen17:07:41

it’s just a JS level api - Transit uses it I’m pretty sure

ambrosebs17:07:48

oh an API for cljs.core/=. thanks

mfikes17:07:42

If equiv is meant to be public / stable, we have a place where that kind of stuff is documented https://clojurescript.org/reference/javascript-api But perhaps equiv is really just an implementation detail?

dnolen17:07:46

I would say it’s not

dnolen17:07:57

we extern it on purpose and it’s unlikely to change

dnolen17:07:27

while I don’t know why anybody would use it outside of ClojureScript it is useful for people writing libraries like Transit

dnolen17:07:11

documenting it is fine by me

juhoteperi20:07:58

These fix scoped npm names in foreign-libs, or more specifically, using strings with :global-exports

dnolen21:07:54

cool thanks

juhoteperi21:07:46

browser entry here breaks node module indexing, at least for @material-ui/core and probably for react-slate also: https://unpkg.com/[email protected]/package.json

juhoteperi21:07:47

It is supposed to mean that if global package is loaded, min-document and process packages should be ignored

dnolen22:07:40

@juhoteperi hrm I don’t follow

juhoteperi22:07:28

browser entry of a node package can control if other packages should be ignored (or replace them with other files)

juhoteperi22:07:53

so the global package is trying to get this package ignored: https://www.npmjs.com/package/min-document

juhoteperi22:07:15

anyway, we can probably just ignore non-string values for browser entries

thheller23:07:14

@juhoteperi the browser field as an object is quite often use to override specific requires as well, eg. "browser":{"./foo.js":"./foo-browser.js"}

thheller23:07:28

not only false

thheller23:07:50

"browser": {
    "lib/aws.js": "./lib/browser.js",
    "fs": false,
    "./global.js": "./browser.js",
    "./lib/node_loader.js": "./lib/browser_loader.js"
  },

thheller23:07:47

ah nvm you already cover that. thought the ticket meant to only accept "browser":"foo"