Comments (10)
Yep, npm dropped support for the modules hash. The irony is I switched to it a while back because Isaac said it was the most future proof. I'm actually not sure how to preserve the require('nstore/pluginX') style modules in the new npm. Care to submit a patch for package.json?
from nstore.
I had the same problem with persistence.js, also wasn't able to preserve the require('.../...') style there either.
Tried to patch it with:
"main": "lib/nstore.js",
But then there seem to be other problems. It says it cannot find the pattern
library, which, in turn probably has the same problem.
from nstore.
Bleh. This deprecation really requires modules to have a significant amount of code change made to the way they export. If you add:
"directories": {
"lib": "./lib",
}
to your package.json, you can then access the individual files as such:
var Queue = require('pattern/lib/pattern/queue');
But I think to properly fix this, you have to rewrite pattern in such a way that you can access the submodules like Hash and Queue through the top-level object. Something like:
var pattern = require('pattern');
var hash = pattern.hash;
var queue = pattern.queue;
And inside the pattern module's index.js, you configure your object to export hash and queue. Make sense?
from nstore.
Yeah, that's what I usually do. See https://github.com/creationix/creationix/blob/master/index.js for an example. I don't have time to do this right now, but I'll take a pull request.
from nstore.
Awesome. I'll fork & try patching this in tonight.
from nstore.
Hmm, I wonder if this is a good idea for pattern since the root object it the parent prototype for everything. Then all objects created would have properties stuck no them which is not good. We might need to re-think how the whole thing is structured.
from nstore.
It almost feels like with this new structure, you can't export multiple root objects. Hash, Queue and Pattern all have to become independently distributed & require()'d modules. That's what I mean about code changes being required. The way Pattern is written, yea, it almost requires a re-engineering.
Maybe Hash becomes PatternHash?
Or pattern (the root-level-object) becomes a creator for the 3 child objects. Something like:
var PatternGenerator = require('pattern'); // Is a singleton class, to be compatible with npm 0.3.9+
var Hash = PatternGenerator.create('hash'); // Creates a Hash object
var Queue = PatternGenerator.create('queue'); // Creates a Queue object
var Pattern = PatternGenerator.create('pattern'); // or maybe Pattern.create()?
from nstore.
I have the same problem :/ Is there any solution avaiable?
from nstore.
Any solutions / workarounds. I'm a node.js/nbm noob. So I'd appreciate some detail on the workarounds.
from nstore.
Fixed now. I had to refactor pattern and nstore to be friendly to the new npm.
from nstore.
Related Issues (20)
- loadDatabase fails with an error in Buffer module "targetStart out of bounds" HOT 1
- msgpack HOT 1
- TypeError: Object #<initialize> has no method 'loadDatabase' HOT 4
- nstore module not loading HOT 7
- Why is there no close() function?
- find / get fail HOT 4
- "results is an object keyed by document key with the document as the value" HOT 1
- get result from users.find() function
- installing nstore HOT 1
- How to user ur module for user of my site
- What is the best practice ? (beginner question)
- Save Keeps Add New Entries to Database HOT 1
- Support regex or glob-style patterns
- publish this to NPM HOT 1
- Length extends beyond buffer HOT 4
- Is this project still alive? HOT 3
- 3gb in size to the database HOT 1
- Saving same key twice creates 2 data rows rather than updating existing key HOT 1
- Issue with get all function right after saving an object to DB HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nstore.