Commit d8297c90 authored by Laurent Wouters's avatar Laurent Wouters
Browse files

Exported RDF typing stubs in external package

parent 3a953daebc48
......@@ -6,4 +6,5 @@
npm-debug.log
lib/bs/
node_modules/
build/
\ No newline at end of file
build/
_bundles/
\ No newline at end of file
{
"name": "@types/rdflib",
"version": "0.1.0",
"description": "Typing stubs for rdflib.",
"scripts": {
"build": "webpack",
"clean": "rm -rf build/*",
"test": "echo \"Error: no test specified\" && exit 1",
"build:production": "NODE_ENV=production webpack"
},
"types": "./build/lib/index.d.ts",
"repository": {
"type": "hg",
"url": "https://bitbucket.org/laurentw/logilab-cubicweb-client"
},
"keywords": [
"RDF",
"Typescript"
],
"author": "LOGILAB <contact@logilab.fr>",
"license": "LGPL-3.0",
"dependencies": {},
"devDependencies": {
"source-map-loader": "^0.2.3",
"ts-loader": "^4.4.2",
"typescript": "^2.9.2",
"webpack": "^4.0.1",
"webpack-cli": "^2.0.10"
}
}
/*******************************************************************************
* Copyright 2003-2018 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
* contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
*
* This file is part of CubicWeb.
*
* CubicWeb is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 2.1 of the License, or (at your option)
* any later version.
*
* CubicWeb is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License along
* with CubicWeb. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
/**
* RDF stubs for Typescript
*/
export interface Term {
termType: string;
value: string;
equals(other: Term): boolean;
}
export interface NamedNode extends Term {
uri: string;
}
export interface BlankNode extends Term {
id: string;
}
export interface Literal extends Term {
language: string;
datatype: NamedNode;
}
export interface Variable extends Term {}
export interface DefaultGraph extends Term {}
export type SubjectNode = NamedNode | BlankNode;
export interface Quad {
subject: SubjectNode;
predicate: NamedNode;
object: Term;
graph: NamedNode;
why: NamedNode;
equals(other: Quad): boolean;
}
export interface Triple extends Quad {}
export interface RdfStore {
statements: Triple[];
add(
subject: SubjectNode,
predicate: NamedNode,
object: Term,
why: NamedNode
): void;
any(
subject: SubjectNode,
predicate: NamedNode,
object: Term,
why: NamedNode
): Term;
each(
subject: SubjectNode,
predicate: NamedNode,
object: Term,
why: NamedNode
): Term[];
}
export type Namespace = (fragment: string) => NamedNode;
export interface RDF {
graph(): RdfStore;
parse(
input: string,
store: RdfStore,
origin: string,
contentType: string
): void;
sym(iri: string): NamedNode;
bnode(): BlankNode;
literal(value: string): Literal;
literal(value: string, language: string): Literal;
literal(value: string, language: string, datatype: NamedNode): Literal;
Namespace(iriRadical: string): Namespace;
}
export var $rdf: RDF;
{
"compilerOptions": {
"outDir": "./lib/",
"sourceMap": true,
"declaration": true,
"noImplicitAny": true,
"module": "commonjs",
"target": "es6",
"lib": [ "es6", "dom" ],
"jsx": "react"
},
"include": [
"./src/**/*"
],
}
\ No newline at end of file
const path = require("path");
const isProd = process.env.NODE_ENV === "production";
module.exports = [
{
entry: "./src/index.ts",
mode: isProd ? "production" : "development",
output: {
path: path.join(__dirname, "build/"),
publicPath: path.join(__dirname, "build/"),
filename: "index.js"
},
devtool: "source-map",
resolve: {
extensions: [".ts", ".d.ts", ".tsx", ".js", ".json"]
},
module: {
rules: [
{ test: /\.tsx?$/, loader: "ts-loader" },
{ enforce: "pre", test: /\.js$/, loader: "source-map-loader" }
]
}
}
];
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment