Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot find module 'estraverse' #138

Open
AndyOGo opened this issue Nov 6, 2018 · 5 comments
Open

Cannot find module 'estraverse' #138

AndyOGo opened this issue Nov 6, 2018 · 5 comments

Comments

@AndyOGo
Copy link
Contributor

AndyOGo commented Nov 6, 2018

I can't run tests locally.
Are all needed modules within devDependencies?

@goto-bus-stop
Copy link
Member

Where is it happening? We don't use estraverse directly.

@AndyOGo
Copy link
Contributor Author

AndyOGo commented Nov 6, 2018

Sorry for my incomplete description.

Actually I just checked out master, did a fresh npm install.
And I get another error TypeError: Cannot read property 'elements' of undefined now 😞

npm run test

and get:

> nanohtml@1.2.1 test /Users/axawinterthur/dev/nanohtml
> standard && node tests && npm run test:browser && npm run test:transform-browser && npm run test:babel-browser

TAP version 13
# server side render
ok 1 contains a child element
ok 2 attribute gets set
# passing another element to html on server side render
ok 3 button rendered correctly
# style attribute
ok 4 should be equal
# unescape html
ok 5 should be equal
# unescape html inside html
ok 6 should be equal
# event attribute
ok 7 should be equal
# boolean attribute
ok 8 should be equal
# spread attributes
ok 9 should be equal
# works
ok 10 no error
ok 11 replaced html dependency with {}
ok 12 created an h1 tag
ok 13 set a class attribute
# strings + template expressions
ok 14 no error
ok 15 concats strings + template expressions
# append children in the correct order
ok 16 no error
ok 17 append children in the correct order
# multiple values on single attribute
ok 18 no error
ok 19 first argument
ok 20 second argument
ok 21 calling with both variables
# svg
ok 22 no error
ok 23 created namespaced svg element
# xlink:href
ok 24 no error
ok 25 created namespaced xlink:href attribute
# choo and friends
ok 26 no error
ok 27 converted el1 to a iife
ok 28 converted el1 to a iife
# emits error for syntax error
ok 29 should be truthy
# works with newer js
ok 30 no error
# boolean attribute expression
ok 31 no error
# babel-compiled template literals
ok 32 null
ok 33 created a tag
ok 34 removed template literal parts values
# buble-compiled template literals
not ok 35 TypeError: Cannot read property 'elements' of undefined while parsing file: /Users/axawinterthur/dev/nanohtml/tests/transform/fixture.js
  ---
    operator: error
    expected: |-
      undefined
    actual: |-
      { [TypeError: Cannot read property 'elements' of undefined while parsing file: /Users/axawinterthur/dev/nanohtml/tests/transform/fixture.js] filename: '/Users/axawinterthur/dev/nanohtml/tests/transform/fixture.js', stream: { _readableState: { objectMode: true, highWaterMark: 16, buffer: BufferList { length: 0 }, length: 0, pipes: { _readableState: { objectMode: true, highWaterMark: 16, buffer: [Object], length: 0, pipes: [Object], pipesCount: 1, flowing: true, ended: false, endEmitted: false, reading: true, sync: false, needReadable: true, emittedReadable: false, readableListening: false, resumeScheduled: false, destroyed: false, defaultEncoding: 'utf8', awaitDrain: 0, readingMore: false, decoder: null, encoding: null }, readable: true, domain: null, _events: { end: [Object], finish: [Object], error: [Object], unpipe: [Function: onunpipe], drain: [Function], close: [Function: bound onceWrapper], data: [Function: ondata], _mutate: [Function: bound onceWrapper] }, _eventsCount: 8, _maxListeners: undefined, _writableState: { objectMode: true, highWaterMark: 16, finalCalled: false, needDrain: false, ending: false, ended: false, finished: false, destroyed: false, decodeStrings: true, defaultEncoding: 'utf8', length: 0, writing: false, corked: 0, sync: true, bufferProcessing: false, onwrite: [Function], writecb: null, writelen: 0, bufferedRequest: null, lastBufferedRequest: null, pendingcb: 0, prefinished: false, errorEmitted: false, bufferedRequestCount: 0, corkedRequestsFree: [Object] }, writable: true, allowHalfOpen: true, _options: { objectMode: true }, _wrapOptions: { objectMode: true }, _streams: [ [Object] ], length: 1, label: 'json' }, pipesCount: 1, flowing: true, ended: false, endEmitted: false, reading: true, sync: false, needReadable: true, emittedReadable: false, readableListening: false, resumeScheduled: false, destroyed: false, defaultEncoding: 'utf8', awaitDrain: 0, readingMore: false, decoder: null, encoding: null }, readable: true, domain: null, _events: { end: [ [Function: bound onceWrapper], [Function: bound onceWrapper], [Function: bound onceWrapper] ], error: [Function], data: [Function: ondata], _mutate: [Function: bound onceWrapper] }, _eventsCount: 4, _maxListeners: undefined, _writableState: { objectMode: true, highWaterMark: 16, finalCalled: false, needDrain: false, ending: true, ended: true, finished: true, destroyed: false, decodeStrings: true, defaultEncoding: 'utf8', length: 0, writing: false, corked: 0, sync: false, bufferProcessing: false, onwrite: [Function], writecb: null, writelen: 0, bufferedRequest: null, lastBufferedRequest: null, pendingcb: 0, prefinished: true, errorEmitted: false, bufferedRequestCount: 0, corkedRequestsFree: { next: null, entry: null, finish: [Function] } }, writable: false, allowHalfOpen: true, _options: { objectMode: true }, _wrapOptions: { objectMode: true }, _streams: [ { _readableState: { objectMode: true, highWaterMark: 16, buffer: [Object], length: 0, pipes: null, pipesCount: 0, flowing: null, ended: false, endEmitted: false, reading: false, sync: false, needReadable: true, emittedReadable: false, readableListening: true, resumeScheduled: false, destroyed: false, defaultEncoding: 'utf8', awaitDrain: 0, readingMore: false, decoder: null, encoding: null }, readable: true, domain: null, _events: { end: [Object], prefinish: [Function: prefinish], file: [Function], package: [Function], transform: [Function], error: [Function], readable: [Function: bound onceWrapper] }, _eventsCount: 7, _maxListeners: undefined, _writableState: { objectMode: true, highWaterMark: 16, finalCalled: false, needDrain: false, ending: true, ended: true, finished: true, destroyed: false, decodeStrings: true, defaultEncoding: 'utf8', length: 0, writing: false, corked: 0, sync: true, bufferProcessing: false, onwrite: [Function], writecb: null, writelen: 0, bufferedRequest: null, lastBufferedRequest: null, pendingcb: 0, prefinished: true, errorEmitted: false, bufferedRequestCount: 0, corkedRequestsFree: [Object] }, writable: false, allowHalfOpen: true, _transformState: { afterTransform: [Function: bound afterTransform], needTransform: true, transforming: false, writecb: null, writechunk: null, writeencoding: 'utf8' }, basedir: '/Users/axawinterthur/dev/nanohtml', persistentCache: [Function], cache: undefined, fileCache: undefined, pkgCache: { '/Users/axawinterthur/dev/nanohtml/tests/transform/package.json': false, '/Users/axawinterthur/dev/nanohtml/tests/package.json': false, '/Users/axawinterthur/dev/nanohtml/package.json': [Object], '/Users/axawinterthur/dev/nanohtml/tests/transform/fixture.js': [Object] }, pkgFileCache: {}, pkgFileCachePending: {}, _emittedPkg: { '/Users/axawinterthur/dev/nanohtml': true }, _transformDeps: {}, visited: { '/Users/axawinterthur/dev/nanohtml/tests/transform/fixture.js': true }, walking: {}, entries: [ '/Users/axawinterthur/dev/nanohtml/tests/transform/fixture.js' ], _input: [ [Object] ], paths: [], transforms: [ [Object], [Object] ], globalTransforms: [ [Object] ], resolver: [Function], detective: [Function], options: { transform: [Object], entries: [Object], dedupe: true, expose: [Object], extensions: [Object], transformKey: [Object], postFilter: [Function], filter: [Function], resolve: [Function], modules: [Object], globalTransform: [Object] }, pending: 1, inputPending: 1, top: { id: '/Users/axawinterthur/dev/nanohtml/__fake.js', filename: '/Users/axawinterthur/dev/nanohtml/__fake.js', paths: [Object], basedir: '/Users/axawinterthur/dev/nanohtml' }, _ended: true } ], length: 1, label: 'deps' } }
    at: Readable.<anonymous> (/Users/axawinterthur/dev/nanohtml/tests/transform/index.js:218:7)
    stack: |-
      TypeError: Cannot read property 'elements' of undefined while parsing file: /Users/axawinterthur/dev/nanohtml/tests/transform/fixture.js
          at walk (/Users/axawinterthur/dev/nanohtml/lib/browserify-transform.js:87:35)
          at walk (/Users/axawinterthur/dev/nanohtml/node_modules/dash-ast/index.js:69:28)
          at walk (/Users/axawinterthur/dev/nanohtml/node_modules/dash-ast/index.js:62:9)
          at walkArray (/Users/axawinterthur/dev/nanohtml/node_modules/dash-ast/index.js:74:27)
          at walk (/Users/axawinterthur/dev/nanohtml/node_modules/dash-ast/index.js:64:9)
          at dashAst (/Users/axawinterthur/dev/nanohtml/node_modules/dash-ast/index.js:17:5)
          at astTransform (/Users/axawinterthur/dev/nanohtml/node_modules/transform-ast/index.js:32:3)
          at DestroyableTransform.end [as _flush] (/Users/axawinterthur/dev/nanohtml/lib/browserify-transform.js:33:13)
          at DestroyableTransform.prefinish (/Users/axawinterthur/dev/nanohtml/node_modules/readable-stream/lib/_stream_transform.js:139:10)
          at DestroyableTransform.emit (events.js:160:13)
  ...
