-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
38 changed files
with
4,616 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@inox-tools/inline-mod": patch | ||
--- | ||
|
||
Initial test release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,6 @@ | |
packages/**/*.min.js | ||
packages/**/dist/**/* | ||
examples/**/* | ||
/turbo/ | ||
.github | ||
.changeset |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
name: Surface PR Changesets | ||
|
||
on: pull_request | ||
|
||
permissions: | ||
pull-requests: write | ||
checks: write | ||
statuses: write | ||
|
||
jobs: | ||
check: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Get changed files in the .changeset folder | ||
id: changed-files | ||
uses: tj-actions/changed-files@v35 | ||
with: | ||
files: | | ||
.changeset/**/*.md | ||
- name: Check if any changesets contain minor or major changes | ||
id: check | ||
run: | | ||
echo "Checking for changesets marked as minor or major" | ||
echo "found=false" >> $GITHUB_OUTPUT | ||
regex="[\"']astro[\"']: (minor|major)" | ||
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do | ||
if [[ $(cat $file) =~ $regex ]]; then | ||
version="${BASH_REMATCH[1]}" | ||
echo "version=$version" >> $GITHUB_OUTPUT | ||
echo "found=true" >> $GITHUB_OUTPUT | ||
echo "$file has a $version release tag" | ||
fi | ||
done | ||
- name: Add label | ||
uses: actions/github-script@v6 | ||
if: steps.check.outputs.found == 'true' | ||
env: | ||
issue_number: ${{ github.event.number }} | ||
with: | ||
script: | | ||
github.rest.issues.addLabels({ | ||
issue_number: process.env.issue_number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
labels: ['semver: ${{ steps.check.outputs.version }}'] | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ | |
**/fixtures | ||
**/vendor | ||
**/.vercel | ||
/turbo/ | ||
|
||
# Directories | ||
.github | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module.exports = { | ||
rules: { | ||
'@typescript-eslint/ban-types': 'off', | ||
'@typescript-eslint/no-namespace': 'off', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Inox-tools Inline Module |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
node_modules | ||
*.log | ||
lib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
node_modules | ||
*.log | ||
src |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
{ | ||
"name": "@inox-tools/inline-mod", | ||
"version": "0.0.0", | ||
"description": "Define a virtual module inline with any reference to buildtime values", | ||
"keywords": [ | ||
"vite-plugin" | ||
], | ||
"repository": "https://github.com/Fryuni/inox-tools.git", | ||
"license": "MIT", | ||
"author": "Luiz Ferraz <[email protected]>", | ||
"type": "module", | ||
"exports": { | ||
"./vite": { | ||
"types": "./dist/vite.d.ts", | ||
"default": "./dist/index.js" | ||
} | ||
}, | ||
"files": [ | ||
"README.md", | ||
"dist" | ||
], | ||
"scripts": { | ||
"build": "tsup", | ||
"clean": "rimraf ./dist", | ||
"test": "vitest", | ||
"dev": "vite --host", | ||
"prepublish": "npm run clean && npm run build" | ||
}, | ||
"dependencies": { | ||
"typescript": "^5" | ||
}, | ||
"devDependencies": { | ||
"@vitest/ui": "^1.1.3", | ||
"tsup": "^8.0.1", | ||
"upath": "^2.0.1", | ||
"vitest": "^1.1.3" | ||
}, | ||
"peerDependencies": { | ||
"vite": "^3.2.0" | ||
}, | ||
"peerDependenciesMeta": { | ||
"vite": { | ||
"optional": true | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { describe, expect, it } from 'vitest'; | ||
import type { Entry } from './entry.js'; | ||
import { EntryRegistry } from './entry.js'; | ||
|
||
describe('A smart entry registry', () => { | ||
const entry: Entry = { | ||
type: 'expr', | ||
value: 'fooExpr', | ||
}; | ||
|
||
it('should return the entry added for a key', () => { | ||
const registry = new EntryRegistry(); | ||
|
||
registry.add('foo', entry); | ||
|
||
expect(registry.lookup('foo')).toBe(entry); | ||
expect(registry.lookup('bar')).toBeUndefined(); | ||
}); | ||
|
||
it('should support sealing', () => { | ||
const registry: EntryRegistry<string> = new EntryRegistry<string>(); | ||
|
||
registry.seal(); | ||
|
||
expect(() => registry.add('foo', entry)).toThrow(); | ||
}); | ||
|
||
it('should fork into independent copies', () => { | ||
const baseRegistry = new EntryRegistry<string>(); | ||
|
||
const entryOne: Entry = { type: 'expr', value: 'one' }; | ||
const entryTwo: Entry = { type: 'expr', value: 'two' }; | ||
|
||
baseRegistry.add('foo', entryOne); | ||
|
||
const forkOne = baseRegistry.fork(); | ||
const forkTwo = forkOne.fork(); | ||
|
||
expect(forkOne.lookup('foo')).toBe(entryOne); | ||
expect(forkTwo.lookup('foo')).toBe(entryOne); | ||
|
||
forkOne.remove('foo'); | ||
forkOne.add('foo', entryTwo); | ||
|
||
expect(forkTwo.remove('foo')).toBe(entryOne); | ||
|
||
expect(baseRegistry.lookup('foo')).toBe(entryOne); | ||
expect(forkOne.lookup('foo')).toBe(entryTwo); | ||
expect(forkTwo.lookup('foo')).toBeUndefined(); | ||
|
||
baseRegistry.add('bar', entryTwo); | ||
|
||
expect(forkOne.lookup('bar')).toBeUndefined(); | ||
expect(forkTwo.lookup('bar')).toBeUndefined(); | ||
}); | ||
}); |
Oops, something went wrong.