willviles / ember-useragent Goto Github PK
View Code? Open in Web Editor NEWAn Ember addon for Fastboot-enabled UserAgent parsing via UAParser.js.
License: MIT License
An Ember addon for Fastboot-enabled UserAgent parsing via UAParser.js.
License: MIT License
I am using Prember with Fastboot, which does not seem to provide a user-agent when generating pages on build. This causes an error when the page it is trying to build is using the hbs helpers for user-agent
.
pre-render / failed with exception: Error: Assertion Failed: No `user-agent` present in FastBoot headers.
{{#if (or (user-agent "device.isMobile") (user-agent "device.isTablet"))}}
<MobileComponent />
{{/if}}
Is it possible to make ember-useragent
not fail when no user-agent
is present, but rather just return false for these helpers? Or maybe this is a Prember issue in that it should be providing some kind of user agent?
It seems like (at least the latest v59.0) Firefox does not return Linux
as the os (On Ubuntu I get Ubuntu
instead of Linux
).
Chrome, however, returns Linux
for me on Ubuntu as well, so here it works.
So, the userAgent.os.isLinux
property returns false where it should be true.
Using Ember 3.9.0, I get this deprecation warning:
''DEPRECATION: The <my-app@service:user-agent::ember220>#_parser computed property was just overriden. This removes the computed property and replaces it with a plain value, and has been deprecated. If you want this behavior, consider defining a setter which does it manually. [deprecation id: computed-property.override] See https://emberjs.com/deprecations/v3.x#toc_computed-property-override for more details.\n
Moving away from ember-cli-cjs-transform for importing ua-parser-js
module in favour of ember-auto-import.
Unsure of the edge cases in using ember-auto-import in addons at the moment, so help wanted.
Try out the branch:
npm i -D git://github.com/willviles/ember-useragent.git#feat/ember-auto-import
or
yarn add --dev git://github.com/willviles/ember-useragent.git#feat/ember-auto-import
Hi ๐,
based on the upcoming addition of media
helper into ember-responsive
add-on https://github.com/freshbooks/ember-responsive#getting-started, I propose adding similar helper here like this
What do you think? I'm happy to send a pull request.
When updating from 0.6.1 to 0.7.0 I'm seeing the following build error:
while import node_modules/ua-parser-js/src/ua-parser.js: found an unknown transformation name cjs. Available transformNames are: amd
Is there a missing dependency perhaps?
Are there any plans to add userAgent.browser.isEdge
, etc. any time soon?
Are there any plans on cutting a 1.0 release of this package any time soon?
This 'aint a particularly clever way of initializing UA-Parser inside the user-agent
service.
Instead, we should reopen the service, and use the Fastboot service within a computed property to create the UA-Parser.
This error is orcurring:
Error: Cannot find module 'ua-parser-js'
at Function.Module._resolveFilename (module.js:555:15)
at Function.Module._load (module.js:482:25)
at Module.require (module.js:604:17)
at require (internal/module.js:11:18)
at Object.require (/home/gabriel94/Documents/Simplificaa/soov2/node_modules/fastboot/src/ember-app.js:130:18)
at o. (/home/gabriel94/Documents/Simplificaa/soov2/public/assets/vendor-ae758f968625e27cbcca8c95c95762ae.js:4780:54)
at ze.Be.get (/home/gabriel94/Documents/Simplificaa/soov2/public/assets/vendor-ae758f968625e27cbcca8c95c95762ae.js:2342:20)
at Object.Se [as get] (/home/gabriel94/Documents/Simplificaa/soov2/public/assets/vendor-ae758f968625e27cbcca8c95c95762ae.js:2313:55)
at o.setupService (/home/gabriel94/Documents/Simplificaa/soov2/public/assets/vendor-ae758f968625e27cbcca8c95c95762ae.js:4780:170)
at o.init (/home/gabriel94/Documents/Simplificaa/soov2/public/assets/vendor-ae758f968625e27cbcca8c95c95762ae.js:4781:938)
at o.r [as init] (/home/gabriel94/Documents/Simplificaa/soov2/public/assets/vendor-ae758f968625e27cbcca8c95c95762ae.js:3201:9)
at new o (/home/gabriel94/Documents/Simplificaa/soov2/public/assets/vendor-ae758f968625e27cbcca8c95c95762ae.js:3106:21)
at Function.s.create (/home/gabriel94/Documents/Simplificaa/soov2/public/assets/vendor-ae758f968625e27cbcca8c95c95762ae.js:3117:44)
at e.create (/home/gabriel94/Documents/Simplificaa/soov2/public/assets/vendor-ae758f968625e27cbcca8c95c95762ae.js:1448:120)
at /home/gabriel94/Documents/Simplificaa/soov2/public/assets/vendor-ae758f968625e27cbcca8c95c95762ae.js:1434:103
at s (/home/gabriel94/Documents/Simplificaa/soov2/public/assets/vendor-ae758f968625e27cbcca8c95c95762ae.js:1440:45)
This error occurs only when the app is running after build with fastboot
Hi im having this error faisalman/ua-parser-js#540 can you update the dep and release a new version.
This pr #43 fix the issue
Thanks
Out of (as far as I can tell) nowhere, this started happening.
loader.js:247 Uncaught Error: Could not find module `ua-parser-js` imported from `ember-useragent/services/user-agent`
at missingModule (loader.js:247)
at findModule (loader.js:258)
at Module.findDeps (loader.js:168)
at findModule (loader.js:262)
at Module.findDeps (loader.js:168)
at findModule (loader.js:262)
at requireModule (loader.js:24)
at Class._extractDefaultExport (index.js:389)
at Class.resolveOther (index.js:109)
at Class.superWrapper [as resolveOther] (ember-utils.js:418)
[email protected]
[email protected]
Any suggestions? Thank you.
Hi,
Would it be useful to have a property:
userAgent.get('browser. browser.supportsWebRtc'); // Boolean
Or do you want it to keept it close to the browser properties and not make conclusions that may have to be maintained?
What do you think?
KR,
Dimitri.
The update from 6.1 to 7.1 produced the following crash in our program on Windows 10, right at the start of 'yarn':
ERROR Summary:
- broccoliBuilderErrorStack: [undefined]
- codeFrame: [undefined]
- errorMessage: Cannot read property '0' of null
- errorType: [undefined]
- location:
- column: [undefined]
- file: [undefined]
- line: [undefined]
- message: Cannot read property '0' of null
- name: TypeError
- nodeAnnotation: [undefined]
- nodeName: [undefined]
- originalErrorMessage: [undefined]
- stack: TypeError: Cannot read property '0' of null
at Class.included (C:\Users\kaba\code\wavelength\node_modules\ember-useragent\index.js:8:82)
at Class.superWrapper [as included] (C:\Users\kaba\code\wavelength\node_modules\core-object\lib\assign-properties.js:34:20)
at project.addons.forEach.addon (C:\Users\kaba\code\wavelength\node_modules\ember-cli\lib\broccoli\ember-app.js:596:15)
at Array.forEach (<anonymous>)
at EmberApp._notifyAddonIncluded (C:\Users\kaba\code\wavelength\node_modules\ember-cli\lib\broccoli\ember-app.js:594:25)
at new EmberApp (C:\Users\kaba\code\wavelength\node_modules\ember-cli\lib\broccoli\ember-app.js:151:10)
at module.exports (C:\Users\kaba\code\wavelength\ember-cli-build.js:14:15)
at Builder.setupBroccoliBuilder (C:\Users\kaba\code\wavelength\node_modules\ember-cli\lib\models\builder.js:51:19)
at new Builder (C:\Users\kaba\code\wavelength\node_modules\ember-cli\lib\models\builder.js:29:10)
at ServeTask.run (C:\Users\kaba\code\wavelength\node_modules\ember-cli\lib\tasks\serve.js:24:55)
The offending line index.js which produces 'Cannot read property '0' of null' is:
const modulePath = require.resolve('ua-parser-js').match(/node_modules\/.*$/)[0];
Any ideas?
The current version does not seem to be compatible with Ember 4.x.
The following deprecations are blocking:
Add broccoli-debug
, so the Broccoli pipeline is output to /DEBUG
when the following command is run:
BROCCOLI_DEBUG=ember-useragent:* ember serve
I am not able to install this dependency on Windows 8.1.
$ npm install --save-dev ember-useragent
npm ERR! tar.unpack untar error C:\Users\<user>\AppData\Roaming\npm-cache\ember-useragent\0.2.0\package.tgz
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN [email protected] requires a peer of chai@>= 2.1.2 < 5 but none was installed.
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "--save-dev" "ember-useragent"
npm ERR! node v6.9.5
npm ERR! npm v3.10.10
npm ERR! path C:\my_workspace\my-app\node_modules\.staging\ember-useragent-a9df5aa2\Icon
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall open
'pm ERR! enoent ENOENT: no such file or directory, open 'C:\my_workspace\my-app\node_modules\.staging\ember-useragent-a9df5aa2\Icon
'pm ERR! enoent ENOENT: no such file or directory, open 'C:\my_workspace\my-app\node_modules\.staging\ember-useragent-a9df5aa2\Icon
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! Please include the following file with any support request:
npm ERR! C:\my_workspace\my-app\npm-debug.log
Hi, seeing this with ember-cli-fastboot 1.0.0 rc.2.
DEPRECATION: Having fastboot specific code in app directory of
/Users/xxx/Sites/xxx/node_modules/ember-useragent is deprecated. Please move it to fastboot/app directory.
I think it is this https://gist.github.com/kratiahuja/d22de0fb1660cf0ef58f07a6bcbf1a1c#addon-containing-fastboot-based-initializers-as-appinstance-initializersfastbootjs
https://github.com/kaliber5/ember-fastboot-addon-tests
I tried that in #18 already, but for some reason running ember fastboot:test
wiped the node_modules
dir every time. I'll give it another shot later.
After updating from 0.6.1
to 07.1
I'm encountering the following error:
while import node_modules/ua-parser-js/src/ua-parser.js: found an unknown transformation name cjs. Available transformNames are: amd
stack trace and error report:
ERROR Summary:
- broccoliBuilderErrorStack: [undefined]
- codeFrame: [undefined]
- errorMessage: while import node_modules/ua-parser-js/src/ua-parser.js: found an unknown transformation name cjs. Available transformNames are: amd
- errorType: [undefined]
- location:
- column: [undefined]
- file: [undefined]
- line: [undefined]
- message: while import node_modules/ua-parser-js/src/ua-parser.js: found an unknown transformation name cjs. Available transformNames are: amd
- name: Error
- nodeAnnotation: [undefined]
- nodeName: [undefined]
- originalErrorMessage: [undefined]
- stack: Error: while import node_modules/ua-parser-js/src/ua-parser.js: found an unknown transformation name cjs. Available transformNames are: amd
at options.using.forEach.entry (/Users/lpaulger/Documents/myApp/node_modules/ember-cli/lib/broccoli/ember-app.js:1801:19)
at Array.forEach (<anonymous>)
at EmberApp._import (/Users/lpaulger/Documents/myApp/node_modules/ember-cli/lib/broccoli/ember-app.js:1792:23)
at EmberApp.import (/Users/lpaulger/Documents/myApp/node_modules/ember-cli/lib/broccoli/ember-app.js:1765:10)
at Class.included (/Users/lpaulger/Documents/myApp/node_modules/ember-useragent/index.js:9:15)
at Class.superWrapper [as included] (/Users/lpaulger/Documents/myApp/node_modules/core-object/lib/assign-properties.js:34:20)
at project.addons.forEach.addon (/Users/lpaulger/Documents/myApp/node_modules/ember-cli/lib/broccoli/ember-app.js:596:15)
at Array.forEach (<anonymous>)
at EmberApp._notifyAddonIncluded (/Users/lpaulger/Documents/myApp/node_modules/ember-cli/lib/broccoli/ember-app.js:594:25)
at new EmberApp (/Users/lpaulger/Documents/myApp/node_modules/ember-cli/lib/broccoli/ember-app.js:151:10)
Hi, are there plans (or a recommendation) for addressing iPadOS?
https://www.macworld.com/article/3403436/safari-on-ipados-13-the-best-new-features.html#toc-1
Any thoughts on either including Headless Chrome in the isChrome
or some other related property? Was wondering why my acceptance tests failed after updating to the latest version of this component, and it turned out that Headless Chrome !== Chrome. For now, just checking the browser info.name for "Headless Chrome", but might be nice to capture it somehow .
ember-useragent/addon/initializers/user-agent.js
Lines 7 to 14 in 32039b6
Initializers and implicit automatic injections are becoming somewhat of an anit-pattern lately. I would recommend to remove them.
I just got bitten by this, because I was tying to inject a service with a different name (native/user-agent
) as userAgent
, but got ember-useragent
s service, as it's auto-injected before.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.