/Users/axawinterthur/dev/nanohtml/tests/transform/index.js:219
    t.ok(src.indexOf('document.createElement("div")') !== -1, 'created a tag')
             ^

TypeError: Cannot read property 'indexOf' of undefined
    at Readable.<anonymous> (/Users/axawinterthur/dev/nanohtml/tests/transform/index.js:219:14)
    at Readable.emit (events.js:160:13)
    at Labeled.<anonymous> (/Users/axawinterthur/dev/nanohtml/node_modules/read-only-stream/index.js:28:44)
    at Labeled.emit (events.js:160:13)
    at Labeled.<anonymous> (/Users/axawinterthur/dev/nanohtml/node_modules/stream-splicer/index.js:130:18)
    at Labeled.emit (events.js:160:13)
    at Deps.<anonymous> (/Users/axawinterthur/dev/nanohtml/node_modules/stream-splicer/index.js:130:18)
    at Deps.emit (events.js:160:13)
    at DuplexWrapper.<anonymous> (/Users/axawinterthur/dev/nanohtml/node_modules/module-deps/index.js:405:22)
    at DuplexWrapper.emit (events.js:160:13)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! nanohtml@1.2.1 test: `standard && node tests && npm run test:browser && npm run test:transform-browser && npm run test:babel-browser`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the nanohtml@1.2.1 test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/axawinterthur/.npm/_logs/2018-11-06T18_15_39_038Z-debug.log

@AndyOGo
Copy link
Contributor Author

AndyOGo commented Nov 6, 2018

Hmh maybe it's cause of http://buble.surge.sh/guide/#-dangeroustaggedtemplatestring- 🤔

@AndyOGo
Copy link
Contributor Author

AndyOGo commented Nov 6, 2018

Alright I tried to track that down.

Seems that bublè transpiles tagged template lits to MemberExpression and not ArrayExpression as expected here:
Please see AST-Explorer:
https://astexplorer.net/#/gist/1ad95bcbeb0738473ae254f8d592ff50/ae8d08d3a1b31a769be397d601974df7c0267e94

@AndyOGo
Copy link
Contributor Author

AndyOGo commented Nov 6, 2018

Maybe they have also changed this in a newer version 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants