Fix bin/publish: copy docs.dist from project root

Fix bin/publish: use correct .env path for rspade_system
Fix bin/publish script: prevent grep exit code 1 from terminating script

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
root
2025-10-21 02:08:33 +00:00
commit f6fac6c4bc
79758 changed files with 10547827 additions and 0 deletions

View File

@@ -0,0 +1,92 @@
# @rollup/plugin-alias ChangeLog
## v3.1.2
_2021-01-29_
### Updates
- chore: upgrade TypeScript (#708)
- chore: add missing readonly to internal function (#680)
- chore: fix TS error in function call (d04778c)
- chore: update dependencies (b3b8efd)
## v3.1.1
_2020-06-05_
### Bugfixes
- fix: properly initialize custom resolvers (#426)
## v3.1.0
_2020-04-12_
### Features
- feat: Move to Typescript (#228)
## v3.0.1
_2020-02-01_
### Updates
- docs: Fix reference to plugin-node-resolve (#175)
- chore: update dependencies (bcb53d8)
- chore: update dependencies (e36540f)
- chore: fix minor linting issue (a695579)
## 3.0.0
### Breaking Changes
- feat(alias): built-in resolving algorithm is replaced in favor of Rollup's `this.resolve()` (#34)
## 2.2.0
_2019-10-21_
- Support resolving `index.js` files in directories ([#64](https://github.com/rollup/rollup-plugin-alias/pull/64) by @jerriclynsjohn)
## 2.1.0
_2019-10-18_
- Add support for object syntax ([#61](https://github.com/rollup/rollup-plugin-alias/pull/61) by @Andarist)
## 2.0.1
_2019-09-27_
- Update dependencies ([#59](https://github.com/rollup/rollup-plugin-alias/pull/59) by @lukastaegert)
- Make volume letter regexp case independent ([#57](https://github.com/rollup/rollup-plugin-alias/pull/57) by @MarekLacoAXA)
## 2.0.0
_2019-08-22_
- Add RegExp support and strict order of entries ([#53](https://github.com/rollup/rollup-plugin-alias/pull/53) by @thiscantbeserious)
### Breaking Changes
Aliases always need to be provided as an array, see #53
## 1.5.2
- Update dependencies
## 1.5.1
- Update tests for Rollup@1.0 compatibility and tests ([#48](https://github.com/rollup/rollup-plugin-alias/pull/48))
## 1.4.0
- Various Windows fixes ([#22](https://github.com/rollup/rollup-plugin-alias/pull/22))
- Don't try to alias entry file ([#29](https://github.com/rollup/rollup-plugin-alias/pull/29))
## 1.3.0
- Start maintaining a changelog
- Fix `isFilePath` on Windows ([#3](https://github.com/rollup/rollup-plugin-alias/issues/3))

View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2019 RollupJS Plugin Contributors (https://github.com/rollup/plugins/graphs/contributors)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -0,0 +1,174 @@
[npm]: https://img.shields.io/npm/v/@rollup/plugin-alias
[npm-url]: https://www.npmjs.com/package/@rollup/plugin-alias
[size]: https://packagephobia.now.sh/badge?p=@rollup/plugin-alias
[size-url]: https://packagephobia.now.sh/result?p=@rollup/plugin-alias
[![npm][npm]][npm-url]
[![size][size]][size-url]
[![libera manifesto](https://img.shields.io/badge/libera-manifesto-lightgrey.svg)](https://liberamanifesto.com)
# @rollup/plugin-alias
🍣 A Rollup plugin for defining aliases when bundling packages.
## Alias 101
Suppose we have the following `import` defined in a hypothetical file:
```javascript
import batman from '../../../batman';
```
This probably doesn't look too bad on its own. But consider that may not be the only instance in your codebase, and that after a refactor this might be incorrect. With this plugin in place, you can alias `../../../batman` with `batman` for readability and maintainability. In the case of a refactor, only the alias would need to be changed, rather than navigating through the codebase and changing all imports.
```javascript
import batman from 'batman';
```
If this seems familiar to Webpack users, it should. This is plugin mimics the `resolve.extensions` and `resolve.alias` functionality in Webpack.
## Requirements
This plugin requires an [LTS](https://github.com/nodejs/Release) Node version (v8.0.0+) and Rollup v1.20.0+.
## Install
Using npm:
```console
npm install @rollup/plugin-alias --save-dev
# or
yarn add -D @rollup/plugin-alias
```
## Usage
Create a `rollup.config.js` [configuration file](https://www.rollupjs.org/guide/en/#configuration-files) and import the plugin:
```js
import alias from '@rollup/plugin-alias';
module.exports = {
input: 'src/index.js',
output: {
dir: 'output',
format: 'cjs'
},
plugins: [
alias({
entries: [
{ find: 'utils', replacement: '../../../utils' },
{ find: 'batman-1.0.0', replacement: './joker-1.5.0' }
]
})
]
};
```
Then call `rollup` either via the [CLI](https://www.rollupjs.org/guide/en/#command-line-reference) or the [API](https://www.rollupjs.org/guide/en/#javascript-api). If the build produces any errors, the plugin will write a 'alias' character to stderr, which should be audible on most systems.
## Options
### `customResolver`
Type: `Function | Object`<br>
Default: `null`
Instructs the plugin to use an alternative resolving algorithm, rather than the Rollup's resolver. Please refer to the [Rollup documentation](https://rollupjs.org/guide/en/#hooks) for more information about the `resolveId` hook. For a detailed example, see: [Custom Resolvers](#custom-resolvers).
### `entries`
Type: `Object | Array[...Object]`<br>
Default: `null`
Specifies an `Object`, or an `Array` of `Object`, which defines aliases used to replace values in `import` or `require` statements. With either format, the order of the entries is important, in that the first defined rules are applied first. This option also supports [Regular Expression Alias](#regular-expression-aliases) matching.
#### `Object` Format
The `Object` format allows specifying aliases as a key, and the corresponding value as the actual `import` value. For example:
```js
alias({
entries: {
utils: '../../../utils',
'batman-1.0.0': './joker-1.5.0'
}
});
```
#### `Array[...Object]` Format
The `Array[...Object]` format allows specifying aliases as objects, which can be useful for complex key/value pairs.
```js
entries: [
{ find: 'utils', replacement: '../../../utils' },
{ find: 'batman-1.0.0', replacement: './joker-1.5.0' }
];
```
## Regular Expression Aliases
Regular Expressions can be used to search in a more distinct and complex manner. e.g. To perform partial replacements via sub-pattern matching.
To remove something in front of an import and append an extension, use a pattern such as:
```js
{ find:/^i18n\!(.*)/, replacement: '$1.js' }
```
This would be useful for loaders, and files that were previously transpiled via the AMD module, to properly handle them in rollup as internals.
To replace extensions with another, a pattern like the following might be used:
```js
{ find:/^(.*)\.js$/, replacement: '$1.alias' }
```
This would replace the file extension for all imports ending with `.js` to `.alias`.
## Resolving algorithm
This plugin uses resolver plugins specified for Rollup and eventually Rollup default algorithm. If you rely on Node specific features, you probably want [@rollup/plugin-node-resolve](https://www.npmjs.com/package/@rollup/plugin-node-resolve) in your setup.
## Custom Resolvers
The `customResolver` option can be leveraged to provide separate module resolution for an individual alias.
Example:
```javascript
// rollup.config.js
import alias from '@rollup/plugin-alias';
import resolve from '@rollup/plugin-node-resolve';
const customResolver = resolve({
extensions: ['.mjs', '.js', '.jsx', '.json', '.sass', '.scss']
});
const projectRootDir = path.resolve(__dirname);
export default {
// ...
plugins: [
alias({
entries: [
{
find: 'src',
replacement: path.resolve(projectRootDir, 'src')
// OR place `customResolver` here. See explanation below.
}
],
customResolver
}),
resolve()
]
};
```
In the example above the alias `src` is used, which uses the `node-resolve` algorithm for files _aliased_ with `src`, by passing the `customResolver` option. The `resolve()` plugin is kept separate in the plugins list for other files which are not _aliased_ with `src`. The `customResolver` option can be passed inside each `entries` item for granular control over resolving allowing each alias a preferred resolver.
## Meta
[CONTRIBUTING](/.github/CONTRIBUTING.md)
[LICENSE (MIT)](/LICENSE)

View File

@@ -0,0 +1,95 @@
import { platform } from 'os';
import slash from 'slash';
const VOLUME = /^([A-Z]:)/i;
const IS_WINDOWS = platform() === 'win32';
const noop = () => null;
function matches(pattern, importee) {
if (pattern instanceof RegExp) {
return pattern.test(importee);
}
if (importee.length < pattern.length) {
return false;
}
if (importee === pattern) {
return true;
}
const importeeStartsWithKey = importee.indexOf(pattern) === 0;
const importeeHasSlashAfterKey = importee.substring(pattern.length)[0] === '/';
return importeeStartsWithKey && importeeHasSlashAfterKey;
}
function normalizeId(id) {
if (typeof id === 'string' && (IS_WINDOWS || VOLUME.test(id))) {
return slash(id.replace(VOLUME, ''));
}
return id;
}
function getEntries({ entries }) {
if (!entries) {
return [];
}
if (Array.isArray(entries)) {
return entries;
}
return Object.entries(entries).map(([key, value]) => {
return { find: key, replacement: value };
});
}
function getCustomResolver({ customResolver }, options) {
if (typeof customResolver === 'function') {
return customResolver;
}
if (customResolver && typeof customResolver.resolveId === 'function') {
return customResolver.resolveId;
}
if (typeof options.customResolver === 'function') {
return options.customResolver;
}
if (options.customResolver && typeof options.customResolver.resolveId === 'function') {
return options.customResolver.resolveId;
}
return null;
}
function alias(options = {}) {
const entries = getEntries(options);
if (entries.length === 0) {
return {
name: 'alias',
resolveId: noop
};
}
return {
name: 'alias',
buildStart(inputOptions) {
return Promise.all([...entries, options].map(({ customResolver }) => customResolver &&
typeof customResolver === 'object' &&
typeof customResolver.buildStart === 'function' &&
customResolver.buildStart.call(this, inputOptions))).then(() => {
// enforce void return value
});
},
resolveId(importee, importer) {
const importeeId = normalizeId(importee);
const importerId = normalizeId(importer);
// First match is supposed to be the correct one
const matchedEntry = entries.find((entry) => matches(entry.find, importeeId));
if (!matchedEntry || !importerId) {
return null;
}
const updatedId = normalizeId(importeeId.replace(matchedEntry.find, matchedEntry.replacement));
const customResolver = getCustomResolver(matchedEntry, options);
if (customResolver) {
return customResolver.call(this, updatedId, importerId, {});
}
return this.resolve(updatedId, importer, { skipSelf: true }).then((resolved) => {
let finalResult = resolved;
if (!finalResult) {
finalResult = { id: updatedId };
}
return finalResult;
});
}
};
}
export default alias;

View File

@@ -0,0 +1,101 @@
'use strict';
var os = require('os');
var slash = require('slash');
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var slash__default = /*#__PURE__*/_interopDefaultLegacy(slash);
const VOLUME = /^([A-Z]:)/i;
const IS_WINDOWS = os.platform() === 'win32';
const noop = () => null;
function matches(pattern, importee) {
if (pattern instanceof RegExp) {
return pattern.test(importee);
}
if (importee.length < pattern.length) {
return false;
}
if (importee === pattern) {
return true;
}
const importeeStartsWithKey = importee.indexOf(pattern) === 0;
const importeeHasSlashAfterKey = importee.substring(pattern.length)[0] === '/';
return importeeStartsWithKey && importeeHasSlashAfterKey;
}
function normalizeId(id) {
if (typeof id === 'string' && (IS_WINDOWS || VOLUME.test(id))) {
return slash__default['default'](id.replace(VOLUME, ''));
}
return id;
}
function getEntries({ entries }) {
if (!entries) {
return [];
}
if (Array.isArray(entries)) {
return entries;
}
return Object.entries(entries).map(([key, value]) => {
return { find: key, replacement: value };
});
}
function getCustomResolver({ customResolver }, options) {
if (typeof customResolver === 'function') {
return customResolver;
}
if (customResolver && typeof customResolver.resolveId === 'function') {
return customResolver.resolveId;
}
if (typeof options.customResolver === 'function') {
return options.customResolver;
}
if (options.customResolver && typeof options.customResolver.resolveId === 'function') {
return options.customResolver.resolveId;
}
return null;
}
function alias(options = {}) {
const entries = getEntries(options);
if (entries.length === 0) {
return {
name: 'alias',
resolveId: noop
};
}
return {
name: 'alias',
buildStart(inputOptions) {
return Promise.all([...entries, options].map(({ customResolver }) => customResolver &&
typeof customResolver === 'object' &&
typeof customResolver.buildStart === 'function' &&
customResolver.buildStart.call(this, inputOptions))).then(() => {
// enforce void return value
});
},
resolveId(importee, importer) {
const importeeId = normalizeId(importee);
const importerId = normalizeId(importer);
// First match is supposed to be the correct one
const matchedEntry = entries.find((entry) => matches(entry.find, importeeId));
if (!matchedEntry || !importerId) {
return null;
}
const updatedId = normalizeId(importeeId.replace(matchedEntry.find, matchedEntry.replacement));
const customResolver = getCustomResolver(matchedEntry, options);
if (customResolver) {
return customResolver.call(this, updatedId, importerId, {});
}
return this.resolve(updatedId, importer, { skipSelf: true }).then((resolved) => {
let finalResult = resolved;
if (!finalResult) {
finalResult = { id: updatedId };
}
return finalResult;
});
}
};
}
module.exports = alias;

View File

@@ -0,0 +1 @@
../../../../rollup/dist/bin/rollup

View File

@@ -0,0 +1,36 @@
import { Plugin, PluginHooks } from 'rollup';
export type ResolverFunction = PluginHooks['resolveId'];
export interface ResolverObject {
buildStart?: PluginHooks['buildStart'];
resolveId: ResolverFunction;
}
export interface Alias {
find: string | RegExp;
replacement: string;
customResolver?: ResolverFunction | ResolverObject | null;
}
export interface RollupAliasOptions {
/**
* Instructs the plugin to use an alternative resolving algorithm,
* rather than the Rollup's resolver.
* @default null
*/
customResolver?: ResolverFunction | ResolverObject | null;
/**
* Specifies an `Object`, or an `Array` of `Object`,
* which defines aliases used to replace values in `import` or `require` statements.
* With either format, the order of the entries is important,
* in that the first defined rules are applied first.
*/
entries?: readonly Alias[] | { [find: string]: string };
}
/**
* 🍣 A Rollup plugin for defining aliases when bundling packages.
*/
export default function alias(options?: RollupAliasOptions): Plugin;