Skip to content

Commit d3f97a9

Browse files
committed
Merge branch 'develop' of https://github.com/stdlib-js/stdlib into refactor/plot
2 parents 277185a + e6bfc53 commit d3f97a9

File tree

32 files changed

+661
-88
lines changed

32 files changed

+661
-88
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
type: amend-message
3+
---
4+
feat: add constants to `float64` namespace
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
type: amend-message
3+
---
4+
feat: add `planck` distribution namespace

lib/node_modules/@stdlib/_tools/eslint/rules/doctest/lib/main.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ var join = require( 'path' ).join;
2626
var format = require( 'util' ).format;
2727
var dirname = require( 'path' ).dirname;
2828
var logger = require( 'debug' );
29+
var rootDir = require( '@stdlib/_tools/utils/root-dir' );
2930
var Buffer = require( '@stdlib/buffer/ctor' );
3031
var isNull = require( '@stdlib/assert/is-null' );
3132
var isString = require( '@stdlib/assert/is-string' ).isPrimitive;
@@ -43,6 +44,7 @@ var windowShim = require( './window.js' );
4344
// VARIABLES //
4445

4546
var debug = logger( 'doctest' );
47+
var ROOT_DIR = rootDir();
4648
var RE_JSDOC = /\/\*\*[\s\S]+?\*\//g;
4749
var RE_ESLINT_INLINE = / ?\/\/ eslint-disable-(?:next-)?line[^\n]*\n/g;
4850
var RE_NEWLINE = /\r?\n/g;
@@ -137,9 +139,16 @@ function main( context ) {
137139
* @returns {*} required module
138140
*/
139141
function customRequire( path ) {
142+
var stdlibPath;
143+
140144
if ( startsWith( path, './' ) ) {
141145
return require( join( dir, path ) ); // eslint-disable-line stdlib/no-dynamic-require
142146
}
147+
// Force `@stdlib` packages to be loaded from `lib/node_modules/@stdlib`:
148+
if ( startsWith( path, '@stdlib/' ) ) {
149+
stdlibPath = join( ROOT_DIR, 'lib', 'node_modules', path );
150+
return require( stdlibPath ); // eslint-disable-line stdlib/no-dynamic-require
151+
}
143152
return require( path ); // eslint-disable-line stdlib/no-dynamic-require
144153
}
145154
scope = {

lib/node_modules/@stdlib/_tools/eslint/rules/jsdoc-doctest/lib/main.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ var format = require( 'util' ).format;
2727
var dirname = require( 'path' ).dirname;
2828
var logger = require( 'debug' );
2929
var parseJSDoc = require( 'doctrine' ).parse;
30+
var rootDir = require( '@stdlib/_tools/utils/root-dir' );
3031
var Buffer = require( '@stdlib/buffer/ctor' );
3132
var isNull = require( '@stdlib/assert/is-null' );
3233
var isNumber = require( '@stdlib/assert/is-number' );
@@ -46,6 +47,7 @@ var windowShim = require( './window.js' );
4647
// VARIABLES //
4748

4849
var debug = logger( 'jsdoc-doctest' );
50+
var ROOT_DIR = rootDir();
4951
var RE_ANNOTATION = /(?:\n|^)(?:var|let|const)? ?([a-zA-Z0-9._]+) ?=?[^;]*;\n\/\/ ?(returns|([A-Za-z][A-Za-z_0-9]*)? ?=>|throws) {0,1}([\s\S]*?)(\n|$)/g;
5052
var RE_CONSOLE = /console\.(?:dir|error|log)/;
5153
var RE_MODULE_TAG = /\* @module[^\n]*\n/g;
@@ -147,9 +149,16 @@ function main( context ) {
147149
* @returns {*} required module
148150
*/
149151
function customRequire( path ) {
152+
var stdlibPath;
153+
150154
if ( startsWith( path, './' ) ) {
151155
return require( join( dir, path ) ); // eslint-disable-line stdlib/no-dynamic-require
152156
}
157+
// Force `@stdlib` packages to be loaded from `lib/node_modules/@stdlib`:
158+
if ( startsWith( path, '@stdlib/' ) ) {
159+
stdlibPath = join( ROOT_DIR, 'lib', 'node_modules', path );
160+
return require( stdlibPath ); // eslint-disable-line stdlib/no-dynamic-require
161+
}
153162
return require( path ); // eslint-disable-line stdlib/no-dynamic-require
154163
}
155164
scope = {

lib/node_modules/@stdlib/_tools/eslint/rules/namespace-export-all/lib/main.js

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,15 @@
2323
var basename = require( 'path' ).basename;
2424
var dirname = require( 'path' ).dirname;
2525
var join = require( 'path' ).join;
26-
var relative = require( 'path' ).relative;
2726
var statSync = require( 'fs' ).statSync; // eslint-disable-line node/no-sync
27+
var exists = require( '@stdlib/fs/exists' ).sync;
2828
var endsWith = require( '@stdlib/string/ends-with' );
29-
var replace = require( '@stdlib/string/replace' );
3029
var isString = require( '@stdlib/assert/is-string' ).isPrimitive;
3130
var trim = require( '@stdlib/string/trim' );
3231
var camelcase = require( '@stdlib/string/base/camelcase' );
3332
var readDir = require( '@stdlib/fs/read-dir' ).sync;
3433
var contains = require( '@stdlib/assert/contains' );
35-
var rootDir = require( '@stdlib/_tools/utils/root-dir' );
34+
var resolvePackage = require( './resolve_package.js' );
3635

3736

3837
// VARIABLES //
@@ -41,7 +40,6 @@ var rule;
4140
var ORDER_COMMENT = 'When adding modules to the namespace, ensure that they are added in alphabetical order according to module name.';
4241
var RE_CUSTOM_EXCLUDES = /The following modules are intentionally not exported: ?([^\n]+)\n/;
4342
var RE_NS_VAR = /@namespace ([a-zA-Z0-9_]+)/;
44-
var LIB_DIR = join( rootDir(), 'lib', 'node_modules' );
4543
var EXCLUDE_LIST = [
4644
'node_modules',
4745
'benchmark',
@@ -184,15 +182,15 @@ function main( context ) {
184182
* @returns {Object} fix
185183
*/
186184
function fix( fixer ) {
187-
var nsPath;
185+
var packagePath;
188186
var entry;
189187
var match;
190188
var pos;
191189
var ns;
192190
var re;
193191
var i;
194192

195-
nsPath = replace( relative( LIB_DIR, dir ), '\\', '/' );
193+
packagePath = resolvePackage( dir, pkg );
196194
match = RE_NS_VAR.exec( source.text );
197195
if ( !match ) {
198196
return null;
@@ -208,7 +206,7 @@ function main( context ) {
208206
'*/',
209207
'setReadOnly( <<ns>>, \'<<alias>>\', require( \'<<pkg>>\' ) );'
210208
].join( '\n' );
211-
entry = entry.replace( /<<pkg>>/g, nsPath + '/' + pkg );
209+
entry = entry.replace( /<<pkg>>/g, packagePath );
212210
entry = entry.replace( /<<alias>>/g, camelcase( pkg ) );
213211
entry = entry.replace( /<<ns>>/g, ns );
214212

@@ -218,7 +216,7 @@ function main( context ) {
218216
if ( pkg.localeCompare( packages[ i ], 'en', OPTS_COMPARE ) < 0 ) {
219217
break;
220218
}
221-
re = new RegExp( 'require\\( \'' + nsPath + '\\/' + packages[ i ] + '\' \\) \\);' );
219+
re = new RegExp( 'require\\( \'' + resolvePackage( dir, packages[ i ] ) + '\' \\) \\);' );
222220
if ( re.test( source.text ) ) {
223221
pos = source.text.search( re );
224222
}
@@ -252,16 +250,21 @@ function main( context ) {
252250
* @returns {Array} namespace package directories
253251
*/
254252
function packageDirectories( contents ) {
253+
var pkgJSONPath;
254+
var contentPath;
255255
var content;
256256
var out;
257257
var i;
258258

259259
out = [];
260260
for ( i = 0; i < contents.length; i++ ) {
261261
content = contents[ i ];
262+
contentPath = join( dir, content );
263+
pkgJSONPath = join( contentPath, 'package.json' );
262264
if (
263-
isDirectory( join( dir, content ) ) &&
264-
!contains( excludes, content )
265+
isDirectory( contentPath ) &&
266+
!contains( excludes, content ) &&
267+
exists( pkgJSONPath )
265268
) {
266269
out.push( content );
267270
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2025 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
'use strict';
20+
21+
// MODULES //
22+
23+
var join = require( 'path' ).join;
24+
var relative = require( 'path' ).relative;
25+
var replace = require( '@stdlib/string/replace' );
26+
var rootDir = require( '@stdlib/_tools/utils/root-dir' );
27+
28+
29+
// VARIABLES //
30+
31+
var LIB_DIR = join( rootDir(), 'lib', 'node_modules' );
32+
33+
34+
// MAIN //
35+
36+
/**
37+
* Resolves a stdlib package identifier from directory path and package name.
38+
*
39+
* @private
40+
* @param {string} dir - directory path containing the package
41+
* @param {string} pkg - package name
42+
* @returns {string} stdlib package identifier relative to the lib directory
43+
*
44+
* @example
45+
* var join = require( 'path' ).join;
46+
* var rootDir = require( '@stdlib/_tools/utils/root-dir' );
47+
*
48+
* var LIB_DIR = join( rootDir(), 'lib', 'node_modules' );
49+
* var dir = join( LIB_DIR, '@stdlib', 'math', 'base' );
50+
*
51+
* var pkgId = resolvePackage( dir, 'abs' );
52+
* // returns '@stdlib/math/base/abs'
53+
*/
54+
function resolvePackage( dir, pkg ) {
55+
var nsPath = replace( relative( LIB_DIR, dir ), '\\', '/' );
56+
return nsPath + '/' + pkg;
57+
}
58+
59+
60+
// EXPORTS //
61+
62+
module.exports = resolvePackage;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
{
2+
"name": "@stdlib/assert/is-complex128",
3+
"version": "0.0.0",
4+
"description": "Test if a value is a 128-bit complex number.",
5+
"license": "Apache-2.0",
6+
"author": {
7+
"name": "The Stdlib Authors",
8+
"url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
9+
},
10+
"contributors": [
11+
{
12+
"name": "The Stdlib Authors",
13+
"url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
14+
}
15+
],
16+
"main": "./lib",
17+
"directories": {
18+
"benchmark": "./benchmark",
19+
"doc": "./docs",
20+
"example": "./examples",
21+
"lib": "./lib",
22+
"test": "./test"
23+
},
24+
"types": "./docs/types",
25+
"scripts": {},
26+
"homepage": "https://github.com/stdlib-js/stdlib",
27+
"repository": {
28+
"type": "git",
29+
"url": "git://github.com/stdlib-js/stdlib.git"
30+
},
31+
"bugs": {
32+
"url": "https://github.com/stdlib-js/stdlib/issues"
33+
},
34+
"dependencies": {},
35+
"devDependencies": {},
36+
"engines": {
37+
"node": ">=0.10.0",
38+
"npm": ">2.7.0"
39+
},
40+
"os": [
41+
"aix",
42+
"darwin",
43+
"freebsd",
44+
"linux",
45+
"macos",
46+
"openbsd",
47+
"sunos",
48+
"win32",
49+
"windows"
50+
],
51+
"keywords": [
52+
"stdlib",
53+
"stdassert",
54+
"assertion",
55+
"assert",
56+
"utilities",
57+
"utility",
58+
"utils",
59+
"util",
60+
"is",
61+
"iscomplex",
62+
"complex128",
63+
"128-bit",
64+
"float64",
65+
"double",
66+
"double-precision",
67+
"ieee754",
68+
"type",
69+
"check",
70+
"validate",
71+
"isvalid",
72+
"test"
73+
]
74+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
{
2+
"name": "@stdlib/assert/is-complex64",
3+
"version": "0.0.0",
4+
"description": "Test if a value is a 64-bit complex number.",
5+
"license": "Apache-2.0",
6+
"author": {
7+
"name": "The Stdlib Authors",
8+
"url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
9+
},
10+
"contributors": [
11+
{
12+
"name": "The Stdlib Authors",
13+
"url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
14+
}
15+
],
16+
"main": "./lib",
17+
"directories": {
18+
"benchmark": "./benchmark",
19+
"doc": "./docs",
20+
"example": "./examples",
21+
"lib": "./lib",
22+
"test": "./test"
23+
},
24+
"types": "./docs/types",
25+
"scripts": {},
26+
"homepage": "https://github.com/stdlib-js/stdlib",
27+
"repository": {
28+
"type": "git",
29+
"url": "git://github.com/stdlib-js/stdlib.git"
30+
},
31+
"bugs": {
32+
"url": "https://github.com/stdlib-js/stdlib/issues"
33+
},
34+
"dependencies": {},
35+
"devDependencies": {},
36+
"engines": {
37+
"node": ">=0.10.0",
38+
"npm": ">2.7.0"
39+
},
40+
"os": [
41+
"aix",
42+
"darwin",
43+
"freebsd",
44+
"linux",
45+
"macos",
46+
"openbsd",
47+
"sunos",
48+
"win32",
49+
"windows"
50+
],
51+
"keywords": [
52+
"stdlib",
53+
"stdassert",
54+
"assertion",
55+
"assert",
56+
"utilities",
57+
"utility",
58+
"utils",
59+
"util",
60+
"is",
61+
"iscomplex",
62+
"complex64",
63+
"64-bit",
64+
"float32",
65+
"single",
66+
"single-precision",
67+
"ieee754",
68+
"type",
69+
"check",
70+
"test",
71+
"validate",
72+
"isvalid",
73+
"valid"
74+
]
75+
}

0 commit comments

Comments
 (0)